diff --git a/cmd/kubeadm/app/images/images.go b/cmd/kubeadm/app/images/images.go index 2530b8103d1..053a7407f10 100644 --- a/cmd/kubeadm/app/images/images.go +++ b/cmd/kubeadm/app/images/images.go @@ -43,7 +43,7 @@ func GetKubeControlPlaneImage(image string, cfg *kubeadmapi.ClusterConfiguration } repoPrefix := cfg.GetControlPlaneImageRepository() kubernetesImageTag := kubeadmutil.KubernetesVersionToImageTag(cfg.KubernetesVersion) - return GetGenericArchImage(repoPrefix, image, kubernetesImageTag) + return GetGenericImage(repoPrefix, image, kubernetesImageTag) } // GetEtcdImage generates and returns the image for etcd or returns cfg.Etcd.Local.Image if specified @@ -56,7 +56,7 @@ func GetEtcdImage(cfg *kubeadmapi.ClusterConfiguration) string { if err == nil { etcdImageTag = etcdImageVersion.String() } - return GetGenericArchImage(cfg.ImageRepository, constants.Etcd, etcdImageTag) + return GetGenericImage(cfg.ImageRepository, constants.Etcd, etcdImageTag) } // GetAllImages returns a list of container images kubeadm expects to use on a control plane node diff --git a/cmd/kubeadm/app/images/images_test.go b/cmd/kubeadm/app/images/images_test.go index 4792ff4b471..2a2eb195f14 100644 --- a/cmd/kubeadm/app/images/images_test.go +++ b/cmd/kubeadm/app/images/images_test.go @@ -32,6 +32,19 @@ const ( gcrPrefix = "k8s.gcr.io" ) +func TestGetGenericImage(t *testing.T) { + const ( + prefix = "foo" + image = "bar" + tag = "baz" + ) + expected := fmt.Sprintf("%s/%s:%s", prefix, image, tag) + actual := GetGenericImage(prefix, image, tag) + if actual != expected { + t.Errorf("failed GetGenericImage:\n\texpected: %s\n\t actual: %s", expected, actual) + } +} + func TestGetGenericArchImage(t *testing.T) { const ( prefix = "foo" @@ -59,7 +72,7 @@ func TestGetKubeControlPlaneImage(t *testing.T) { }, { image: constants.KubeAPIServer, - expected: GetGenericArchImage(gcrPrefix, "kube-apiserver", expected), + expected: GetGenericImage(gcrPrefix, "kube-apiserver", expected), cfg: &kubeadmapi.ClusterConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, @@ -67,7 +80,7 @@ func TestGetKubeControlPlaneImage(t *testing.T) { }, { image: constants.KubeControllerManager, - expected: GetGenericArchImage(gcrPrefix, "kube-controller-manager", expected), + expected: GetGenericImage(gcrPrefix, "kube-controller-manager", expected), cfg: &kubeadmapi.ClusterConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, @@ -75,7 +88,7 @@ func TestGetKubeControlPlaneImage(t *testing.T) { }, { image: constants.KubeScheduler, - expected: GetGenericArchImage(gcrPrefix, "kube-scheduler", expected), + expected: GetGenericImage(gcrPrefix, "kube-scheduler", expected), cfg: &kubeadmapi.ClusterConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, @@ -110,7 +123,7 @@ func TestGetEtcdImage(t *testing.T) { }, }, { - expected: GetGenericArchImage(gcrPrefix, "etcd", constants.DefaultEtcdVersion), + expected: GetGenericImage(gcrPrefix, "etcd", constants.DefaultEtcdVersion), cfg: &kubeadmapi.ClusterConfiguration{ ImageRepository: gcrPrefix, KubernetesVersion: testversion, diff --git a/cmd/kubeadm/app/phases/addons/proxy/manifests.go b/cmd/kubeadm/app/phases/addons/proxy/manifests.go index 50986755d3a..a425bb679c6 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/manifests.go +++ b/cmd/kubeadm/app/phases/addons/proxy/manifests.go @@ -108,7 +108,5 @@ spec: - key: CriticalAddonsOnly operator: Exists - operator: Exists - nodeSelector: - beta.kubernetes.io/arch: {{ .Arch }} ` ) diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy.go b/cmd/kubeadm/app/phases/addons/proxy/proxy.go index 22a7479dd2e..aea3729a773 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy.go @@ -19,7 +19,6 @@ package proxy import ( "bytes" "fmt" - "runtime" apps "k8s.io/api/apps/v1" "k8s.io/api/core/v1" @@ -75,9 +74,8 @@ func EnsureProxyAddon(cfg *kubeadmapi.InitConfiguration, client clientset.Interf if err != nil { return fmt.Errorf("error when parsing kube-proxy configmap template: %v", err) } - proxyDaemonSetBytes, err = kubeadmutil.ParseTemplate(KubeProxyDaemonSet19, struct{ Image, Arch string }{ + proxyDaemonSetBytes, err = kubeadmutil.ParseTemplate(KubeProxyDaemonSet19, struct{ Image string }{ Image: images.GetKubeControlPlaneImage(constants.KubeProxy, &cfg.ClusterConfiguration), - Arch: runtime.GOARCH, }) if err != nil { return fmt.Errorf("error when parsing kube-proxy daemonset template: %v", err) diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go index 4e06ba70d6b..517c5be7f7a 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go @@ -108,9 +108,8 @@ func TestCompileManifests(t *testing.T) { }, { manifest: KubeProxyDaemonSet19, - data: struct{ Image, Arch string }{ + data: struct{ Image string }{ Image: "foo", - Arch: "foo", }, expected: true, },