Skip to content

Commit

Permalink
feat(cluster-autoscaler) upgrade to 1.27
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe.chou committed Jun 26, 2024
1 parent 06465a3 commit 89c404e
Show file tree
Hide file tree
Showing 86 changed files with 27,975 additions and 316 deletions.
21 changes: 21 additions & 0 deletions cluster-autoscaler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.19.13 AS build

ARG TARGETARCH
ENV GOPATH /gopath/
ENV PATH $GOPATH/bin:$PATH
ENV GO111MODULE auto
ENV GOARCH ${TARGETARCH}

RUN apt-get update && apt-get --yes install libseccomp-dev
RUN go version
RUN go get github.com/tools/godep
RUN godep version

WORKDIR /gopath/src/k8s.io/autoscaler/cluster-autoscaler
ADD . .
RUN CGO_ENABLED=0 GOOS=linux go build -o cluster-autoscaler --ldflags "-s"

FROM alpine
COPY --from=build /gopath/src/k8s.io/autoscaler/cluster-autoscaler/cluster-autoscaler /

CMD ["./cluster-autoscaler"]
5 changes: 5 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/service/eks"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/autoscaler/cluster-autoscaler/utils/gpu"
"k8s.io/autoscaler/cluster-autoscaler/utils/gpumemory"
"k8s.io/autoscaler/cluster-autoscaler/utils/mpscontext"
klog "k8s.io/klog/v2"
)

const (
Expand Down Expand Up @@ -270,6 +273,8 @@ func (m *AwsManager) buildNodeFromTemplate(asg *asg, template *asgTemplate) (*ap
node.Status.Capacity[apiv1.ResourceCPU] = *resource.NewQuantity(template.InstanceType.VCPU, resource.DecimalSI)
node.Status.Capacity[gpu.ResourceNvidiaGPU] = *resource.NewQuantity(template.InstanceType.GPU, resource.DecimalSI)
node.Status.Capacity[apiv1.ResourceMemory] = *resource.NewQuantity(template.InstanceType.MemoryMb*1024*1024, resource.DecimalSI)
node.Status.Capacity[gpumemory.ResourceVisenzeGPUMemory] = *resource.NewQuantity(template.InstanceType.GPUMemory, resource.DecimalSI)
node.Status.Capacity[mpscontext.ResourceVisenzeMPSContext] = *resource.NewQuantity(template.InstanceType.MPSContext, resource.DecimalSI)

m.updateCapacityWithRequirementsOverrides(&node.Status.Capacity, asg.MixedInstancesPolicy)

Expand Down
4 changes: 4 additions & 0 deletions cluster-autoscaler/cloudprovider/builder/builder_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/scaleway"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/tencentcloud"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/vultr"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/spotinst"
"k8s.io/autoscaler/cluster-autoscaler/config"
)

Expand Down Expand Up @@ -80,6 +81,7 @@ var AvailableCloudProviders = []string{
cloudprovider.CivoProviderName,
cloudprovider.ScalewayProviderName,
cloudprovider.RancherProviderName,
cloudprovider.SpotinstProviderName,
}

// DefaultCloudProvider is GCE.
Expand Down Expand Up @@ -141,6 +143,8 @@ func buildCloudProvider(opts config.AutoscalingOptions, do cloudprovider.NodeGro
return scaleway.BuildScaleway(opts, do, rl)
case cloudprovider.RancherProviderName:
return rancher.BuildRancher(opts, do, rl)
case cloudprovider.SpotinstProviderName:
return spotinst.BuildSpotinst(opts, do, rl)
}
return nil
}
2 changes: 2 additions & 0 deletions cluster-autoscaler/cloudprovider/cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ const (
CivoProviderName = "civo"
// RancherProviderName gets the provider name of rancher
RancherProviderName = "rancher"
// SpotinstProviderName gets the provider name of aws
SpotinstProviderName = "spotinst"
)

// GpuConfig contains the label, type and the resource name for a GPU.
Expand Down
Loading

0 comments on commit 89c404e

Please sign in to comment.