From 9ec14f4c41d75d0a923a1767cefd9463f81b30b1 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Thu, 13 Jan 2022 14:44:30 -0800 Subject: [PATCH] ignore adding kube images to kubeadm constants --- .../update_kubeadm_constants.go | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hack/update/kubeadm_constants/update_kubeadm_constants.go b/hack/update/kubeadm_constants/update_kubeadm_constants.go index ae182c5749..22b58fc50f 100644 --- a/hack/update/kubeadm_constants/update_kubeadm_constants.go +++ b/hack/update/kubeadm_constants/update_kubeadm_constants.go @@ -136,10 +136,13 @@ func formatKubeadmImageList(version, data string) (string, error) { lines := strings.Split(data, "\n") 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:], "/") + if len(imageTag) != 2 { + continue + } + // removing the repo from image name + imageName := strings.Split(imageTag[0], "/") + imageTag[0] = strings.Join(imageName[1:], "/") + if !isKubeImage(imageTag[0]) { templateData[majorMinorVersion][imageTag[0]] = imageTag[1] } } @@ -159,6 +162,16 @@ func formatKubeadmImageList(version, data string) (string, error) { return bytesBuffer.String(), nil } +func isKubeImage(name string) bool { + kubeImages := map[string]bool{ + "kube-apiserver": true, + "kube-controller-manager": true, + "kube-proxy": true, + "kube-scheduler": true, + } + return kubeImages[name] +} + func downloadFile(url, fileName string) error { file, err := os.Create(fileName) if err != nil {