Skip to content

Commit

Permalink
Merge branch 'kubernetes:master' into configure-memory-target
Browse files Browse the repository at this point in the history
  • Loading branch information
emla9 authored Mar 14, 2024
2 parents 8a705f7 + ffe9680 commit 3458b79
Show file tree
Hide file tree
Showing 1,797 changed files with 45,860 additions and 320,117 deletions.
2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21.6
FROM golang:1.21.8
LABEL maintainer="Marcin Wielgus <[email protected]>"

ENV GOPATH /gopath/
Expand Down
5 changes: 4 additions & 1 deletion cluster-autoscaler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ IMAGE=$(REGISTRY)/cluster-autoscaler$(PROVIDER)

export DOCKER_CLI_EXPERIMENTAL := enabled

build: build-arch-$(GOARCH)
build:
@echo "⚠️ WARNING: The vendor directory will be removed soon. \
Please make sure your dependencies are managed via Go modules."
@$(MAKE) build-arch-$(GOARCH)

build-arch-%: clean-arch-%
$(ENVVAR) GOOS=$(GOOS) GOARCH=$* go build -o cluster-autoscaler-$* ${LDFLAGS_FLAG} ${TAGS_FLAG}
Expand Down
1 change: 1 addition & 0 deletions cluster-autoscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Starting from Kubernetes 1.12, versioning scheme was changed to match Kubernetes

| Kubernetes Version | CA Version |
|--------|--------|
| 1.29.X | 1.29.X |
| 1.28.X | 1.28.X |
| 1.27.X | 1.27.X |
| 1.26.X | 1.26.X |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/satori/go.uuid"
"github.com/google/uuid"
"net/url"
"reflect"
"strconv"
Expand All @@ -37,8 +37,9 @@ var (

// GetUUIDV4 returns uuidHex
func GetUUIDV4() (uuidHex string) {
uuidV4 := uuid.NewV4()
uuidHex = hex.EncodeToString(uuidV4.Bytes())
uuidV4 := uuid.New()
binaryUUID, _ := uuidV4.MarshalBinary()
uuidHex = hex.EncodeToString(binaryUUID)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func (asg *Asg) IncreaseSize(delta int) error {
return asg.manager.SetAsgSize(asg, size+int64(delta))
}

// AtomicIncreaseSize is not implemented.
func (asg *Asg) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DecreaseTargetSize decreases the target size of the node group. This function
// doesn't permit to delete any existing node and can be used only to reduce the
// request for new nodes that have not been yet fulfilled. Delta should be negative.
Expand Down
16 changes: 9 additions & 7 deletions cluster-autoscaler/cloudprovider/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ as string). Currently supported autoscaling options (and example values) are:
* `k8s.io/cluster-autoscaler/node-template/autoscaling-options/scaledownunreadytime`: `20m0s`
(overrides `--scale-down-unready-time` value for that specific ASG)
* `k8s.io/cluster-autoscaler/node-template/autoscaling-options/ignoredaemonsetsutilization`: `true`
(overrides `--ignore-daemonsets-utilization` value for that specific ASG)
(overrides `--ignore-daemonsets-utilization` value for that specific ASG)

**NOTE:** It is your responsibility to ensure such labels and/or taints are
applied via the node's kubelet configuration at startup. Cluster Autoscaler will not set the node taints for you.
Expand Down Expand Up @@ -507,12 +507,14 @@ Please note: it is also possible to mount the cloud config file from host:
`--scale-down-delay-after-delete`, and `--scale-down-delay-after-failure`
flag. E.g. `--scale-down-delay-after-add=5m` to decrease the scale down delay
to 5 minutes after a node has been added.
- If you're running multiple ASGs, the `--expander` flag supports three options:
`random`, `most-pods` and `least-waste`. `random` will expand a random ASG on
scale up. `most-pods` will scale up the ASG that will schedule the most amount
of pods. `least-waste` will expand the ASG that will waste the least amount of
CPU/MEM resources. In the event of a tie, cluster autoscaler will fall back to
`random`.
- If you're running multiple ASGs, the `--expander` flag supports five options:
`random`, `most-pods`, `least-waste`, `priority`, and `grpc`. `random` will
expand a random ASG on scale up. `most-pods` will scale up the ASG that will
schedule the most amount of pods. `least-waste` will expand the ASG that will
waste the least amount of CPU/MEM resources. In the event of a tie, cluster
autoscaler will fall back to`random`. The `priority` expander lets you define
a custom priority ranking in a ConfigMap for selecting ASGs, and the `grpc`
expander allows you to write your own expansion logic.
- If you're managing your own kubelets, they need to be started with the
`--provider-id` flag. The provider id has the format
`aws:///<availability-zone>/<instance-id>`, e.g.
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ func (ng *AwsNodeGroup) IncreaseSize(delta int) error {
return ng.awsManager.SetAsgSize(ng.asg, size+delta)
}

// AtomicIncreaseSize is not implemented.
func (ng *AwsNodeGroup) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DecreaseTargetSize decreases the target size of the node group. This function
// doesn't permit to delete any existing node and can be used only to reduce the
// request for new nodes that have not been yet fulfilled. Delta should be negative.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- image: registry.k8s.io/autoscaling/cluster-autoscaler:v1.26.2
name: cluster-autoscaler
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_agent_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func (as *AgentPool) IncreaseSize(delta int) error {
return realError
}

// AtomicIncreaseSize is not implemented.
func (as *AgentPool) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DecreaseTargetSize decreases the target size of the node group. This function
// doesn't permit to delete any existing node and can be used only to reduce the
// request for new nodes that have not been yet fulfilled. Delta should be negative.
Expand Down
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ func (scaleSet *ScaleSet) IncreaseSize(delta int) error {
return scaleSet.SetScaleSetSize(size + int64(delta))
}

// AtomicIncreaseSize is not implemented.
func (scaleSet *ScaleSet) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// GetScaleSetVms returns list of nodes for the given scale set.
func (scaleSet *ScaleSet) GetScaleSetVms() ([]compute.VirtualMachineScaleSetVM, *retry.Error) {
klog.V(4).Infof("GetScaleSetVms: starts")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- command:
- ./cluster-autoscaler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- command:
- ./cluster-autoscaler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- command:
- ./cluster-autoscaler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- image: registry.k8s.io/autoscaling/cluster-autoscaler:{{ ca_version }}
imagePullPolicy: Always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ spec:
- effect: NoSchedule
operator: "Equal"
value: "true"
key: node-role.kubernetes.io/master
key: node-role.kubernetes.io/control-plane
nodeSelector:
kubernetes.io/role: master
kubernetes.io/role: control-plane
containers:
- image: registry.k8s.io/autoscaling/cluster-autoscaler:{{ ca_version }}
imagePullPolicy: Always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ func (asg *Asg) IncreaseSize(delta int) error {
return asg.baiducloudManager.ScaleUpCluster(delta, asg.Name)
}

// AtomicIncreaseSize is not implemented.
func (asg *Asg) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DeleteNodes deletes nodes from this node group. Error is returned either on
// failure or if the given node doesn't belong to this node group. This function
// should wait until node group size is updated. Implementation required.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func (n *NodeGroup) IncreaseSize(delta int) error {
return nil
}

// AtomicIncreaseSize is not implemented.
func (n *NodeGroup) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DeleteNodes deletes nodes from this node group (and also increasing the size
// of the node group with that). Error is returned either on failure or if the
// given node doesn't belong to this node group. This function should wait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ func (ng *brightboxNodeGroup) IncreaseSize(delta int) error {
)
}

