Skip to content

Commit

Permalink
remove ClusterConfiguration.UseHyperKubeImage from v1alpha4
Browse files Browse the repository at this point in the history
  • Loading branch information
ludusrusso committed Apr 29, 2021
1 parent 0beb260 commit db47368
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 56 deletions.
5 changes: 4 additions & 1 deletion bootstrap/kubeadm/api/v1alpha3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
14 changes: 11 additions & 3 deletions bootstrap/kubeadm/api/v1alpha3/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand All @@ -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
}
4 changes: 0 additions & 4 deletions bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions bootstrap/kubeadm/types/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 8 additions & 0 deletions bootstrap/kubeadm/types/v1beta1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestFuzzyConversion(t *testing.T) {
func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
dnsFuzzer,
clusterConfigurationFuzzer,
}
}

Expand All @@ -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
}
18 changes: 6 additions & 12 deletions bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions bootstrap/kubeadm/types/v1beta2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 8 additions & 0 deletions bootstrap/kubeadm/types/v1beta2/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
initConfigurationFuzzer,
joinControlPlanesFuzzer,
dnsFuzzer,
clusterConfigurationFuzzer,
}
}

Expand Down Expand Up @@ -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
}
18 changes: 6 additions & 12 deletions bootstrap/kubeadm/types/v1beta2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions controlplane/kubeadm/api/v1alpha3/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
kubeadmBootstrapTokenStringFuzzer,
cabpkBootstrapTokenStringFuzzer,
dnsFuzzer,
kubeadmClusterConfigurationFuzzer,
}
}

Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db47368

Please sign in to comment.