Skip to content

Commit

Permalink
kubeadm: remove arch suffix from control plane images
Browse files Browse the repository at this point in the history
This change removes arch suffixes from control plane images (etcd,
kube-apiserver, kube-scheduler, kube-proxy, etc.). These are not needed, as
almost all control plane images have a fat manifest now.

We have arch suffixes only for kube-dns images now.

Signed-off-by: Rostislav M. Georgiev <[email protected]>
  • Loading branch information
rosti committed Aug 28, 2018
1 parent 029bb4e commit 14dbfdc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
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
8 changes: 4 additions & 4 deletions cmd/kubeadm/app/images/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,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 +110,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

0 comments on commit 14dbfdc

Please sign in to comment.