From ec4840f0b2944bf54ef0998947f7623a87722cf9 Mon Sep 17 00:00:00 2001 From: "Rostislav M. Georgiev" Date: Tue, 12 Nov 2019 15:52:08 +0200 Subject: [PATCH] kubeadm: Amend the hyperkube deprecation change The PR introducing 5bb8069 got merged accidentally (the CI robot not respecting a hold). Hence, the feedback to that PR is merged separately. Signed-off-by: Rostislav M. Georgiev --- cmd/kubeadm/app/apis/kubeadm/types.go | 2 ++ cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go | 4 +++- cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go | 4 +++- cmd/kubeadm/app/images/images.go | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go index d48290b650b..347f785d25e 100644 --- a/cmd/kubeadm/app/apis/kubeadm/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/types.go @@ -114,6 +114,8 @@ type ClusterConfiguration struct { CIImageRepository string // UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images + // DEPRECATED: As hyperkube is itself deprecated, this fields is too. It will be removed in future kubeadm config versions, kubeadm + // will print multiple warnings when set to true, and at some point it may become ignored. UseHyperKubeImage bool // FeatureGates enabled by the user. diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go b/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go index c33941fea07..ce3dceb8a2f 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go @@ -17,7 +17,7 @@ limitations under the License. package v1beta1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -106,6 +106,8 @@ type ClusterConfiguration struct { ImageRepository string `json:"imageRepository"` // UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images + // DEPRECATED: As hyperkube is itself deprecated, this fields is too. It will be removed in future kubeadm config versions, kubeadm + // will print multiple warnings when set to true, and at some point it may become ignored. UseHyperKubeImage bool `json:"useHyperKubeImage,omitempty"` // FeatureGates enabled by the user. diff --git a/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go b/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go index 3813f18d532..d13af5bd15d 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go @@ -17,7 +17,7 @@ limitations under the License. package v1beta2 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -102,6 +102,8 @@ type ClusterConfiguration struct { ImageRepository string `json:"imageRepository,omitempty"` // UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images + // DEPRECATED: As hyperkube is itself deprecated, this fields is too. It will be removed in future kubeadm config versions, kubeadm + // will print multiple warnings when set to true, and at some point it may become ignored. UseHyperKubeImage bool `json:"useHyperKubeImage,omitempty"` // FeatureGates enabled by the user. diff --git a/cmd/kubeadm/app/images/images.go b/cmd/kubeadm/app/images/images.go index 4ecbc445b35..61cca5f34ad 100644 --- a/cmd/kubeadm/app/images/images.go +++ b/cmd/kubeadm/app/images/images.go @@ -25,6 +25,8 @@ import ( kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" ) +const extraHyperKubeNote = ` The "useHyperKubeImage" field will be removed from future kubeadm config versions and possibly ignored in future releases.` + // GetGenericImage generates and returns a platform agnostic image (backed by manifest list) func GetGenericImage(prefix, image, tag string) string { return fmt.Sprintf("%s/%s:%s", prefix, image, tag) @@ -34,7 +36,7 @@ func GetGenericImage(prefix, image, tag string) string { // including the control-plane components and kube-proxy. If specified, the HyperKube image will be used. func GetKubernetesImage(image string, cfg *kubeadmapi.ClusterConfiguration) string { if cfg.UseHyperKubeImage && image != constants.HyperKube { - klog.Warningf(`WARNING: DEPRECATED use of the "hyperkube" image in place of %q`, image) + klog.Warningf(`WARNING: DEPRECATED use of the "hyperkube" image in place of %q.`+extraHyperKubeNote, image) image = constants.HyperKube } repoPrefix := cfg.GetControlPlaneImageRepository() @@ -93,7 +95,7 @@ func GetControlPlaneImages(cfg *kubeadmapi.ClusterConfiguration) []string { // start with core kubernetes images if cfg.UseHyperKubeImage { - klog.Warningln(`WARNING: DEPRECATED use of the "hyperkube" image for the Kubernetes control plane`) + klog.Warningln(`WARNING: DEPRECATED use of the "hyperkube" image for the Kubernetes control plane.` + extraHyperKubeNote) imgs = append(imgs, GetKubernetesImage(constants.HyperKube, cfg)) } else { imgs = append(imgs, GetKubernetesImage(constants.KubeAPIServer, cfg))