From 7dd0eb0c94fac9dc4f4ad7f53c0f75d8092ed10d Mon Sep 17 00:00:00 2001 From: "srikrishnabh93@gmail.com" Date: Sun, 7 Nov 2021 00:25:33 +0530 Subject: [PATCH] fixed review comments --- .../update_kubeadm_constants.go | 3 + pkg/minikube/bootstrapper/images/images.go | 16 +- .../bootstrapper/images/kubeadm_test.go | 22 +-- .../constants/constants_kubeadm_images.go | 169 +++++++++--------- 4 files changed, 104 insertions(+), 106 deletions(-) diff --git a/hack/update/kubeadm_constants/update_kubeadm_constants.go b/hack/update/kubeadm_constants/update_kubeadm_constants.go index 8d126a28ac16..7399904d1991 100644 --- a/hack/update/kubeadm_constants/update_kubeadm_constants.go +++ b/hack/update/kubeadm_constants/update_kubeadm_constants.go @@ -138,6 +138,9 @@ func formatKubeadmImageList(version, data string) (string, error) { for _, line := range lines { imageTag := strings.Split(line, ":") if len(imageTag) == 2 { + // removing the repo from image name + imageName := strings.Split(imageTag[0], "/") + imageTag[0] = strings.Join(imageName[1:], "/") templateData[majorMinorVersion][imageTag[0]] = imageTag[1] } } diff --git a/pkg/minikube/bootstrapper/images/images.go b/pkg/minikube/bootstrapper/images/images.go index b9ae8535a847..50dedec0c54c 100644 --- a/pkg/minikube/bootstrapper/images/images.go +++ b/pkg/minikube/bootstrapper/images/images.go @@ -35,15 +35,13 @@ func Pause(v semver.Version, mirror string) string { // https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants.go // https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants_unix.go pv := "3.6" - majorMinorVersion := fmt.Sprintf("v%d.%d", v.Major, v.Minor) - imageName := path.Join(kubernetesRepo(mirror), "pause") - + imageName := "pause" if pVersion, ok := constants.KubeadmImages[majorMinorVersion][imageName]; ok { pv = pVersion } - return fmt.Sprintf("%s:%s", imageName, pv) + return fmt.Sprintf("%s:%s", path.Join(kubernetesRepo(mirror), imageName), pv) } // essentials returns images needed too bootstrap a Kubernetes @@ -79,12 +77,11 @@ func coreDNS(v semver.Version, mirror string) string { } majorMinorVersion := fmt.Sprintf("v%d.%d", v.Major, v.Minor) - imageName := path.Join(kubernetesRepo(mirror), in) - if cVersion, ok := constants.KubeadmImages[majorMinorVersion][imageName]; ok { + if cVersion, ok := constants.KubeadmImages[majorMinorVersion][in]; ok { cv = cVersion } - return fmt.Sprintf("%s:%s", imageName, cv) + return fmt.Sprintf("%s:%s", path.Join(kubernetesRepo(mirror), in), cv) } // etcd returns the image used for etcd @@ -94,13 +91,12 @@ func etcd(v semver.Version, mirror string) string { // https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants.go ev := "3.5.0-0" majorMinorVersion := fmt.Sprintf("v%d.%d", v.Major, v.Minor) - imageName := path.Join(kubernetesRepo(mirror), "etcd") - + imageName := "etcd" if eVersion, ok := constants.KubeadmImages[majorMinorVersion][imageName]; ok { ev = eVersion } - return fmt.Sprintf("%s:%s", imageName, ev) + return fmt.Sprintf("%s:%s", path.Join(kubernetesRepo(mirror), imageName), ev) } // auxiliary returns images that are helpful for running minikube diff --git a/pkg/minikube/bootstrapper/images/kubeadm_test.go b/pkg/minikube/bootstrapper/images/kubeadm_test.go index 92b072bc6928..56ddda36daa5 100644 --- a/pkg/minikube/bootstrapper/images/kubeadm_test.go +++ b/pkg/minikube/bootstrapper/images/kubeadm_test.go @@ -46,17 +46,17 @@ func TestKubeadmImages(t *testing.T) { "docker.io/kubernetesui/dashboard:v2.3.1", "docker.io/kubernetesui/metrics-scraper:v1.0.7", }}, - {"v1.16.1", "k8s.gcr.io", false, []string{ - "k8s.gcr.io/kube-proxy:v1.16.1", - "k8s.gcr.io/kube-scheduler:v1.16.1", - "k8s.gcr.io/kube-controller-manager:v1.16.1", - "k8s.gcr.io/kube-apiserver:v1.16.1", - "k8s.gcr.io/coredns:1.6.2", - "k8s.gcr.io/etcd:3.3.15-0", - "k8s.gcr.io/pause:3.1", - "k8s.gcr.io/k8s-minikube/storage-provisioner:" + version.GetStorageProvisionerVersion(), - "k8s.gcr.io/kubernetesui/dashboard:v2.3.1", - "k8s.gcr.io/kubernetesui/metrics-scraper:v1.0.7", + {"v1.16.1", "mirror.k8s.io", false, []string{ + "mirror.k8s.io/kube-proxy:v1.16.1", + "mirror.k8s.io/kube-scheduler:v1.16.1", + "mirror.k8s.io/kube-controller-manager:v1.16.1", + "mirror.k8s.io/kube-apiserver:v1.16.1", + "mirror.k8s.io/coredns:1.6.2", + "mirror.k8s.io/etcd:3.3.15-0", + "mirror.k8s.io/pause:3.1", + "mirror.k8s.io/k8s-minikube/storage-provisioner:" + version.GetStorageProvisionerVersion(), + "mirror.k8s.io/kubernetesui/dashboard:v2.3.1", + "mirror.k8s.io/kubernetesui/metrics-scraper:v1.0.7", }}, {"v1.15.0", "", false, []string{ "k8s.gcr.io/kube-proxy:v1.15.0", diff --git a/pkg/minikube/constants/constants_kubeadm_images.go b/pkg/minikube/constants/constants_kubeadm_images.go index 325dfae9fa32..ceabf19bad17 100644 --- a/pkg/minikube/constants/constants_kubeadm_images.go +++ b/pkg/minikube/constants/constants_kubeadm_images.go @@ -19,113 +19,112 @@ package constants var ( KubeadmImages = map[string]map[string]string{ "v1.22": { - "k8s.gcr.io/coredns/coredns": "v1.8.4", - "k8s.gcr.io/etcd": "3.5.0-0", - "k8s.gcr.io/kube-apiserver": "v1.22.2", - "k8s.gcr.io/kube-controller-manager": "v1.22.2", - "k8s.gcr.io/kube-proxy": "v1.22.2", - "k8s.gcr.io/kube-scheduler": "v1.22.2", - "k8s.gcr.io/pause": "3.5", + "coredns/coredns": "v1.8.4", + "etcd": "3.5.0-0", + "kube-apiserver": "v1.22.3", + "kube-controller-manager": "v1.22.3", + "kube-proxy": "v1.22.3", + "kube-scheduler": "v1.22.3", + "pause": "3.5", }, "v1.21": { - "k8s.gcr.io/coredns/coredns": "v1.8.0", - "k8s.gcr.io/etcd": "3.4.13-0", - "k8s.gcr.io/kube-apiserver": "v1.21.3", - "k8s.gcr.io/kube-controller-manager": "v1.21.3", - "k8s.gcr.io/kube-proxy": "v1.21.3", - "k8s.gcr.io/kube-scheduler": "v1.21.3", - "k8s.gcr.io/pause": "3.4.1", + "coredns/coredns": "v1.8.0", + "etcd": "3.4.13-0", + "kube-apiserver": "v1.21.6", + "kube-controller-manager": "v1.21.6", + "kube-proxy": "v1.21.6", + "kube-scheduler": "v1.21.6", + "pause": "3.4.1", }, "v1.20": { - "k8s.gcr.io/coredns": "1.7.0", - "k8s.gcr.io/etcd": "3.4.13-0", - "k8s.gcr.io/kube-apiserver": "v1.20.9", - "k8s.gcr.io/kube-controller-manager": "v1.20.9", - "k8s.gcr.io/kube-proxy": "v1.20.9", - "k8s.gcr.io/kube-scheduler": "v1.20.9", - "k8s.gcr.io/pause": "3.2", + "coredns": "1.7.0", + "etcd": "3.4.13-0", + "kube-apiserver": "v1.20.12", + "kube-controller-manager": "v1.20.12", + "kube-proxy": "v1.20.12", + "kube-scheduler": "v1.20.12", + "pause": "3.2", }, "v1.19": { - "k8s.gcr.io/coredns": "1.7.0", - "k8s.gcr.io/etcd": "3.4.9-1", - "k8s.gcr.io/kube-apiserver": "v1.19.13", - "k8s.gcr.io/kube-controller-manager": "v1.19.13", - "k8s.gcr.io/kube-proxy": "v1.19.13", - "k8s.gcr.io/kube-scheduler": "v1.19.13", - "k8s.gcr.io/pause": "3.2", + "coredns": "1.7.0", + "etcd": "3.4.9-1", + "kube-apiserver": "v1.19.16", + "kube-controller-manager": "v1.19.16", + "kube-proxy": "v1.19.16", + "kube-scheduler": "v1.19.16", + "pause": "3.2", }, "v1.18": { - "k8s.gcr.io/coredns": "1.6.7", - "k8s.gcr.io/etcd": "3.4.3-0", - "k8s.gcr.io/kube-apiserver": "v1.18.20", - "k8s.gcr.io/kube-controller-manager": "v1.18.20", - "k8s.gcr.io/kube-proxy": "v1.18.20", - "k8s.gcr.io/kube-scheduler": "v1.18.20", - "k8s.gcr.io/pause": "3.2", + "coredns": "1.6.7", + "etcd": "3.4.3-0", + "kube-apiserver": "v1.18.20", + "kube-controller-manager": "v1.18.20", + "kube-proxy": "v1.18.20", + "kube-scheduler": "v1.18.20", + "pause": "3.2", }, "v1.17": { - "k8s.gcr.io/coredns": "1.6.5", - "k8s.gcr.io/etcd": "3.4.3-0", - "k8s.gcr.io/kube-apiserver": "v1.17.17", - "k8s.gcr.io/kube-controller-manager": "v1.17.17", - "k8s.gcr.io/kube-proxy": "v1.17.17", - "k8s.gcr.io/kube-scheduler": "v1.17.17", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.6.5", + "etcd": "3.4.3-0", + "kube-apiserver": "v1.17.17", + "kube-controller-manager": "v1.17.17", + "kube-proxy": "v1.17.17", + "kube-scheduler": "v1.17.17", + "pause": "3.1", }, "v1.16": { - "k8s.gcr.io/coredns": "1.6.2", - "k8s.gcr.io/etcd": "3.3.15-0", - "k8s.gcr.io/kube-apiserver": "v1.16.15", - "k8s.gcr.io/kube-controller-manager": "v1.16.15", - "k8s.gcr.io/kube-proxy": "v1.16.15", - "k8s.gcr.io/kube-scheduler": "v1.16.15", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.6.2", + "etcd": "3.3.15-0", + "kube-apiserver": "v1.16.15", + "kube-controller-manager": "v1.16.15", + "kube-proxy": "v1.16.15", + "kube-scheduler": "v1.16.15", + "pause": "3.1", }, "v1.15": { - "k8s.gcr.io/coredns": "1.3.1", - "k8s.gcr.io/etcd": "3.3.10", - "k8s.gcr.io/kube-apiserver": "v1.15.12", - "k8s.gcr.io/kube-controller-manager": "v1.15.12", - "k8s.gcr.io/kube-proxy": "v1.15.12", - "k8s.gcr.io/kube-scheduler": "v1.15.12", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.3.1", + "etcd": "3.3.10", + "kube-apiserver": "v1.15.12", + "kube-controller-manager": "v1.15.12", + "kube-proxy": "v1.15.12", + "kube-scheduler": "v1.15.12", + "pause": "3.1", }, - "v1.14": { - "k8s.gcr.io/coredns": "1.3.1", - "k8s.gcr.io/etcd": "3.3.10", - "k8s.gcr.io/kube-apiserver": "v1.14.10", - "k8s.gcr.io/kube-controller-manager": "v1.14.10", - "k8s.gcr.io/kube-proxy": "v1.14.10", - "k8s.gcr.io/kube-scheduler": "v1.14.10", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.3.1", + "etcd": "3.3.10", + "kube-apiserver": "v1.14.10", + "kube-controller-manager": "v1.14.10", + "kube-proxy": "v1.14.10", + "kube-scheduler": "v1.14.10", + "pause": "3.1", }, "v1.13": { - "k8s.gcr.io/coredns": "1.2.6", - "k8s.gcr.io/etcd": "3.2.24", - "k8s.gcr.io/kube-apiserver": "v1.13.12", - "k8s.gcr.io/kube-controller-manager": "v1.13.12", - "k8s.gcr.io/kube-proxy": "v1.13.12", - "k8s.gcr.io/kube-scheduler": "v1.13.12", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.2.6", + "etcd": "3.2.24", + "kube-apiserver": "v1.13.12", + "kube-controller-manager": "v1.13.12", + "kube-proxy": "v1.13.12", + "kube-scheduler": "v1.13.12", + "pause": "3.1", }, "v1.12": { - "k8s.gcr.io/coredns": "1.2.2", - "k8s.gcr.io/etcd": "3.2.24", - "k8s.gcr.io/kube-apiserver": "v1.22.1", - "k8s.gcr.io/kube-controller-manager": "v1.22.1", - "k8s.gcr.io/kube-proxy": "v1.22.1", - "k8s.gcr.io/kube-scheduler": "v1.22.1", - "k8s.gcr.io/pause": "3.1", + "coredns": "1.2.2", + "etcd": "3.2.24", + "kube-apiserver": "v1.22.3", + "kube-controller-manager": "v1.22.3", + "kube-proxy": "v1.22.3", + "kube-scheduler": "v1.22.3", + "pause": "3.1", }, "v1.11": { - "k8s.gcr.io/coredns": "1.1.3", - "k8s.gcr.io/etcd-amd64": "3.2.18", - "k8s.gcr.io/kube-apiserver-amd64": "v1.11.10", - "k8s.gcr.io/kube-controller-manager-amd64": "v1.11.10", - "k8s.gcr.io/kube-proxy-amd64": "v1.11.10", - "k8s.gcr.io/kube-scheduler-amd64": "v1.11.10", - "k8s.gcr.io/pause-amd64": "3.1", + "coredns": "1.1.3", + "etcd-amd64": "3.2.18", + "kube-apiserver-amd64": "v1.11.10", + "kube-controller-manager-amd64": "v1.11.10", + "kube-proxy-amd64": "v1.11.10", + "kube-scheduler-amd64": "v1.11.10", + "pause-amd64": "3.1", }, } )