// AtomicIncreaseSize is not implemented.
func (ng *brightboxNodeGroup) AtomicIncreaseSize(delta int) error {
return cloudprovider.ErrNotImplemented
}

// DeleteNodes deletes nodes from this node group. Error is returned
// either on failure or if the given node doesn't belong to this
// node group. This function should wait until node group size is
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_alicloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/alicloud"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for alicloud-only build is alicloud.
const DefaultCloudProvider = cloudprovider.AlicloudProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.AlicloudProviderName:
return alicloud.BuildAlicloud(opts, do, rl)
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for AWS-only build is AWS.
const DefaultCloudProvider = cloudprovider.AwsProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.AwsProviderName:
return aws.BuildAWS(opts, do, rl)
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/azure"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider on Azure-only build is Azure.
const DefaultCloudProvider = cloudprovider.AzureProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.AzureProviderName:
return azure.BuildAzure(opts, do, rl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/baiducloud"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for baiducloud-only build is baiducloud.
const DefaultCloudProvider = cloudprovider.BaiducloudProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.BaiducloudProviderName:
return baiducloud.BuildBaiducloud(opts, do, rl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/bizflycloud"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the Bizflycloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider build is Bizflycloud..
const DefaultCloudProvider = cloudprovider.BizflyCloudProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.BizflyCloudProviderName:
return bizflycloud.BuildBizflyCloud(opts, do, rl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/brightbox"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the brightbox cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider is Brightbox
const DefaultCloudProvider = cloudprovider.BrightboxProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.BrightboxProviderName:
return brightbox.BuildBrightbox(opts, do, rl)
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_cherry.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
cherry "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/cherryservers"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for Cherry-only build is Cherry
const DefaultCloudProvider = cherry.ProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cherry.ProviderName:
return cherry.BuildCherry(opts, do, rl)
Expand Down
3 changes: 2 additions & 1 deletion cluster-autoscaler/cloudprovider/builder/builder_civo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/civo"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the digtalocean cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for civo-only build is Civo.
const DefaultCloudProvider = cloudprovider.CivoProviderName

func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.CivoProviderName:
return civo.BuildCivo(opts, do, rl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/cloudstack"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/client-go/informers"
)

// AvailableCloudProviders supported by the cloud provider builder.
Expand All @@ -33,7 +34,7 @@ var AvailableCloudProviders = []string{
// DefaultCloudProvider for cloudstack-only build is cloudstack.
const DefaultCloudProvider = cloudprovider.CloudStackProviderName

func BuildCloudStack(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter) cloudprovider.CloudProvider {
func BuildCloudStack(opts config.AutoscalingOptions, do cloudprovider.NodeGroupDiscoveryOptions, rl *cloudprovider.ResourceLimiter, _ informers.SharedInformerFactory) cloudprovider.CloudProvider {
switch opts.CloudProviderName {
case cloudprovider.CloudStackProviderName:
return cloudstack.BuildCloudStack(opts, do, rl)
Expand Down
Loading

0 comments on commit 3458b79

Please sign in to comment.