Merge pull request #85137 from rosti/kubeadm-amend-hyperkube-deprecation

kubeadm: Amend the hyperkube deprecation change
This commit is contained in:
Kubernetes Prow Robot 2019-11-13 09:28:09 -08:00 committed by GitHub
commit 66e0ca800d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -114,6 +114,8 @@ type ClusterConfiguration struct {
CIImageRepository string CIImageRepository string
// UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images // 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 UseHyperKubeImage bool
// FeatureGates enabled by the user. // FeatureGates enabled by the user.

View File

@ -17,7 +17,7 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -106,6 +106,8 @@ type ClusterConfiguration struct {
ImageRepository string `json:"imageRepository"` ImageRepository string `json:"imageRepository"`
// UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images // 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"` UseHyperKubeImage bool `json:"useHyperKubeImage,omitempty"`
// FeatureGates enabled by the user. // FeatureGates enabled by the user.

View File

@ -17,7 +17,7 @@ limitations under the License.
package v1beta2 package v1beta2
import ( import (
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )
@ -102,6 +102,8 @@ type ClusterConfiguration struct {
ImageRepository string `json:"imageRepository,omitempty"` ImageRepository string `json:"imageRepository,omitempty"`
// UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images // 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"` UseHyperKubeImage bool `json:"useHyperKubeImage,omitempty"`
// FeatureGates enabled by the user. // FeatureGates enabled by the user.

View File

@ -25,6 +25,8 @@ import (
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" 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) // GetGenericImage generates and returns a platform agnostic image (backed by manifest list)
func GetGenericImage(prefix, image, tag string) string { func GetGenericImage(prefix, image, tag string) string {
return fmt.Sprintf("%s/%s:%s", prefix, image, tag) 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. // including the control-plane components and kube-proxy. If specified, the HyperKube image will be used.
func GetKubernetesImage(image string, cfg *kubeadmapi.ClusterConfiguration) string { func GetKubernetesImage(image string, cfg *kubeadmapi.ClusterConfiguration) string {
if cfg.UseHyperKubeImage && image != constants.HyperKube { 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 image = constants.HyperKube
} }
repoPrefix := cfg.GetControlPlaneImageRepository() repoPrefix := cfg.GetControlPlaneImageRepository()
@ -93,7 +95,7 @@ func GetControlPlaneImages(cfg *kubeadmapi.ClusterConfiguration) []string {
// start with core kubernetes images // start with core kubernetes images
if cfg.UseHyperKubeImage { 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)) imgs = append(imgs, GetKubernetesImage(constants.HyperKube, cfg))
} else { } else {
imgs = append(imgs, GetKubernetesImage(constants.KubeAPIServer, cfg)) imgs = append(imgs, GetKubernetesImage(constants.KubeAPIServer, cfg))