Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubeadm: Drop arch suffixes #66960

Merged
merged 2 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/kubeadm/app/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
21 changes: 17 additions & 4 deletions cmd/kubeadm/app/images/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -59,23 +72,23 @@ 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,
},
},
{
image: constants.KubeControllerManager,
expected: GetGenericArchImage(gcrPrefix, "kube-controller-manager", expected),
expected: GetGenericImage(gcrPrefix, "kube-controller-manager", expected),
cfg: &kubeadmapi.ClusterConfiguration{
ImageRepository: gcrPrefix,
KubernetesVersion: testversion,
},
},
{
image: constants.KubeScheduler,
expected: GetGenericArchImage(gcrPrefix, "kube-scheduler", expected),
expected: GetGenericImage(gcrPrefix, "kube-scheduler", expected),
cfg: &kubeadmapi.ClusterConfiguration{
ImageRepository: gcrPrefix,
KubernetesVersion: testversion,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions cmd/kubeadm/app/phases/addons/proxy/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,5 @@ spec:
- key: CriticalAddonsOnly
operator: Exists
- operator: Exists
nodeSelector:
beta.kubernetes.io/arch: {{ .Arch }}
`
)
4 changes: 1 addition & 3 deletions cmd/kubeadm/app/phases/addons/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package proxy
import (
"bytes"
"fmt"
"runtime"

apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down