diff --git a/pkg/model/components/awscloudcontrollermanager.go b/pkg/model/components/awscloudcontrollermanager.go index b7a30f8c26..623758f545 100644 --- a/pkg/model/components/awscloudcontrollermanager.go +++ b/pkg/model/components/awscloudcontrollermanager.go @@ -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 } diff --git a/upup/models/cloudup/resources/addons/aws-cloud-controller.addons.k8s.io/k8s-1.18.yaml.template b/upup/models/cloudup/resources/addons/aws-cloud-controller.addons.k8s.io/k8s-1.18.yaml.template index 716544f3a2..63a408111d 100644 --- a/upup/models/cloudup/resources/addons/aws-cloud-controller.addons.k8s.io/k8s-1.18.yaml.template +++ b/upup/models/cloudup/resources/addons/aws-cloud-controller.addons.k8s.io/k8s-1.18.yaml.template @@ -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 }} diff --git a/upup/pkg/fi/cloudup/template_functions.go b/upup/pkg/fi/cloudup/template_functions.go index 9b370f7719..ca056d88f8 100644 --- a/upup/pkg/fi/cloudup/template_functions.go +++ b/upup/pkg/fi/cloudup/template_functions.go @@ -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)