diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go index 115f6dfb4174..abac455f51df 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -80,10 +80,13 @@ func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *Ku func Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *kubeadmbootstrapv1alpha4.ClusterConfiguration, out *kubeadmbootstrapv1beta1.ClusterConfiguration, s apiconversion.Scope) error { // DNS.Type was removed in v1alpha4 because only CoreDNS is supported; the information will be left to empty (kubeadm defaults it to CoredDNS); // Existing clusters using kube-dns or other DNS solutions will continue to be managed/supported via the skip-coredns annotation. + + // ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API return kubeadmbootstrapv1beta1.Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in, out, s) } func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *kubeadmbootstrapv1beta1.ClusterConfiguration, out *kubeadmbootstrapv1alpha4.ClusterConfiguration, s apiconversion.Scope) error { - // DNS.Type was removed in v1alpha4 because only CoreDNS is supported, dropping this info. + // DNS.Type was removed in v1alpha4 because only CoreDNS is supported; the information will be left to empty (kubeadm defaults it to CoredDNS); + // ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API return kubeadmbootstrapv1beta1.Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) } diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion_test.go b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go index 08cd72ec503d..8bb62e1f17ac 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion_test.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go @@ -40,20 +40,21 @@ func TestFuzzyConversion(t *testing.T) { Scheme: scheme, Hub: &v1alpha4.KubeadmConfig{}, Spoke: &KubeadmConfig{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{KubeadmConfigStatusFuzzFuncs}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, })) t.Run("for KubeadmConfigTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ Scheme: scheme, Hub: &v1alpha4.KubeadmConfigTemplate{}, Spoke: &KubeadmConfigTemplate{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{KubeadmConfigStatusFuzzFuncs}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, })) } -func KubeadmConfigStatusFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { +func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ KubeadmConfigStatusFuzzer, dnsFuzzer, + clusterConfigurationFuzzer, } } @@ -70,3 +71,10 @@ func dnsFuzzer(obj *v1beta1.DNS, c fuzz.Continue) { // DNS.Type does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. obj.Type = "" } + +func clusterConfigurationFuzzer(obj *v1beta1.ClusterConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // ClusterConfiguration.UseHyperKubeImage has been removed in v1alpha4, so setting it to false in order to avoid v1beta1 --> v1alpha4 --> v1beta1 round trip errors. + obj.UseHyperKubeImage = false +} diff --git a/bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go b/bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go index 3a9633465812..41c030beba61 100644 --- a/bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go @@ -119,10 +119,6 @@ type ClusterConfiguration struct { // +optional ImageRepository string `json:"imageRepository,omitempty"` - // UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images - // +optional - UseHyperKubeImage bool `json:"useHyperKubeImage,omitempty"` - // FeatureGates enabled by the user. // +optional FeatureGates map[string]bool `json:"featureGates,omitempty"` diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index a1db9296f5d2..753978e69be9 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -1334,11 +1334,6 @@ spec: type: object type: array type: object - useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should be - used for Kubernetes components instead of their respective separate - images - type: boolean type: object diskSetup: description: DiskSetup specifies options for the creation of partition diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml index 4a31658de1f3..66f507d2e4cc 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigtemplates.yaml @@ -1347,11 +1347,6 @@ spec: type: object type: array type: object - useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should - be used for Kubernetes components instead of their respective - separate images - type: boolean type: object diskSetup: description: DiskSetup specifies options for the creation diff --git a/bootstrap/kubeadm/types/v1beta1/conversion.go b/bootstrap/kubeadm/types/v1beta1/conversion.go index d13234bcc1ec..83f40c7369c8 100644 --- a/bootstrap/kubeadm/types/v1beta1/conversion.go +++ b/bootstrap/kubeadm/types/v1beta1/conversion.go @@ -74,3 +74,8 @@ func Convert_v1beta1_DNS_To_v1alpha4_DNS(in *DNS, out *bootstrapv1.DNS, s apimac // DNS.Type was removed in v1alpha4 because only CoreDNS is supported, dropping this info. return autoConvert_v1beta1_DNS_To_v1alpha4_DNS(in, out, s) } + +func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *bootstrapv1.ClusterConfiguration, s apimachineryconversion.Scope) error { + // ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API + return autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) +} diff --git a/bootstrap/kubeadm/types/v1beta1/conversion_test.go b/bootstrap/kubeadm/types/v1beta1/conversion_test.go index ea5aab9ca1ef..7aa84da55a70 100644 --- a/bootstrap/kubeadm/types/v1beta1/conversion_test.go +++ b/bootstrap/kubeadm/types/v1beta1/conversion_test.go @@ -71,6 +71,7 @@ func TestFuzzyConversion(t *testing.T) { func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ dnsFuzzer, + clusterConfigurationFuzzer, } } @@ -80,3 +81,10 @@ func dnsFuzzer(obj *DNS, c fuzz.Continue) { // DNS.Type does not exists in v1alpha4, so setting it to empty string in order to avoid v1beta1 --> v1alpha4 --> v1beta1 round trip errors. obj.Type = "" } + +func clusterConfigurationFuzzer(obj *ClusterConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // ClusterConfiguration.UseHyperKubeImage has been removed in v1alpha4, so setting it to false in order to avoid v1beta1 --> v1alpha4 --> v1beta1 round trip errors. + obj.UseHyperKubeImage = false +} diff --git a/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go b/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go index 6d9766fcf432..a842e40c6f0d 100644 --- a/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go @@ -87,11 +87,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*ClusterConfiguration)(nil), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(a.(*v1alpha4.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), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*DNS)(nil), (*v1alpha4.DNS)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DNS_To_v1alpha4_DNS(a.(*DNS), b.(*v1alpha4.DNS), scope) }); err != nil { @@ -401,17 +401,12 @@ func autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(i } 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_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *v1alpha4.ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) -} - func autoConvert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *v1alpha4.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { if err := Convert_v1alpha4_Etcd_To_v1beta1_Etcd(&in.Etcd, &out.Etcd, s); err != nil { return err @@ -435,7 +430,6 @@ func autoConvert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(i } 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 diff --git a/bootstrap/kubeadm/types/v1beta2/conversion.go b/bootstrap/kubeadm/types/v1beta2/conversion.go index 876913059de6..3251f8a9852e 100644 --- a/bootstrap/kubeadm/types/v1beta2/conversion.go +++ b/bootstrap/kubeadm/types/v1beta2/conversion.go @@ -89,3 +89,8 @@ func Convert_v1beta2_DNS_To_v1alpha4_DNS(in *DNS, out *bootstrapv1.DNS, s apimac // DNS.Type was removed in v1alpha4 because only CoreDNS is supported, dropping this info. return autoConvert_v1beta2_DNS_To_v1alpha4_DNS(in, out, s) } + +func Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *bootstrapv1.ClusterConfiguration, s apimachineryconversion.Scope) error { + // ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API + return autoConvert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) +} diff --git a/bootstrap/kubeadm/types/v1beta2/conversion_test.go b/bootstrap/kubeadm/types/v1beta2/conversion_test.go index 88bc49a025bb..48165a2f0d4d 100644 --- a/bootstrap/kubeadm/types/v1beta2/conversion_test.go +++ b/bootstrap/kubeadm/types/v1beta2/conversion_test.go @@ -75,6 +75,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { initConfigurationFuzzer, joinControlPlanesFuzzer, dnsFuzzer, + clusterConfigurationFuzzer, } } @@ -105,3 +106,10 @@ func dnsFuzzer(obj *DNS, c fuzz.Continue) { // DNS.Type does not exists in v1alpha4, so setting it to empty string in order to avoid v1beta2 --> v1alpha4 --> v1beta2 round trip errors. obj.Type = "" } + +func clusterConfigurationFuzzer(obj *ClusterConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // ClusterConfiguration.UseHyperKubeImage has been removed in v1alpha4, so setting it to false in order to avoid v1beta2 --> v1alpha4 --> v1beta2 round trip errors. + obj.UseHyperKubeImage = false +} diff --git a/bootstrap/kubeadm/types/v1beta2/zz_generated.conversion.go b/bootstrap/kubeadm/types/v1beta2/zz_generated.conversion.go index 022616f53f1a..5071358ab2a6 100644 --- a/bootstrap/kubeadm/types/v1beta2/zz_generated.conversion.go +++ b/bootstrap/kubeadm/types/v1beta2/zz_generated.conversion.go @@ -87,11 +87,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*ClusterConfiguration)(nil), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterConfiguration)(nil), (*ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(a.(*v1alpha4.ClusterConfiguration), b.(*ClusterConfiguration), scope) }); err != nil { @@ -227,6 +222,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*ClusterConfiguration)(nil), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*DNS)(nil), (*v1alpha4.DNS)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_DNS_To_v1alpha4_DNS(a.(*DNS), b.(*v1alpha4.DNS), scope) }); err != nil { @@ -401,17 +401,12 @@ func autoConvert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(i } 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_v1alpha4_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *v1alpha4.ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) -} - func autoConvert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(in *v1alpha4.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { if err := Convert_v1alpha4_Etcd_To_v1beta2_Etcd(&in.Etcd, &out.Etcd, s); err != nil { return err @@ -435,7 +430,6 @@ func autoConvert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(i } 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 diff --git a/controlplane/kubeadm/api/v1alpha3/conversion_test.go b/controlplane/kubeadm/api/v1alpha3/conversion_test.go index d6f0242179e8..b43afb0dbc32 100644 --- a/controlplane/kubeadm/api/v1alpha3/conversion_test.go +++ b/controlplane/kubeadm/api/v1alpha3/conversion_test.go @@ -60,6 +60,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { kubeadmBootstrapTokenStringFuzzer, cabpkBootstrapTokenStringFuzzer, dnsFuzzer, + kubeadmClusterConfigurationFuzzer, } } @@ -78,3 +79,10 @@ func dnsFuzzer(obj *kubeadmv1beta1.DNS, c fuzz.Continue) { // DNS.Type does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. obj.Type = "" } + +func kubeadmClusterConfigurationFuzzer(obj *kubeadmv1beta1.ClusterConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // ClusterConfiguration.UseHyperKubeImage has been removed in v1alpha4, so setting it to false in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + obj.UseHyperKubeImage = false +} diff --git a/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go index a32fe6625e80..10031c9eeced 100644 --- a/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go +++ b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go @@ -434,9 +434,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { imageRepository := before.DeepCopy() imageRepository.Spec.KubeadmConfigSpec.ClusterConfiguration.ImageRepository = "a new image repository" - useHyperKubeImage := before.DeepCopy() - useHyperKubeImage.Spec.KubeadmConfigSpec.ClusterConfiguration.UseHyperKubeImage = true - featureGates := before.DeepCopy() featureGates.Spec.KubeadmConfigSpec.ClusterConfiguration.FeatureGates = map[string]bool{"a feature gate": true} @@ -681,12 +678,6 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) { before: before, kcp: imageRepository, }, - { - name: "should fail when making a change to the cluster config's useHyperKubeImage field", - expectErr: true, - before: before, - kcp: useHyperKubeImage, - }, { name: "should fail when making a change to the cluster config's featureGates", expectErr: true, diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml index 7158393c237c..6d37d4711288 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml @@ -1576,11 +1576,6 @@ spec: type: object type: array type: object - useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should - be used for Kubernetes components instead of their respective - separate images - type: boolean type: object diskSetup: description: DiskSetup specifies options for the creation of partition