Skip to content

Commit

Permalink
merge to 1.25
Browse files Browse the repository at this point in the history
change the agent

add readme

Update aws_ec2_instance_types.go

update g4dn.xlarge

feat: support multi-arch

feat: change the agent

feat: change to amd64, arm64 would coredump

fix: update the exec path

fix: change to use alpine as base image

fix: add more compilation args

update

update
  • Loading branch information
Jinyu Pan committed Oct 24, 2023
1 parent ad004fe commit d3cb401
Show file tree
Hide file tree
Showing 15 changed files with 6,012 additions and 0 deletions.
97 changes: 97 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// throttle concurrent build
properties([[$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 1, maxConcurrentTotal: 1, paramsToUseForLimit: '', throttleEnabled: true, throttleOption: 'project']])

library(identifier: "visenze-lib@${params['VISENZE_LIB_BRANCH'] ?: 'master'}", changelog: false)

pipeline {
agent {
label "build-amd64"
}

options {
ansiColor('xterm')
}

tools {
go 'go1.15'
}

stages {
stage('Checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: [
[
$class: 'CloneOption',
noTags: true,
reference: '',
timeout: 60
],
[
$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
trackingSubmodules: true,
reference: '',
timeout: 60
],
[$class: 'CleanBeforeCheckout']
],
userRemoteConfigs: scm.userRemoteConfigs
])
}
}

stage('Test') {
when {
expression {
return canRun()
}
}
steps {
script {
dir('cluster-autoscaler') {
sh('make test-in-docker')
}
}
}
}

stage('Docker Build&Push') {
when {
expression {
return canRun()
}
}
steps {
script {
dir('cluster-autoscaler') {
def version = sh(script: "grep ClusterAutoscalerVersion version/version.go",
returnStdout: true).split('"')[-2]
docker.withRegistry('', 'docker-hub-credential') {
sh("docker buildx create --use")
sh("docker buildx build -t visenze/cluster-autoscaler:${version} --push --platform linux/arm64,linux/amd64 .")
}

build(job: 'devops_docker_registry_copy_image', parameters: [
string(name: 'REPOSITORY', value: "visenze/cluster-autoscaler"),
string(name: 'DOCKER_TAG', value: version),
string(name: 'TIMEOUT', value: "30"),
string(name: 'SOURCE_DOCKER_REGISTRY_CREDENTIAL', value: "docker-hub-credential"),
string(name: 'DEST_DOCKER_REGISTRY', value: "https://741813507711.dkr.ecr.cn-northwest-1.amazonaws.com.cn"),
string(name: 'DEST_DOCKER_REGISTRY_CREDENTIAL', value: "ecr:cn-northwest-1:aws-cn-jenkins"),
])
}
}
}
}
}
}

def canRun() {
return env.BRANCH_NAME.startsWith('release-') || env.BRANCH_NAME == 'master'
}
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.7 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"]
4 changes: 4 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ 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"
provider_aws "k8s.io/legacy-cloud-providers/aws"
)
Expand Down Expand Up @@ -405,6 +407,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)

if err := m.updateCapacityWithRequirementsOverrides(&node.Status.Capacity, asg.MixedInstancesPolicy); err != nil {
return nil, err
Expand Down
14 changes: 14 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/ec2_instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type InstanceType struct {
MemoryMb int64
GPU int64
Architecture string
GPUMemory int64
MPSContext int64
}

// StaticListLastUpdateTime is a string declaring the last time the static list was updated.
Expand Down Expand Up @@ -1123,27 +1125,35 @@ var InstanceTypes = map[string]*InstanceType{
MemoryMb: 262144,
GPU: 1,
Architecture: "amd64",
GPUMemory: 15842934784,
MPSContext: 32,
},
"g4dn.2xlarge": {
InstanceType: "g4dn.2xlarge",
VCPU: 8,
MemoryMb: 32768,
GPU: 1,
Architecture: "amd64",
GPUMemory: 15842934784,
MPSContext: 32,
},
"g4dn.4xlarge": {
InstanceType: "g4dn.4xlarge",
VCPU: 16,
MemoryMb: 65536,
GPU: 1,
Architecture: "amd64",
GPUMemory: 15842934784,
MPSContext: 32,
},
"g4dn.8xlarge": {
InstanceType: "g4dn.8xlarge",
VCPU: 32,
MemoryMb: 131072,
GPU: 1,
Architecture: "amd64",
GPUMemory: 15842934784,
MPSContext: 32,
},
"g4dn.metal": {
InstanceType: "g4dn.metal",
Expand Down Expand Up @@ -2516,6 +2526,8 @@ var InstanceTypes = map[string]*InstanceType{
MemoryMb: 62464,
GPU: 1,
Architecture: "amd64",
GPUMemory: 12000000000, // Rough estimate of 12 GB
MPSContext: 16,
},
"p3.16xlarge": {
InstanceType: "p3.16xlarge",
Expand All @@ -2530,6 +2542,8 @@ var InstanceTypes = map[string]*InstanceType{
MemoryMb: 62464,
GPU: 1,
Architecture: "amd64",
GPUMemory: 16000000000, // Rough estimate of 16 GB
MPSContext: 32,
},
"p3.8xlarge": {
InstanceType: "p3.8xlarge",
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 @@ -46,6 +46,7 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/packet"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/rancher"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/scaleway"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/spotinst"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/tencentcloud"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider/vultr"
"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"
)

// CloudProvider contains configuration info and functions for interacting with
Expand Down
Loading

0 comments on commit d3cb401

Please sign in to comment.