From b90e3858a8d319c7526dd8190ee05edce24ba072 Mon Sep 17 00:00:00 2001 From: Jim Gauld Date: Thu, 9 Sep 2021 13:16:26 -0400 Subject: [PATCH 7/7] Revert "use subpath for coredns only for default repository" This reverts commit 38a41e1557649a7cc763bf737779db9aa03ec75e. --- cmd/kubeadm/app/constants/constants.go | 2 +- cmd/kubeadm/app/images/images.go | 5 --- cmd/kubeadm/app/images/images_test.go | 50 -------------------------- 3 files changed, 1 insertion(+), 56 deletions(-) diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index b3559734..95338949 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -322,7 +322,7 @@ const ( CoreDNSDeploymentName = "coredns" // CoreDNSImageName specifies the name of the image for CoreDNS add-on - CoreDNSImageName = "coredns" + CoreDNSImageName = "coredns/coredns" // CoreDNSVersion is the version of CoreDNS to be deployed if it is used CoreDNSVersion = "v1.8.4" diff --git a/cmd/kubeadm/app/images/images.go b/cmd/kubeadm/app/images/images.go index 7e97dbc9..187c7189 100644 --- a/cmd/kubeadm/app/images/images.go +++ b/cmd/kubeadm/app/images/images.go @@ -20,7 +20,6 @@ import ( "fmt" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" - kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2" "k8s.io/kubernetes/cmd/kubeadm/app/constants" kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" @@ -48,10 +47,6 @@ func GetDNSImage(cfg *kubeadmapi.ClusterConfiguration) string { if cfg.DNS.ImageRepository != "" { dnsImageRepository = cfg.DNS.ImageRepository } - // Handle the renaming of the official image from "k8s.gcr.io/coredns" to "k8s.gcr.io/coredns/coredns - if dnsImageRepository == kubeadmapiv1beta2.DefaultImageRepository { - dnsImageRepository = fmt.Sprintf("%s/coredns", dnsImageRepository) - } // DNS uses an imageTag that corresponds to the DNS version matching the Kubernetes version dnsImageTag := constants.CoreDNSVersion diff --git a/cmd/kubeadm/app/images/images_test.go b/cmd/kubeadm/app/images/images_test.go index 2fd9d3f5..9f363939 100644 --- a/cmd/kubeadm/app/images/images_test.go +++ b/cmd/kubeadm/app/images/images_test.go @@ -22,7 +22,6 @@ import ( "testing" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" - kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2" "k8s.io/kubernetes/cmd/kubeadm/app/constants" ) @@ -226,52 +225,3 @@ func TestGetAllImages(t *testing.T) { }) } } - -func TestGetDNSImage(t *testing.T) { - var tests = []struct { - expected string - cfg *kubeadmapi.ClusterConfiguration - }{ - { - expected: "foo.io/coredns:v1.8.4", - cfg: &kubeadmapi.ClusterConfiguration{ - ImageRepository: "foo.io", - DNS: kubeadmapi.DNS{ - Type: kubeadmapi.CoreDNS, - }, - }, - }, - { - expected: kubeadmapiv1beta2.DefaultImageRepository + "/coredns/coredns:v1.8.4", - cfg: &kubeadmapi.ClusterConfiguration{ - ImageRepository: kubeadmapiv1beta2.DefaultImageRepository, - DNS: kubeadmapi.DNS{ - Type: kubeadmapi.CoreDNS, - }, - }, - }, - { - expected: "foo.io/coredns/coredns:v1.8.4", - cfg: &kubeadmapi.ClusterConfiguration{ - ImageRepository: "foo.io", - DNS: kubeadmapi.DNS{ - Type: kubeadmapi.CoreDNS, - ImageMeta: kubeadmapi.ImageMeta{ - ImageRepository: "foo.io/coredns", - }, - }, - }, - }, - } - - for _, test := range tests { - actual := GetDNSImage(test.cfg) - if actual != test.expected { - t.Errorf( - "failed to GetDNSImage:\n\texpected: %s\n\t actual: %s", - test.expected, - actual, - ) - } - } -} -- 2.17.1