Move AWS CCM image logic into pkg/model and add 1.21 and 1.22 images

This commit is contained in:
Peter Rifel 2021-09-08 20:56:39 -05:00
parent 37d8c5a996
commit 6a53285ffe
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
3 changed files with 20 additions and 24 deletions

View File

@ -73,5 +73,24 @@ func (b *AWSCloudControllerManagerOptionsBuilder) BuildOptions(o interface{}) er
return fmt.Errorf("no networking mode set")
}
if eccm.Image == "" {
var tag string
switch b.KubernetesVersion.Minor {
case 18:
tag = "v1.18.0-alpha.1"
case 19:
tag = "v1.19.0-alpha.1"
case 20:
tag = "v1.20.0-alpha.0"
case 21:
tag = "v1.21.0-alpha.0"
default:
// There is no latest tag, so default to the latest that exists
// See https://console.cloud.google.com/gcr/images/k8s-artifacts-prod/us/provider-aws/cloud-controller-manager
tag = "v1.22.0-alpha.0"
}
eccm.Image = fmt.Sprintf("k8s.gcr.io/provider-aws/cloud-controller-manager:%v", tag)
}
return nil
}

View File

@ -28,7 +28,7 @@ spec:
serviceAccountName: aws-cloud-controller-manager
containers:
- name: aws-cloud-controller-manager
image: {{ if .ExternalCloudControllerManager.Image }}{{ .ExternalCloudControllerManager.Image }}{{ else }}gcr.io/k8s-staging-provider-aws/cloud-controller-manager:{{AWSCCMTag}}{{ end }}
image: {{ .ExternalCloudControllerManager.Image }}
imagePullPolicy: IfNotPresent
args:
{{- range $arg := CloudControllerConfigArgv }}

View File

@ -128,7 +128,6 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
// will return openstack external ccm image location for current kubernetes version
dest["OpenStackCCMTag"] = tf.OpenStackCCMTag
dest["AWSCCMTag"] = tf.AWSCCMTag
dest["ProxyEnv"] = tf.ProxyEnv
dest["KopsSystemEnv"] = tf.KopsSystemEnv
@ -659,28 +658,6 @@ func (tf *TemplateFunctions) OpenStackCCMTag() string {
return tag
}
// AWSCCMTag returns the correct tag for the cloud controller manager based on
// the Kubernetes Version
func (tf *TemplateFunctions) AWSCCMTag() (string, error) {
var tag string
parsed, err := util.ParseKubernetesVersion(tf.Cluster.Spec.KubernetesVersion)
if err != nil {
return "", fmt.Errorf("failed to parse Kubernetes version from cluster spec: %q", err)
}
// Update when we have stable releases
switch parsed.Minor {
case 18:
tag = "v1.18.0-alpha.1"
case 19:
tag = "v1.19.0-alpha.1"
default:
tag = "latest"
}
return tag, nil
}
// GetNodeInstanceGroups returns a map containing the defined instance groups of role "Node".
func (tf *TemplateFunctions) GetNodeInstanceGroups() map[string]kops.InstanceGroupSpec {
nodegroups := make(map[string]kops.InstanceGroupSpec)