mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Merge pull request #101537 from neolit123/1.22-remove-hyperkube
kubeadm: remove deprecated hyperkube image support in v1beta3
This commit is contained in:
commit
347730b6b4
@ -116,11 +116,6 @@ type ClusterConfiguration struct {
|
||||
// +k8s:conversion-gen=false
|
||||
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.
|
||||
FeatureGates map[string]bool
|
||||
|
||||
|
@ -32,3 +32,9 @@ func Convert_v1beta2_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConf
|
||||
}
|
||||
return Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(&ClusterConfiguration{}, &out.ClusterConfiguration, s)
|
||||
}
|
||||
|
||||
// Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration is required since UseHyperKubeImage
|
||||
// does not exist in the internal type.
|
||||
func Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in, out, s)
|
||||
}
|
||||
|
@ -87,11 +87,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*ClusterConfiguration)(nil), (*kubeadm.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(a.(*ClusterConfiguration), b.(*kubeadm.ClusterConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*kubeadm.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_kubeadm_ClusterConfiguration_To_v1beta2_ClusterConfiguration(a.(*kubeadm.ClusterConfiguration), b.(*ClusterConfiguration), scope)
|
||||
}); err != nil {
|
||||
@ -242,6 +237,11 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*ClusterConfiguration)(nil), (*kubeadm.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(a.(*ClusterConfiguration), b.(*kubeadm.ClusterConfiguration), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*InitConfiguration)(nil), (*kubeadm.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_InitConfiguration_To_kubeadm_InitConfiguration(a.(*InitConfiguration), b.(*kubeadm.InitConfiguration), scope)
|
||||
}); err != nil {
|
||||
@ -401,17 +401,12 @@ func autoConvert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in
|
||||
}
|
||||
out.CertificatesDir = in.CertificatesDir
|
||||
out.ImageRepository = in.ImageRepository
|
||||
out.UseHyperKubeImage = in.UseHyperKubeImage
|
||||
// WARNING: in.UseHyperKubeImage requires manual conversion: does not exist in peer-type
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration is an autogenerated conversion function.
|
||||
func Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *ClusterConfiguration, out *kubeadm.ClusterConfiguration, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_kubeadm_ClusterConfiguration_To_v1beta2_ClusterConfiguration(in *kubeadm.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error {
|
||||
// INFO: in.ComponentConfigs opted out of conversion generation
|
||||
if err := Convert_kubeadm_Etcd_To_v1beta2_Etcd(&in.Etcd, &out.Etcd, s); err != nil {
|
||||
@ -437,7 +432,6 @@ func autoConvert_kubeadm_ClusterConfiguration_To_v1beta2_ClusterConfiguration(in
|
||||
out.CertificatesDir = in.CertificatesDir
|
||||
out.ImageRepository = in.ImageRepository
|
||||
// INFO: in.CIImageRepository opted out of conversion generation
|
||||
out.UseHyperKubeImage = in.UseHyperKubeImage
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
|
@ -23,7 +23,8 @@ limitations under the License.
|
||||
// This version improves on the v1beta2 format by fixing some minor issues and adding a few new fields.
|
||||
//
|
||||
// A list of changes since v1beta2:
|
||||
// - TODO
|
||||
// - The deprecated "ClusterConfiguration.useHyperKubeImage" field has been removed.
|
||||
// Kubeadm no longer supports the hyperkube image.
|
||||
//
|
||||
// Migration from old kubeadm config versions
|
||||
//
|
||||
@ -233,7 +234,6 @@ limitations under the License.
|
||||
// pathType: File
|
||||
// certificatesDir: "/etc/kubernetes/pki"
|
||||
// imageRepository: "k8s.gcr.io"
|
||||
// useHyperKubeImage: false
|
||||
// clusterName: "example-cluster"
|
||||
// ---
|
||||
// apiVersion: kubelet.config.k8s.io/v1beta1
|
||||
|
@ -101,11 +101,6 @@ type ClusterConfiguration struct {
|
||||
// will be used for all the other images.
|
||||
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.
|
||||
FeatureGates map[string]bool `json:"featureGates,omitempty"`
|
||||
|
||||
|
@ -401,7 +401,6 @@ func autoConvert_v1beta3_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in
|
||||
}
|
||||
out.CertificatesDir = in.CertificatesDir
|
||||
out.ImageRepository = in.ImageRepository
|
||||
out.UseHyperKubeImage = in.UseHyperKubeImage
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
@ -437,7 +436,6 @@ func autoConvert_kubeadm_ClusterConfiguration_To_v1beta3_ClusterConfiguration(in
|
||||
out.CertificatesDir = in.CertificatesDir
|
||||
out.ImageRepository = in.ImageRepository
|
||||
// INFO: in.CIImageRepository opted out of conversion generation
|
||||
out.UseHyperKubeImage = in.UseHyperKubeImage
|
||||
out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates))
|
||||
out.ClusterName = in.ClusterName
|
||||
return nil
|
||||
|
@ -302,8 +302,6 @@ const (
|
||||
KubeScheduler = "kube-scheduler"
|
||||
// KubeProxy defines variable used internally when referring to kube-proxy component
|
||||
KubeProxy = "kube-proxy"
|
||||
// HyperKube defines variable used internally when referring to the hyperkube image
|
||||
HyperKube = "hyperkube"
|
||||
// CoreDNS defines variable used internally when referring to the CoreDNS component
|
||||
CoreDNS = "CoreDNS"
|
||||
// Kubelet defines variable used internally when referring to the Kubelet
|
||||
|
@ -25,20 +25,14 @@ 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)
|
||||
}
|
||||
|
||||
// GetKubernetesImage generates and returns the image for the components managed in the Kubernetes main repository,
|
||||
// including the control-plane components and kube-proxy. If specified, the HyperKube image will be used.
|
||||
// including the control-plane components and kube-proxy.
|
||||
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.`+extraHyperKubeNote, image)
|
||||
image = constants.HyperKube
|
||||
}
|
||||
repoPrefix := cfg.GetControlPlaneImageRepository()
|
||||
kubernetesImageTag := kubeadmutil.KubernetesVersionToImageTag(cfg.KubernetesVersion)
|
||||
return GetGenericImage(repoPrefix, image, kubernetesImageTag)
|
||||
@ -91,15 +85,10 @@ func GetControlPlaneImages(cfg *kubeadmapi.ClusterConfiguration) []string {
|
||||
imgs := []string{}
|
||||
|
||||
// start with core kubernetes images
|
||||
if cfg.UseHyperKubeImage {
|
||||
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))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeControllerManager, cfg))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeScheduler, cfg))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeProxy, cfg))
|
||||
}
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeAPIServer, cfg))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeControllerManager, cfg))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeScheduler, cfg))
|
||||
imgs = append(imgs, GetKubernetesImage(constants.KubeProxy, cfg))
|
||||
|
||||
// pause is not available on the ci image repository so use the default image repository.
|
||||
imgs = append(imgs, GetPauseImage(cfg))
|
||||
|
@ -50,14 +50,6 @@ func TestGetKubernetesImage(t *testing.T) {
|
||||
expected string
|
||||
cfg *kubeadmapi.ClusterConfiguration
|
||||
}{
|
||||
{
|
||||
expected: GetGenericImage(gcrPrefix, constants.HyperKube, expected),
|
||||
cfg: &kubeadmapi.ClusterConfiguration{
|
||||
ImageRepository: gcrPrefix,
|
||||
KubernetesVersion: testversion,
|
||||
UseHyperKubeImage: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
image: constants.KubeAPIServer,
|
||||
expected: GetGenericImage(gcrPrefix, "kube-apiserver", expected),
|
||||
|
@ -86,7 +86,6 @@ networking:
|
||||
dnsDomain: cluster.local
|
||||
podSubnet: ""
|
||||
serviceSubnet: 10.96.0.0/12
|
||||
useHyperKubeImage: false
|
||||
`, kubeadmapiv1.SchemeGroupVersion.String())
|
||||
|
||||
// fakeWaiter is a fake apiclient.Waiter that returns errors it was initialized with
|
||||
|
Loading…
Reference in New Issue
Block a user