diff --git a/Makefile b/Makefile index 891edec7747f..32ba3fdce4f6 100644 --- a/Makefile +++ b/Makefile @@ -288,9 +288,8 @@ generate-go-conversions-cabpk: $(CONVERSION_GEN) --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \ --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt - $(MAKE) clean-generated-conversions SRC_DIRS="./bootstrap/kubeadm/types/v1beta1,./bootstrap/kubeadm/types/v1beta2" + $(MAKE) clean-generated-conversions SRC_DIRS="./bootstrap/kubeadm/types/v1beta2" $(CONVERSION_GEN) \ - --input-dirs=./bootstrap/kubeadm/types/v1beta1 \ --input-dirs=./bootstrap/kubeadm/types/v1beta2 \ --build-tag=ignore_autogenerated_kubeadm_bootstrap_v1alpha3 \ --output-file-base=zz_generated.conversion $(CONVERSION_GEN_OUTPUT_BASE) \ diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go index abac455f51df..765e7b91b38b 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -19,7 +19,7 @@ package v1alpha3 import ( apiconversion "k8s.io/apimachinery/pkg/conversion" kubeadmbootstrapv1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - kubeadmbootstrapv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + kubeadmbootstrapv1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "sigs.k8s.io/controller-runtime/pkg/conversion" ) @@ -77,16 +77,33 @@ func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *Ku return autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) } -func Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *kubeadmbootstrapv1alpha4.ClusterConfiguration, out *kubeadmbootstrapv1beta1.ClusterConfiguration, s apiconversion.Scope) error { +func Convert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(in *kubeadmbootstrapv1alpha4.ClusterConfiguration, out *kubeadmbootstrapv1beta2.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) + return kubeadmbootstrapv1beta2.Convert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(in, out, s) } -func Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *kubeadmbootstrapv1beta1.ClusterConfiguration, out *kubeadmbootstrapv1alpha4.ClusterConfiguration, s apiconversion.Scope) error { +func Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *kubeadmbootstrapv1beta2.ClusterConfiguration, out *kubeadmbootstrapv1alpha4.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); // ClusterConfiguration.UseHyperKubeImage was removed in kubeadm v1alpha4 API - return kubeadmbootstrapv1beta1.Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) + return kubeadmbootstrapv1beta2.Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in, out, s) +} + +func Convert_v1alpha4_InitConfiguration_To_v1beta2_InitConfiguration(in *kubeadmbootstrapv1alpha4.InitConfiguration, out *kubeadmbootstrapv1beta2.InitConfiguration, s apiconversion.Scope) error { + return kubeadmbootstrapv1beta2.Convert_v1alpha4_InitConfiguration_To_v1beta2_InitConfiguration(in, out, s) +} + +func Convert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(in *kubeadmbootstrapv1beta2.InitConfiguration, out *kubeadmbootstrapv1alpha4.InitConfiguration, s apiconversion.Scope) error { + // InitConfiguration.CertificateKey exists in v1beta2 types but not in bootstrapv1.InitConfiguration (Cluster API does not uses automatic copy certs). Ignoring when converting. + return kubeadmbootstrapv1beta2.Convert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(in, out, s) +} + +func Convert_v1beta2_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *kubeadmbootstrapv1beta2.JoinConfiguration, out *kubeadmbootstrapv1alpha4.JoinConfiguration, s apiconversion.Scope) error { + return kubeadmbootstrapv1beta2.Convert_v1beta2_JoinConfiguration_To_v1alpha4_JoinConfiguration(in, out, s) +} + +func Convert_v1alpha4_JoinConfiguration_To_v1beta2_JoinConfiguration(in *kubeadmbootstrapv1alpha4.JoinConfiguration, out *kubeadmbootstrapv1beta2.JoinConfiguration, s apiconversion.Scope) error { + return kubeadmbootstrapv1beta2.Convert_v1alpha4_JoinConfiguration_To_v1beta2_JoinConfiguration(in, out, s) } diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion_test.go b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go index 8bb62e1f17ac..064528b0231d 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion_test.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" utilconversion "sigs.k8s.io/cluster-api/util/conversion" ) @@ -54,7 +54,10 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ KubeadmConfigStatusFuzzer, dnsFuzzer, + initConfigFuzzer, + joinConfigFuzzer, clusterConfigurationFuzzer, + nodeRegistrationOptionsFuzzer, } } @@ -65,16 +68,39 @@ func KubeadmConfigStatusFuzzer(obj *KubeadmConfigStatus, c fuzz.Continue) { obj.BootstrapData = nil } -func dnsFuzzer(obj *v1beta1.DNS, c fuzz.Continue) { +func dnsFuzzer(obj *v1beta2.DNS, c fuzz.Continue) { c.FuzzNoCustom(obj) // 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) { +func initConfigFuzzer(obj *v1beta2.InitConfiguration, 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. + // InitConfiguration.CertificateKey does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + obj.CertificateKey = "" +} + +func joinConfigFuzzer(obj *v1beta2.JoinConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // JoinConfiguration.ControlPlane.CertificateKey does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + if obj.ControlPlane != nil { + obj.ControlPlane.CertificateKey = "" + } +} + +func nodeRegistrationOptionsFuzzer(obj *v1beta2.NodeRegistrationOptions, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // NodeRegistrationOptions.IgnorePreflightErrors does not exists in v1alpha4, so setting it to nil in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + obj.IgnorePreflightErrors = nil +} + +func clusterConfigurationFuzzer(obj *v1beta2.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/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_types.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_types.go index 79877c3de9bd..c5675e3424a5 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_types.go +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_types.go @@ -19,7 +19,7 @@ package v1alpha3 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + kubeadmv1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" ) // Format specifies the output format of the bootstrap data @@ -36,15 +36,15 @@ const ( type KubeadmConfigSpec struct { // ClusterConfiguration along with InitConfiguration are the configurations necessary for the init command // +optional - ClusterConfiguration *kubeadmv1beta1.ClusterConfiguration `json:"clusterConfiguration,omitempty"` + ClusterConfiguration *kubeadmv1beta2.ClusterConfiguration `json:"clusterConfiguration,omitempty"` // InitConfiguration along with ClusterConfiguration are the configurations necessary for the init command // +optional - InitConfiguration *kubeadmv1beta1.InitConfiguration `json:"initConfiguration,omitempty"` + InitConfiguration *kubeadmv1beta2.InitConfiguration `json:"initConfiguration,omitempty"` // JoinConfiguration is the kubeadm configuration for the join command // +optional - JoinConfiguration *kubeadmv1beta1.JoinConfiguration `json:"joinConfiguration,omitempty"` + JoinConfiguration *kubeadmv1beta2.JoinConfiguration `json:"joinConfiguration,omitempty"` // Files specifies extra files to be passed to user_data upon creation. // +optional diff --git a/bootstrap/kubeadm/api/v1alpha3/webhook_test.go b/bootstrap/kubeadm/api/v1alpha3/webhook_test.go index 6e0c00be55ed..9dc810c490c9 100644 --- a/bootstrap/kubeadm/api/v1alpha3/webhook_test.go +++ b/bootstrap/kubeadm/api/v1alpha3/webhook_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/client" - kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + kubeadmv1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "sigs.k8s.io/cluster-api/util" ) @@ -73,14 +73,14 @@ func TestKubeadmConfigTemplateConversion(t *testing.T) { } var fakeKubeadmConfigSpec = KubeadmConfigSpec{ - ClusterConfiguration: &kubeadmv1beta1.ClusterConfiguration{ + ClusterConfiguration: &kubeadmv1beta2.ClusterConfiguration{ KubernetesVersion: "v1.20.2", - APIServer: kubeadmv1beta1.APIServer{ - ControlPlaneComponent: kubeadmv1beta1.ControlPlaneComponent{ + APIServer: kubeadmv1beta2.APIServer{ + ControlPlaneComponent: kubeadmv1beta2.ControlPlaneComponent{ ExtraArgs: map[string]string{ "foo": "bar", }, - ExtraVolumes: []kubeadmv1beta1.HostPathMount{ + ExtraVolumes: []kubeadmv1beta2.HostPathMount{ { Name: "mount-path", HostPath: "/foo", @@ -91,14 +91,14 @@ var fakeKubeadmConfigSpec = KubeadmConfigSpec{ }, }, }, - InitConfiguration: &kubeadmv1beta1.InitConfiguration{ - NodeRegistration: kubeadmv1beta1.NodeRegistrationOptions{ + InitConfiguration: &kubeadmv1beta2.InitConfiguration{ + NodeRegistration: kubeadmv1beta2.NodeRegistrationOptions{ Name: "foo", CRISocket: "/var/run/containerd/containerd.sock", }, }, - JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ - NodeRegistration: kubeadmv1beta1.NodeRegistrationOptions{ + JoinConfiguration: &kubeadmv1beta2.JoinConfiguration{ + NodeRegistration: kubeadmv1beta2.NodeRegistrationOptions{ Name: "foo", CRISocket: "/var/run/containerd/containerd.sock", }, diff --git a/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go index a08738c0f55e..61252c708363 100644 --- a/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go @@ -28,7 +28,7 @@ import ( apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" v1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - v1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + v1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" ) func init() { @@ -198,13 +198,33 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*v1alpha4.ClusterConfiguration)(nil), (*v1beta1.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(a.(*v1alpha4.ClusterConfiguration), b.(*v1beta1.ClusterConfiguration), scope) + if err := s.AddConversionFunc((*v1alpha4.ClusterConfiguration)(nil), (*v1beta2.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(a.(*v1alpha4.ClusterConfiguration), b.(*v1beta2.ClusterConfiguration), scope) }); err != nil { return err } - if err := s.AddConversionFunc((*v1beta1.ClusterConfiguration)(nil), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*v1beta1.ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) + if err := s.AddConversionFunc((*v1alpha4.InitConfiguration)(nil), (*v1beta2.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_InitConfiguration_To_v1beta2_InitConfiguration(a.(*v1alpha4.InitConfiguration), b.(*v1beta2.InitConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha4.JoinConfiguration)(nil), (*v1beta2.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_JoinConfiguration_To_v1beta2_JoinConfiguration(a.(*v1alpha4.JoinConfiguration), b.(*v1beta2.JoinConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.ClusterConfiguration)(nil), (*v1alpha4.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(a.(*v1beta2.ClusterConfiguration), b.(*v1alpha4.ClusterConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.InitConfiguration)(nil), (*v1alpha4.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(a.(*v1beta2.InitConfiguration), b.(*v1alpha4.InitConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.JoinConfiguration)(nil), (*v1alpha4.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_JoinConfiguration_To_v1alpha4_JoinConfiguration(a.(*v1beta2.JoinConfiguration), b.(*v1alpha4.JoinConfiguration), scope) }); err != nil { return err } @@ -397,14 +417,30 @@ func autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *Ku if in.ClusterConfiguration != nil { in, out := &in.ClusterConfiguration, &out.ClusterConfiguration *out = new(v1alpha4.ClusterConfiguration) - if err := Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(*in, *out, s); err != nil { + if err := Convert_v1beta2_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(*in, *out, s); err != nil { return err } } else { out.ClusterConfiguration = nil } - out.InitConfiguration = (*v1alpha4.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) - out.JoinConfiguration = (*v1alpha4.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + if in.InitConfiguration != nil { + in, out := &in.InitConfiguration, &out.InitConfiguration + *out = new(v1alpha4.InitConfiguration) + if err := Convert_v1beta2_InitConfiguration_To_v1alpha4_InitConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.InitConfiguration = nil + } + if in.JoinConfiguration != nil { + in, out := &in.JoinConfiguration, &out.JoinConfiguration + *out = new(v1alpha4.JoinConfiguration) + if err := Convert_v1beta2_JoinConfiguration_To_v1alpha4_JoinConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.JoinConfiguration = nil + } out.Files = *(*[]v1alpha4.File)(unsafe.Pointer(&in.Files)) out.DiskSetup = (*v1alpha4.DiskSetup)(unsafe.Pointer(in.DiskSetup)) out.Mounts = *(*[]v1alpha4.MountPoints)(unsafe.Pointer(&in.Mounts)) @@ -426,15 +462,31 @@ func Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *Kubead func autoConvert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *v1alpha4.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { if in.ClusterConfiguration != nil { in, out := &in.ClusterConfiguration, &out.ClusterConfiguration - *out = new(v1beta1.ClusterConfiguration) - if err := Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(*in, *out, s); err != nil { + *out = new(v1beta2.ClusterConfiguration) + if err := Convert_v1alpha4_ClusterConfiguration_To_v1beta2_ClusterConfiguration(*in, *out, s); err != nil { return err } } else { out.ClusterConfiguration = nil } - out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) - out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + if in.InitConfiguration != nil { + in, out := &in.InitConfiguration, &out.InitConfiguration + *out = new(v1beta2.InitConfiguration) + if err := Convert_v1alpha4_InitConfiguration_To_v1beta2_InitConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.InitConfiguration = nil + } + if in.JoinConfiguration != nil { + in, out := &in.JoinConfiguration, &out.JoinConfiguration + *out = new(v1beta2.JoinConfiguration) + if err := Convert_v1alpha4_JoinConfiguration_To_v1beta2_JoinConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.JoinConfiguration = nil + } out.Files = *(*[]File)(unsafe.Pointer(&in.Files)) out.DiskSetup = (*DiskSetup)(unsafe.Pointer(in.DiskSetup)) out.Mounts = *(*[]MountPoints)(unsafe.Pointer(&in.Mounts)) diff --git a/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go index 1f016861de1e..bce76a928b30 100644 --- a/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/api/v1alpha3/zz_generated.deepcopy.go @@ -23,7 +23,7 @@ package v1alpha3 import ( "k8s.io/apimachinery/pkg/runtime" apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -190,17 +190,17 @@ func (in *KubeadmConfigSpec) DeepCopyInto(out *KubeadmConfigSpec) { *out = *in if in.ClusterConfiguration != nil { in, out := &in.ClusterConfiguration, &out.ClusterConfiguration - *out = new(v1beta1.ClusterConfiguration) + *out = new(v1beta2.ClusterConfiguration) (*in).DeepCopyInto(*out) } if in.InitConfiguration != nil { in, out := &in.InitConfiguration, &out.InitConfiguration - *out = new(v1beta1.InitConfiguration) + *out = new(v1beta2.InitConfiguration) (*in).DeepCopyInto(*out) } if in.JoinConfiguration != nil { in, out := &in.JoinConfiguration, &out.JoinConfiguration - *out = new(v1beta1.JoinConfiguration) + *out = new(v1beta2.JoinConfiguration) (*in).DeepCopyInto(*out) } if in.Files != nil { 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 753978e69be9..6a33a95f2e55 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 @@ -350,9 +350,12 @@ spec: type: array type: object useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should be + description: "UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate - images + images \n 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." type: boolean type: object diskSetup: @@ -552,6 +555,11 @@ spec: - token type: object type: array + certificateKey: + description: CertificateKey sets the key with which certificates + and keys are encrypted prior to being uploaded in a secret in + the cluster during the uploadcerts init phase. + type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint @@ -579,9 +587,6 @@ spec: to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object nodeRegistration: description: NodeRegistration holds fields that relate to registering @@ -594,6 +599,12 @@ spec: info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice of pre-flight + errors to be ignored when the current node is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -617,10 +628,10 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process it will be defaulted - to []v1.Taint{''node-role.kubernetes.io/master=""''}. If - you don''t want to taint your control-plane node, set this - field to an empty slice, i.e. `taints: {}` in the YAML file. - This field is solely used for Node registration.' + to []corev1.Taint{''node-role.kubernetes.io/master=""''}. + If you don''t want to taint your control-plane node, set + this field to an empty slice, i.e. `taints: {}` in the YAML + file. This field is solely used for Node registration.' items: description: The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. @@ -662,16 +673,21 @@ spec: values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string caCertPath: - description: 'CACertPath is the path to the SSL certificate authority + description: CACertPath is the path to the SSL certificate authority used to secure comunications between node and control-plane. - Defaults to "/etc/kubernetes/pki/ca.crt". TODO: revisit when - there is defaulting from k/k' + Defaults to "/etc/kubernetes/pki/ca.crt". type: string controlPlane: description: ControlPlane defines the additional control plane instance to be deployed on the joining node. If nil, no additional control plane instance will be deployed. properties: + certificateKey: + description: CertificateKey is the key that is used for decryption + of certificates after they are downloaded from the secret + upon joining a new control plane node. The corresponding + encryption key is in the InitConfiguration. + type: string localAPIEndpoint: description: LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this node. @@ -685,15 +701,11 @@ spec: Server to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object type: object discovery: - description: 'Discovery specifies the options for the kubelet - to use during the TLS Bootstrap process TODO: revisit when there - is defaulting from k/k' + description: Discovery specifies the options for the kubelet to + use during the TLS Bootstrap process properties: bootstrapToken: description: BootstrapToken is used to set the options for @@ -713,9 +725,7 @@ spec: where the only currently supported type is "sha256". This is a hex-encoded SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded ASN.1. These hashes - can be calculated using, for example, OpenSSL: openssl - x509 -pubkey -in ca.crt openssl rsa -pubin -outform - der 2>&/dev/null | openssl dgst -sha256 -hex' + can be calculated using, for example, OpenSSL:' items: type: string type: array @@ -731,7 +741,6 @@ spec: type: boolean required: - token - - unsafeSkipCAVerification type: object file: description: File is used to specify a file or URL to a kubeconfig @@ -750,12 +759,11 @@ spec: description: Timeout modifies the discovery timeout type: string tlsBootstrapToken: - description: 'TLSBootstrapToken is a token used for TLS bootstrapping. + description: TLSBootstrapToken is a token used for TLS bootstrapping. If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, but can be overridden. If .File is set, this field **must be set** in case the KubeConfigFile does not contain any - other authentication information TODO: revisit when there - is defaulting from k/k' + other authentication information type: string type: object kind: @@ -775,6 +783,12 @@ spec: info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice of pre-flight + errors to be ignored when the current node is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -798,10 +812,10 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process it will be defaulted - to []v1.Taint{''node-role.kubernetes.io/master=""''}. If - you don''t want to taint your control-plane node, set this - field to an empty slice, i.e. `taints: {}` in the YAML file. - This field is solely used for Node registration.' + to []corev1.Taint{''node-role.kubernetes.io/master=""''}. + If you don''t want to taint your control-plane node, set + this field to an empty slice, i.e. `taints: {}` in the YAML + file. This field is solely used for Node registration.' items: description: The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. 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 66f507d2e4cc..e7fa257f00fd 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 @@ -374,9 +374,13 @@ spec: type: array type: object useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should - be used for Kubernetes components instead of their respective - separate images + description: "UseHyperKubeImage controls if hyperkube + should be used for Kubernetes components instead of + their respective separate images \n 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." type: boolean type: object diskSetup: @@ -589,6 +593,11 @@ spec: - token type: object type: array + certificateKey: + description: CertificateKey sets the key with which certificates + and keys are encrypted prior to being uploaded in a + secret in the cluster during the uploadcerts init phase. + type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer @@ -617,9 +626,6 @@ spec: API Server to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object nodeRegistration: description: NodeRegistration holds fields that relate @@ -633,6 +639,13 @@ spec: runtime info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice + of pre-flight errors to be ignored when the current + node is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -657,7 +670,7 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - it will be defaulted to []v1.Taint{''node-role.kubernetes.io/master=""''}. + it will be defaulted to []corev1.Taint{''node-role.kubernetes.io/master=""''}. If you don''t want to taint your control-plane node, set this field to an empty slice, i.e. `taints: {}` in the YAML file. This field is solely used @@ -705,16 +718,22 @@ spec: and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string caCertPath: - description: 'CACertPath is the path to the SSL certificate + description: CACertPath is the path to the SSL certificate authority used to secure comunications between node and control-plane. Defaults to "/etc/kubernetes/pki/ca.crt". - TODO: revisit when there is defaulting from k/k' type: string controlPlane: description: ControlPlane defines the additional control plane instance to be deployed on the joining node. If nil, no additional control plane instance will be deployed. properties: + certificateKey: + description: CertificateKey is the key that is used + for decryption of certificates after they are downloaded + from the secret upon joining a new control plane + node. The corresponding encryption key is in the + InitConfiguration. + type: string localAPIEndpoint: description: LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this @@ -729,15 +748,11 @@ spec: the API Server to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object type: object discovery: - description: 'Discovery specifies the options for the - kubelet to use during the TLS Bootstrap process TODO: - revisit when there is defaulting from k/k' + description: Discovery specifies the options for the kubelet + to use during the TLS Bootstrap process properties: bootstrapToken: description: BootstrapToken is used to set the options @@ -760,9 +775,7 @@ spec: This is a hex-encoded SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded ASN.1. These hashes can be calculated using, - for example, OpenSSL: openssl x509 -pubkey -in - ca.crt openssl rsa -pubin -outform der 2>&/dev/null - | openssl dgst -sha256 -hex' + for example, OpenSSL:' items: type: string type: array @@ -778,7 +791,6 @@ spec: type: boolean required: - token - - unsafeSkipCAVerification type: object file: description: File is used to specify a file or URL @@ -798,13 +810,12 @@ spec: description: Timeout modifies the discovery timeout type: string tlsBootstrapToken: - description: 'TLSBootstrapToken is a token used for + description: TLSBootstrapToken is a token used for TLS bootstrapping. If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, but can be overridden. If .File is set, this field **must be set** in case the KubeConfigFile does not contain - any other authentication information TODO: revisit - when there is defaulting from k/k' + any other authentication information type: string type: object kind: @@ -825,6 +836,13 @@ spec: runtime info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice + of pre-flight errors to be ignored when the current + node is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -849,7 +867,7 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - it will be defaulted to []v1.Taint{''node-role.kubernetes.io/master=""''}. + it will be defaulted to []corev1.Taint{''node-role.kubernetes.io/master=""''}. If you don''t want to taint your control-plane node, set this field to an empty slice, i.e. `taints: {}` in the YAML file. This field is solely used diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go index 2260b2ba620f..2561818d1821 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go @@ -376,7 +376,7 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex if scope.Config.Spec.InitConfiguration == nil { scope.Config.Spec.InitConfiguration = &bootstrapv1.InitConfiguration{ TypeMeta: metav1.TypeMeta{ - APIVersion: "kubeadm.k8s.io/v1beta1", + APIVersion: "kubeadm.k8s.io/v1beta2", Kind: "InitConfiguration", }, } @@ -390,7 +390,7 @@ func (r *KubeadmConfigReconciler) handleClusterNotInitialized(ctx context.Contex if scope.Config.Spec.ClusterConfiguration == nil { scope.Config.Spec.ClusterConfiguration = &bootstrapv1.ClusterConfiguration{ TypeMeta: metav1.TypeMeta{ - APIVersion: "kubeadm.k8s.io/v1beta1", + APIVersion: "kubeadm.k8s.io/v1beta2", Kind: "ClusterConfiguration", }, } diff --git a/bootstrap/kubeadm/types/utils.go b/bootstrap/kubeadm/types/utils.go index ef1b55c73872..d793658ac28a 100644 --- a/bootstrap/kubeadm/types/utils.go +++ b/bootstrap/kubeadm/types/utils.go @@ -23,49 +23,41 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "sigs.k8s.io/controller-runtime/pkg/conversion" "sigs.k8s.io/controller-runtime/pkg/scheme" ) var ( - v1beta1KubeadmVersion = semver.MustParse("1.13.0") v1beta2KubeadmVersion = semver.MustParse("1.15.0") clusterConfigurationVersionTypeMap = map[schema.GroupVersion]conversion.Convertible{ v1beta2.GroupVersion: &v1beta2.ClusterConfiguration{}, - v1beta1.GroupVersion: &v1beta1.ClusterConfiguration{}, } clusterStatusVersionTypeMap = map[schema.GroupVersion]conversion.Convertible{ v1beta2.GroupVersion: &v1beta2.ClusterStatus{}, - v1beta1.GroupVersion: &v1beta1.ClusterStatus{}, } initConfigurationVersionTypeMap = map[schema.GroupVersion]conversion.Convertible{ v1beta2.GroupVersion: &v1beta2.InitConfiguration{}, - v1beta1.GroupVersion: &v1beta1.InitConfiguration{}, } joinConfigurationVersionTypeMap = map[schema.GroupVersion]conversion.Convertible{ v1beta2.GroupVersion: &v1beta2.JoinConfiguration{}, - v1beta1.GroupVersion: &v1beta1.JoinConfiguration{}, } ) func KubeVersionToKubeadmAPIGroupVersion(version semver.Version) (schema.GroupVersion, error) { switch { - case version.LT(v1beta1KubeadmVersion): - return schema.GroupVersion{}, errors.New("the bootstrap provider for kubeadm doesn't support Kubernetes version lower than v1.13.0") case version.LT(v1beta2KubeadmVersion): - // NOTE: All the Kubernetes version >= v1.13 and < v1.15 should use the kubeadm API version v1beta1 - return v1beta1.GroupVersion, nil + return schema.GroupVersion{}, errors.New("the bootstrap provider for kubeadm doesn't support Kubernetes version lower than v1.15.0") + // TODO: add v1beta3 version if applicable default: // NOTE: All the Kubernetes version greater or equal to v1.15 should use the kubeadm API version v1beta2. // Also future Kubernetes versions (not yet released at the time of writing this code) are going to use v1beta2, // no matter if kubeadm API versions newer than v1beta2 could be introduced by those release. - // This is acceptable because but v1beta2 will be supported by kubeadm until the deprecation cycle completes + // This is acceptable because v1beta2 will be supported by kubeadm until the deprecation cycle completes // (9 months minimum after the deprecation date, not yet announced now); this gives Cluster API project time to // introduce support for newer releases without blocking users to deploy newer version of Kubernetes. return v1beta2.GroupVersion, nil diff --git a/bootstrap/kubeadm/types/utils_test.go b/bootstrap/kubeadm/types/utils_test.go index 9127eb1309a1..33147c91bc18 100644 --- a/bootstrap/kubeadm/types/utils_test.go +++ b/bootstrap/kubeadm/types/utils_test.go @@ -22,7 +22,6 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime/schema" bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "testing" @@ -41,27 +40,11 @@ func TestKubeVersionToKubeadmAPIGroupVersion(t *testing.T) { { name: "fails when kubernetes version is too old", args: args{ - version: semver.MustParse("1.12.0"), + version: semver.MustParse("1.14.0"), }, want: schema.GroupVersion{}, wantErr: true, }, - { - name: "pass with minimum kubernetes version for kubeadm API v1beta1", - args: args{ - version: semver.MustParse("1.13.0"), - }, - want: v1beta1.GroupVersion, - wantErr: false, - }, - { - name: "pass with kubernetes version for kubeadm API v1beta1", - args: args{ - version: semver.MustParse("1.14.99"), - }, - want: v1beta1.GroupVersion, - wantErr: false, - }, { name: "pass with minimum kubernetes version for kubeadm API v1beta2", args: args{ @@ -113,22 +96,6 @@ func TestMarshalClusterConfigurationForVersion(t *testing.T) { want string wantErr bool }{ - { - name: "Generates a v1beta1 kubeadm configuration", - args: args{ - capiObj: &bootstrapv1.ClusterConfiguration{}, - version: semver.MustParse("1.14.9"), - }, - want: "apiServer: {}\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + - "controllerManager: {}\n" + - "dns: {}\n" + - "etcd: {}\n" + - "kind: ClusterConfiguration\n" + - "networking: {}\n" + - "scheduler: {}\n", - wantErr: false, - }, { name: "Generates a v1beta2 kubeadm configuration", args: args{ @@ -172,17 +139,6 @@ func TestMarshalClusterStatusForVersion(t *testing.T) { want string wantErr bool }{ - { - name: "Generates a v1beta1 kubeadm status", - args: args{ - capiObj: &bootstrapv1.ClusterStatus{}, - version: semver.MustParse("1.14.9"), - }, - want: "apiEndpoints: null\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + - "kind: ClusterStatus\n", - wantErr: false, - }, { name: "Generates a v1beta2 kubeadm status", args: args{ @@ -221,20 +177,6 @@ func TestMarshalInitConfigurationForVersion(t *testing.T) { want string wantErr bool }{ - { - name: "Generates a v1beta1 kubeadm configuration", - args: args{ - capiObj: &bootstrapv1.InitConfiguration{}, - version: semver.MustParse("1.14.9"), - }, - want: "apiVersion: kubeadm.k8s.io/v1beta1\n" + - "kind: InitConfiguration\n" + - "localAPIEndpoint:\n" + - " advertiseAddress: \"\"\n" + - " bindPort: 0\n" + - "nodeRegistration: {}\n", - wantErr: false, - }, { name: "Generates a v1beta2 kubeadm configuration", args: args{ @@ -274,18 +216,6 @@ func TestMarshalJoinConfigurationForVersion(t *testing.T) { want string wantErr bool }{ - { - name: "Generates a v1beta1 kubeadm configuration", - args: args{ - capiObj: &bootstrapv1.JoinConfiguration{}, - version: semver.MustParse("1.14.9"), - }, - want: "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + - "discovery: {}\n" + - "kind: JoinConfiguration\n" + - "nodeRegistration: {}\n", - wantErr: false, - }, { name: "Generates a v1beta2 kubeadm configuration", args: args{ @@ -324,21 +254,6 @@ func TestUnmarshalClusterConfiguration(t *testing.T) { want *bootstrapv1.ClusterConfiguration wantErr bool }{ - { - name: "Parses a v1beta1 kubeadm configuration", - args: args{ - yaml: "apiServer: {}\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + - "controllerManager: {}\n" + - "dns: {}\n" + - "etcd: {}\n" + - "kind: ClusterConfiguration\n" + - "networking: {}\n" + - "scheduler: {}\n", - }, - want: &bootstrapv1.ClusterConfiguration{}, - wantErr: false, - }, { name: "Parses a v1beta2 kubeadm configuration", args: args{ @@ -380,21 +295,11 @@ func TestUnmarshalClusterStatus(t *testing.T) { want *bootstrapv1.ClusterStatus wantErr bool }{ - { - name: "Parses a v1beta1 kubeadm configuration", - args: args{ - yaml: "apiEndpoints: null\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + - "kind: ClusterStatus\n", - }, - want: &bootstrapv1.ClusterStatus{}, - wantErr: false, - }, { name: "Parses a v1beta2 kubeadm configuration", args: args{ yaml: "apiEndpoints: null\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + "" + + "apiVersion: kubeadm.k8s.io/v1beta2\n" + "" + "kind: ClusterStatus\n", }, want: &bootstrapv1.ClusterStatus{}, diff --git a/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring.go b/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring.go deleted file mode 100644 index 09c43c1e9e28..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - "fmt" - "strings" - - "github.com/pkg/errors" - - bootstrapapi "k8s.io/cluster-bootstrap/token/api" - bootstraputil "k8s.io/cluster-bootstrap/token/util" -) - -// +kubebuilder:validation:Type=string -// BootstrapTokenString is a token of the format abcdef.abcdef0123456789 that is used -// for both validation of the practically of the API server from a joining node's point -// of view and as an authentication method for the node in the bootstrap phase of -// "kubeadm join". This token is and should be short-lived. -type BootstrapTokenString struct { - ID string `json:"-"` - Secret string `json:"-"` -} - -// MarshalJSON implements the json.Marshaler interface. -func (bts BootstrapTokenString) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"%s"`, bts.String())), nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface. -func (bts *BootstrapTokenString) UnmarshalJSON(b []byte) error { - // If the token is represented as "", just return quickly without an error - if len(b) == 0 { - return nil - } - - // Remove unnecessary " characters coming from the JSON parser - token := strings.ReplaceAll(string(b), `"`, ``) - // Convert the string Token to a BootstrapTokenString object - newbts, err := NewBootstrapTokenString(token) - if err != nil { - return err - } - bts.ID = newbts.ID - bts.Secret = newbts.Secret - return nil -} - -// String returns the string representation of the BootstrapTokenString. -func (bts BootstrapTokenString) String() string { - if len(bts.ID) > 0 && len(bts.Secret) > 0 { - return bootstraputil.TokenFromIDAndSecret(bts.ID, bts.Secret) - } - return "" -} - -// NewBootstrapTokenString converts the given Bootstrap Token as a string -// to the BootstrapTokenString object used for serialization/deserialization -// and internal usage. It also automatically validates that the given token -// is of the right format. -func NewBootstrapTokenString(token string) (*BootstrapTokenString, error) { - substrs := bootstraputil.BootstrapTokenRegexp.FindStringSubmatch(token) - // TODO: Add a constant for the 3 value here, and explain better why it's needed (other than because how the regexp parsin works) - if len(substrs) != 3 { - return nil, errors.Errorf("the bootstrap token %q was not of the form %q", token, bootstrapapi.BootstrapTokenPattern) - } - - return &BootstrapTokenString{ID: substrs[1], Secret: substrs[2]}, nil -} - -// NewBootstrapTokenStringFromIDAndSecret is a wrapper around NewBootstrapTokenString -// that allows the caller to specify the ID and Secret separately. -func NewBootstrapTokenStringFromIDAndSecret(id, secret string) (*BootstrapTokenString, error) { - return NewBootstrapTokenString(bootstraputil.TokenFromIDAndSecret(id, secret)) -} diff --git a/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring_test.go b/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring_test.go deleted file mode 100644 index c8adfdf5f234..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/bootstraptokenstring_test.go +++ /dev/null @@ -1,223 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - "encoding/json" - "reflect" - "testing" - - . "github.com/onsi/gomega" - - "github.com/pkg/errors" -) - -func TestMarshalJSON(t *testing.T) { - var tests = []struct { - bts BootstrapTokenString - expected string - }{ - {BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}, `"abcdef.abcdef0123456789"`}, - {BootstrapTokenString{ID: "foo", Secret: "bar"}, `"foo.bar"`}, - {BootstrapTokenString{ID: "h", Secret: "b"}, `"h.b"`}, - } - for _, rt := range tests { - t.Run(rt.bts.ID, func(t *testing.T) { - g := NewWithT(t) - - b, err := json.Marshal(rt.bts) - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(b).To(BeEquivalentTo(rt.expected)) - }) - } -} - -func TestUnmarshalJSON(t *testing.T) { - var tests = []struct { - input string - bts *BootstrapTokenString - expectedError bool - }{ - {`"f.s"`, &BootstrapTokenString{}, true}, - {`"abcdef."`, &BootstrapTokenString{}, true}, - {`"abcdef:abcdef0123456789"`, &BootstrapTokenString{}, true}, - {`abcdef.abcdef0123456789`, &BootstrapTokenString{}, true}, - {`"abcdef.abcdef0123456789`, &BootstrapTokenString{}, true}, - {`"abcdef.ABCDEF0123456789"`, &BootstrapTokenString{}, true}, - {`"abcdef.abcdef0123456789"`, &BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}, false}, - {`"123456.aabbccddeeffgghh"`, &BootstrapTokenString{ID: "123456", Secret: "aabbccddeeffgghh"}, false}, - } - for _, rt := range tests { - t.Run(rt.input, func(t *testing.T) { - g := NewWithT(t) - - newbts := &BootstrapTokenString{} - err := json.Unmarshal([]byte(rt.input), newbts) - if rt.expectedError { - g.Expect(err).To(HaveOccurred()) - } else { - g.Expect(err).NotTo(HaveOccurred()) - } - g.Expect(newbts).To(Equal(rt.bts)) - }) - } -} - -func TestJSONRoundtrip(t *testing.T) { - var tests = []struct { - input string - bts *BootstrapTokenString - }{ - {`"abcdef.abcdef0123456789"`, nil}, - {"", &BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}}, - } - for _, rt := range tests { - t.Run(rt.input, func(t *testing.T) { - g := NewWithT(t) - - g.Expect(roundtrip(rt.input, rt.bts)).To(Succeed()) - }) - } -} - -func roundtrip(input string, bts *BootstrapTokenString) error { - var b []byte - var err error - newbts := &BootstrapTokenString{} - // If string input was specified, roundtrip like this: string -> (unmarshal) -> object -> (marshal) -> string - if len(input) > 0 { - if err := json.Unmarshal([]byte(input), newbts); err != nil { - return errors.Wrap(err, "expected no unmarshal error, got error") - } - if b, err = json.Marshal(newbts); err != nil { - return errors.Wrap(err, "expected no marshal error, got error") - } - if input != string(b) { - return errors.Errorf( - "expected token: %s\n\t actual: %s", - input, - string(b), - ) - } - } else { // Otherwise, roundtrip like this: object -> (marshal) -> string -> (unmarshal) -> object - if b, err = json.Marshal(bts); err != nil { - return errors.Wrap(err, "expected no marshal error, got error") - } - if err := json.Unmarshal(b, newbts); err != nil { - return errors.Wrap(err, "expected no unmarshal error, got error") - } - if !reflect.DeepEqual(bts, newbts) { - return errors.Errorf( - "expected object: %v\n\t actual: %v", - bts, - newbts, - ) - } - } - return nil -} - -func TestTokenFromIDAndSecret(t *testing.T) { - var tests = []struct { - bts BootstrapTokenString - expected string - }{ - {BootstrapTokenString{ID: "foo", Secret: "bar"}, "foo.bar"}, - {BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}, "abcdef.abcdef0123456789"}, - {BootstrapTokenString{ID: "h", Secret: "b"}, "h.b"}, - } - for _, rt := range tests { - t.Run(rt.bts.ID, func(t *testing.T) { - g := NewWithT(t) - - g.Expect(rt.bts.String()).To(Equal(rt.expected)) - }) - } -} - -func TestNewBootstrapTokenString(t *testing.T) { - var tests = []struct { - token string - expectedError bool - bts *BootstrapTokenString - }{ - {token: "", expectedError: true, bts: nil}, - {token: ".", expectedError: true, bts: nil}, - {token: "1234567890123456789012", expectedError: true, bts: nil}, // invalid parcel size - {token: "12345.1234567890123456", expectedError: true, bts: nil}, // invalid parcel size - {token: ".1234567890123456", expectedError: true, bts: nil}, // invalid parcel size - {token: "123456.", expectedError: true, bts: nil}, // invalid parcel size - {token: "123456:1234567890.123456", expectedError: true, bts: nil}, // invalid separation - {token: "abcdef:1234567890123456", expectedError: true, bts: nil}, // invalid separation - {token: "Abcdef.1234567890123456", expectedError: true, bts: nil}, // invalid token id - {token: "123456.AABBCCDDEEFFGGHH", expectedError: true, bts: nil}, // invalid token secret - {token: "123456.AABBCCD-EEFFGGHH", expectedError: true, bts: nil}, // invalid character - {token: "abc*ef.1234567890123456", expectedError: true, bts: nil}, // invalid character - {token: "abcdef.1234567890123456", expectedError: false, bts: &BootstrapTokenString{ID: "abcdef", Secret: "1234567890123456"}}, - {token: "123456.aabbccddeeffgghh", expectedError: false, bts: &BootstrapTokenString{ID: "123456", Secret: "aabbccddeeffgghh"}}, - {token: "abcdef.abcdef0123456789", expectedError: false, bts: &BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}}, - {token: "123456.1234560123456789", expectedError: false, bts: &BootstrapTokenString{ID: "123456", Secret: "1234560123456789"}}, - } - for _, rt := range tests { - t.Run(rt.token, func(t *testing.T) { - g := NewWithT(t) - - actual, err := NewBootstrapTokenString(rt.token) - if rt.expectedError { - g.Expect(err).To(HaveOccurred()) - } else { - g.Expect(err).NotTo(HaveOccurred()) - } - g.Expect(actual).To(Equal(rt.bts)) - }) - } -} - -func TestNewBootstrapTokenStringFromIDAndSecret(t *testing.T) { - var tests = []struct { - id, secret string - expectedError bool - bts *BootstrapTokenString - }{ - {id: "", secret: "", expectedError: true, bts: nil}, - {id: "1234567890123456789012", secret: "", expectedError: true, bts: nil}, // invalid parcel size - {id: "12345", secret: "1234567890123456", expectedError: true, bts: nil}, // invalid parcel size - {id: "", secret: "1234567890123456", expectedError: true, bts: nil}, // invalid parcel size - {id: "123456", secret: "", expectedError: true, bts: nil}, // invalid parcel size - {id: "Abcdef", secret: "1234567890123456", expectedError: true, bts: nil}, // invalid token id - {id: "123456", secret: "AABBCCDDEEFFGGHH", expectedError: true, bts: nil}, // invalid token secret - {id: "123456", secret: "AABBCCD-EEFFGGHH", expectedError: true, bts: nil}, // invalid character - {id: "abc*ef", secret: "1234567890123456", expectedError: true, bts: nil}, // invalid character - {id: "abcdef", secret: "1234567890123456", expectedError: false, bts: &BootstrapTokenString{ID: "abcdef", Secret: "1234567890123456"}}, - {id: "123456", secret: "aabbccddeeffgghh", expectedError: false, bts: &BootstrapTokenString{ID: "123456", Secret: "aabbccddeeffgghh"}}, - {id: "abcdef", secret: "abcdef0123456789", expectedError: false, bts: &BootstrapTokenString{ID: "abcdef", Secret: "abcdef0123456789"}}, - {id: "123456", secret: "1234560123456789", expectedError: false, bts: &BootstrapTokenString{ID: "123456", Secret: "1234560123456789"}}, - } - for _, rt := range tests { - t.Run(rt.id, func(t *testing.T) { - g := NewWithT(t) - - actual, err := NewBootstrapTokenStringFromIDAndSecret(rt.id, rt.secret) - if rt.expectedError { - g.Expect(err).To(HaveOccurred()) - } else { - g.Expect(err).NotTo(HaveOccurred()) - } - g.Expect(actual).To(Equal(rt.bts)) - }) - } -} diff --git a/bootstrap/kubeadm/types/v1beta1/conversion.go b/bootstrap/kubeadm/types/v1beta1/conversion.go deleted file mode 100644 index 83f40c7369c8..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/conversion.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - apimachineryconversion "k8s.io/apimachinery/pkg/conversion" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this ClusterConfiguration to the Hub version (v1alpha4). -func (src *ClusterConfiguration) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*bootstrapv1.ClusterConfiguration) - return Convert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(src, dst, nil) -} - -// ConvertFrom converts from the ClusterConfiguration Hub version (v1alpha4) to this version. -func (dst *ClusterConfiguration) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*bootstrapv1.ClusterConfiguration) - return Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(src, dst, nil) -} - -// ConvertTo converts this ClusterStatus to the Hub version (v1alpha4). -func (src *ClusterStatus) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*bootstrapv1.ClusterStatus) - return Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(src, dst, nil) -} - -// ConvertFrom converts from the ClusterStatus Hub version (v1alpha4) to this version. -func (dst *ClusterStatus) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*bootstrapv1.ClusterStatus) - return Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(src, dst, nil) -} - -// ConvertTo converts this InitConfiguration to the Hub version (v1alpha4). -func (src *InitConfiguration) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*bootstrapv1.InitConfiguration) - return Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(src, dst, nil) -} - -// ConvertFrom converts from the InitConfiguration Hub version (v1alpha4) to this version. -func (dst *InitConfiguration) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*bootstrapv1.InitConfiguration) - return Convert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration(src, dst, nil) -} - -// ConvertTo converts this JoinConfiguration to the Hub version (v1alpha4). -func (src *JoinConfiguration) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*bootstrapv1.JoinConfiguration) - return Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(src, dst, nil) -} - -// ConvertFrom converts from the JoinConfiguration Hub version (v1alpha4) to this version. -func (dst *JoinConfiguration) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*bootstrapv1.JoinConfiguration) - return Convert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration(src, dst, nil) -} - -func Convert_v1beta1_DNS_To_v1alpha4_DNS(in *DNS, out *bootstrapv1.DNS, s apimachineryconversion.Scope) error { - // 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 deleted file mode 100644 index 7aa84da55a70..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/conversion_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - "testing" - - fuzz "github.com/google/gofuzz" - . "github.com/onsi/gomega" - "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" - "k8s.io/apimachinery/pkg/runtime" - runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" -) - -func TestFuzzyConversion(t *testing.T) { - g := NewWithT(t) - scheme := runtime.NewScheme() - g.Expect(AddToScheme(scheme)).To(Succeed()) - g.Expect(v1alpha4.AddToScheme(scheme)).To(Succeed()) - - t.Run("for ClusterConfiguration", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1alpha4.ClusterConfiguration{}, - Spoke: &ClusterConfiguration{}, - // NOTE: Kubeadm types does not have ObjectMeta, so we are required to skip data annotation cleanup in the spoke-hub-spoke round trip test. - SkipSpokeAnnotationCleanup: true, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) - t.Run("for ClusterStatus", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1alpha4.ClusterStatus{}, - Spoke: &ClusterStatus{}, - // NOTE: Kubeadm types does not have ObjectMeta, so we are required to skip data annotation cleanup in the spoke-hub-spoke round trip test. - SkipSpokeAnnotationCleanup: true, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) - t.Run("for InitConfiguration", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1alpha4.InitConfiguration{}, - Spoke: &InitConfiguration{}, - // NOTE: Kubeadm types does not have ObjectMeta, so we are required to skip data annotation cleanup in the spoke-hub-spoke round trip test. - SkipSpokeAnnotationCleanup: true, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) - t.Run("for JoinConfiguration", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Scheme: scheme, - Hub: &v1alpha4.JoinConfiguration{}, - Spoke: &JoinConfiguration{}, - // NOTE: Kubeadm types does not have ObjectMeta, so we are required to skip data annotation cleanup in the spoke-hub-spoke round trip test. - SkipSpokeAnnotationCleanup: true, - FuzzerFuncs: []fuzzer.FuzzerFuncs{fuzzFuncs}, - })) -} - -func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { - return []interface{}{ - dnsFuzzer, - clusterConfigurationFuzzer, - } -} - -func dnsFuzzer(obj *DNS, c fuzz.Continue) { - c.FuzzNoCustom(obj) - - // 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/doc.go b/bootstrap/kubeadm/types/v1beta1/doc.go deleted file mode 100644 index 2e10e12c1f70..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/* -This packages contains a mirror of kubeadm API v1beta1 API, required because it is not possible to import k/K. - -IMPORTANT: Do not change these files! -IMPORTANT: only for KubeadmConfig serialization/deserialization, and should not be used for other purposes. -*/ - -// +k8s:conversion-gen=sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4 -// +k8s:deepcopy-gen=package -package v1beta1 // import "sigs.k8s.io/cluster-api/bootstrap/kubeadm/kubeadm/v1beta1" diff --git a/bootstrap/kubeadm/types/v1beta1/groupversion_info.go b/bootstrap/kubeadm/types/v1beta1/groupversion_info.go deleted file mode 100644 index 926e347f6da0..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/groupversion_info.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -var ( - // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "kubeadm.k8s.io", Version: "v1beta1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme. - SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme - - localSchemeBuilder = SchemeBuilder.SchemeBuilder -) diff --git a/bootstrap/kubeadm/types/v1beta1/types.go b/bootstrap/kubeadm/types/v1beta1/types.go deleted file mode 100644 index c8a5e91c11e8..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/types.go +++ /dev/null @@ -1,426 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// InitConfiguration contains a list of elements that is specific "kubeadm init"-only runtime -// information. -type InitConfiguration struct { - metav1.TypeMeta `json:",inline"` - - // BootstrapTokens is respected at `kubeadm init` time and describes a set of Bootstrap Tokens to create. - // This information IS NOT uploaded to the kubeadm cluster configmap, partly because of its sensitive nature - // +optional - BootstrapTokens []BootstrapToken `json:"bootstrapTokens,omitempty"` - - // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster. - // When used in the context of control plane nodes, NodeRegistration should remain consistent - // across both InitConfiguration and JoinConfiguration - // +optional - NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"` - - // LocalAPIEndpoint represents the endpoint of the API server instance that's deployed on this control plane node - // In HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint in the sense that ControlPlaneEndpoint - // is the global endpoint for the cluster, which then loadbalances the requests to each individual API server. This - // configuration object lets you customize what IP/DNS name and port the local API server advertises it's accessible - // on. By default, kubeadm tries to auto-detect the IP of the default interface and use that, but in case that process - // fails you may set the desired value here. - // +optional - LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterConfiguration contains cluster-wide configuration for a kubeadm cluster. -type ClusterConfiguration struct { - metav1.TypeMeta `json:",inline"` - - // Etcd holds configuration for etcd. - // NB: This value defaults to a Local (stacked) etcd - // +optional - Etcd Etcd `json:"etcd,omitempty"` - - // Networking holds configuration for the networking topology of the cluster. - // NB: This value defaults to the Cluster object spec.clusterNetwork. - // +optional - Networking Networking `json:"networking,omitempty"` - - // KubernetesVersion is the target version of the control plane. - // NB: This value defaults to the Machine object spec.version - // +optional - KubernetesVersion string `json:"kubernetesVersion,omitempty"` - - // ControlPlaneEndpoint sets a stable IP address or DNS name for the control plane; it - // can be a valid IP address or a RFC-1123 DNS subdomain, both with optional TCP port. - // In case the ControlPlaneEndpoint is not specified, the AdvertiseAddress + BindPort - // are used; in case the ControlPlaneEndpoint is specified but without a TCP port, - // the BindPort is used. - // Possible usages are: - // e.g. In a cluster with more than one control plane instances, this field should be - // assigned the address of the external load balancer in front of the - // control plane instances. - // e.g. in environments with enforced node recycling, the ControlPlaneEndpoint - // could be used for assigning a stable DNS to the control plane. - // NB: This value defaults to the first value in the Cluster object status.apiEndpoints array. - // +optional - ControlPlaneEndpoint string `json:"controlPlaneEndpoint,omitempty"` - - // APIServer contains extra settings for the API server control plane component - // +optional - APIServer APIServer `json:"apiServer,omitempty"` - - // ControllerManager contains extra settings for the controller manager control plane component - // +optional - ControllerManager ControlPlaneComponent `json:"controllerManager,omitempty"` - - // Scheduler contains extra settings for the scheduler control plane component - // +optional - Scheduler ControlPlaneComponent `json:"scheduler,omitempty"` - - // DNS defines the options for the DNS add-on installed in the cluster. - // +optional - DNS DNS `json:"dns,omitempty"` - - // CertificatesDir specifies where to store or look for all required certificates. - // NB: if not provided, this will default to `/etc/kubernetes/pki` - // +optional - CertificatesDir string `json:"certificatesDir,omitempty"` - - // ImageRepository sets the container registry to pull images from. - // If empty, `k8s.gcr.io` will be used by default; in case of kubernetes version is a CI build (kubernetes version starts with `ci/` or `ci-cross/`) - // `gcr.io/k8s-staging-ci-images` will be used as a default for control plane components and for kube-proxy, while `k8s.gcr.io` - // will be used for all the other images. - // +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"` - - // The cluster name - // +optional - ClusterName string `json:"clusterName,omitempty"` -} - -// ControlPlaneComponent holds settings common to control plane component of the cluster. -type ControlPlaneComponent struct { - // ExtraArgs is an extra set of flags to pass to the control plane component. - // TODO: This is temporary and ideally we would like to switch all components to - // use ComponentConfig + ConfigMaps. - ExtraArgs map[string]string `json:"extraArgs,omitempty"` - - // ExtraVolumes is an extra set of host volumes, mounted to the control plane component. - ExtraVolumes []HostPathMount `json:"extraVolumes,omitempty"` -} - -// APIServer holds settings necessary for API server deployments in the cluster. -type APIServer struct { - ControlPlaneComponent `json:",inline"` - - // CertSANs sets extra Subject Alternative Names for the API Server signing cert. - CertSANs []string `json:"certSANs,omitempty"` - - // TimeoutForControlPlane controls the timeout that we use for API server to appear - TimeoutForControlPlane *metav1.Duration `json:"timeoutForControlPlane,omitempty"` -} - -// DNSAddOnType defines string identifying DNS add-on types. -type DNSAddOnType string - -const ( - // CoreDNS add-on type. - CoreDNS DNSAddOnType = "CoreDNS" - - // KubeDNS add-on type. - KubeDNS DNSAddOnType = "kube-dns" -) - -// DNS defines the DNS addon that should be used in the cluster. -type DNS struct { - // Type defines the DNS add-on to be used - // +optional - Type DNSAddOnType `json:"type,omitempty"` - - // ImageMeta allows to customize the image used for the DNS component - ImageMeta `json:",inline"` -} - -// ImageMeta allows to customize the image used for components that are not -// originated from the Kubernetes/Kubernetes release process. -type ImageMeta struct { - // ImageRepository sets the container registry to pull images from. - // if not set, the ImageRepository defined in ClusterConfiguration will be used instead. - ImageRepository string `json:"imageRepository,omitempty"` - - // ImageTag allows to specify a tag for the image. - // In case this value is set, kubeadm does not change automatically the version of the above components during upgrades. - ImageTag string `json:"imageTag,omitempty"` - - //TODO: evaluate if we need also a ImageName based on user feedbacks -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterStatus contains the cluster status. The ClusterStatus will be stored in the kubeadm-config -// ConfigMap in the cluster, and then updated by kubeadm when additional control plane instance joins or leaves the cluster. -type ClusterStatus struct { - metav1.TypeMeta `json:",inline"` - - // APIEndpoints currently available in the cluster, one for each control plane/api server instance. - // The key of the map is the IP of the host's default interface - APIEndpoints map[string]APIEndpoint `json:"apiEndpoints"` -} - -// APIEndpoint struct contains elements of API server instance deployed on a node. -type APIEndpoint struct { - // AdvertiseAddress sets the IP address for the API server to advertise. - AdvertiseAddress string `json:"advertiseAddress"` - - // BindPort sets the secure port for the API Server to bind to. - // Defaults to 6443. - BindPort int32 `json:"bindPort"` -} - -// NodeRegistrationOptions holds fields that relate to registering a new control-plane or node to the cluster, either via "kubeadm init" or "kubeadm join". -type NodeRegistrationOptions struct { - - // Name is the `.Metadata.Name` field of the Node API object that will be created in this `kubeadm init` or `kubeadm join` operation. - // This field is also used in the CommonName field of the kubelet's client certificate to the API server. - // Defaults to the hostname of the node if not provided. - // +optional - Name string `json:"name,omitempty"` - - // CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use - // +optional - CRISocket string `json:"criSocket,omitempty"` - - // Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process - // it will be defaulted to []v1.Taint{'node-role.kubernetes.io/master=""'}. If you don't want to taint your control-plane node, set this field to an - // empty slice, i.e. `taints: {}` in the YAML file. This field is solely used for Node registration. - // +optional - Taints []v1.Taint `json:"taints,omitempty"` - - // KubeletExtraArgs passes through extra arguments to the kubelet. The arguments here are passed to the kubelet command line via the environment file - // kubeadm writes at runtime for the kubelet to source. This overrides the generic base-level configuration in the kubelet-config-1.X ConfigMap - // Flags have higher priority when parsing. These values are local and specific to the node kubeadm is executing on. - // +optional - KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"` -} - -// Networking contains elements describing cluster's networking configuration. -type Networking struct { - // ServiceSubnet is the subnet used by k8s services. - // Defaults to a comma-delimited string of the Cluster object's spec.clusterNetwork.pods.cidrBlocks, or - // to "10.96.0.0/12" if that's unset. - // +optional - ServiceSubnet string `json:"serviceSubnet,omitempty"` - // PodSubnet is the subnet used by pods. - // If unset, the API server will not allocate CIDR ranges for every node. - // Defaults to a comma-delimited string of the Cluster object's spec.clusterNetwork.services.cidrBlocks if that is set - // +optional - PodSubnet string `json:"podSubnet,omitempty"` - // DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local". - // +optional - DNSDomain string `json:"dnsDomain,omitempty"` -} - -// BootstrapToken describes one bootstrap token, stored as a Secret in the cluster. -type BootstrapToken struct { - // Token is used for establishing bidirectional trust between nodes and control-planes. - // Used for joining nodes in the cluster. - Token *BootstrapTokenString `json:"token"` - // Description sets a human-friendly message why this token exists and what it's used - // for, so other administrators can know its purpose. - Description string `json:"description,omitempty"` - // TTL defines the time to live for this token. Defaults to 24h. - // Expires and TTL are mutually exclusive. - TTL *metav1.Duration `json:"ttl,omitempty"` - // Expires specifies the timestamp when this token expires. Defaults to being set - // dynamically at runtime based on the TTL. Expires and TTL are mutually exclusive. - Expires *metav1.Time `json:"expires,omitempty"` - // Usages describes the ways in which this token can be used. Can by default be used - // for establishing bidirectional trust, but that can be changed here. - Usages []string `json:"usages,omitempty"` - // Groups specifies the extra groups that this token will authenticate as when/if - // used for authentication - Groups []string `json:"groups,omitempty"` -} - -// Etcd contains elements describing Etcd configuration. -type Etcd struct { - - // Local provides configuration knobs for configuring the local etcd instance - // Local and External are mutually exclusive - Local *LocalEtcd `json:"local,omitempty"` - - // External describes how to connect to an external etcd cluster - // Local and External are mutually exclusive - External *ExternalEtcd `json:"external,omitempty"` -} - -// LocalEtcd describes that kubeadm should run an etcd cluster locally. -type LocalEtcd struct { - // ImageMeta allows to customize the container used for etcd - ImageMeta `json:",inline"` - - // DataDir is the directory etcd will place its data. - // Defaults to "/var/lib/etcd". - // +optional - DataDir string `json:"dataDir,omitempty"` - - // ExtraArgs are extra arguments provided to the etcd binary - // when run inside a static pod. - ExtraArgs map[string]string `json:"extraArgs,omitempty"` - - // ServerCertSANs sets extra Subject Alternative Names for the etcd server signing cert. - ServerCertSANs []string `json:"serverCertSANs,omitempty"` - // PeerCertSANs sets extra Subject Alternative Names for the etcd peer signing cert. - PeerCertSANs []string `json:"peerCertSANs,omitempty"` -} - -// ExternalEtcd describes an external etcd cluster. -// Kubeadm has no knowledge of where certificate files live and they must be supplied. -type ExternalEtcd struct { - // Endpoints of etcd members. Required for ExternalEtcd. - Endpoints []string `json:"endpoints"` - - // CAFile is an SSL Certificate Authority file used to secure etcd communication. - // Required if using a TLS connection. - CAFile string `json:"caFile"` - - // CertFile is an SSL certification file used to secure etcd communication. - // Required if using a TLS connection. - CertFile string `json:"certFile"` - - // KeyFile is an SSL key file used to secure etcd communication. - // Required if using a TLS connection. - KeyFile string `json:"keyFile"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// JoinConfiguration contains elements describing a particular node. -type JoinConfiguration struct { - metav1.TypeMeta `json:",inline"` - - // NodeRegistration holds fields that relate to registering the new control-plane node to the cluster. - // When used in the context of control plane nodes, NodeRegistration should remain consistent - // across both InitConfiguration and JoinConfiguration - // +optional - NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"` - - // CACertPath is the path to the SSL certificate authority used to - // secure comunications between node and control-plane. - // Defaults to "/etc/kubernetes/pki/ca.crt". - // +optional - // TODO: revisit when there is defaulting from k/k - CACertPath string `json:"caCertPath,omitempty"` - - // Discovery specifies the options for the kubelet to use during the TLS Bootstrap process - // +optional - // TODO: revisit when there is defaulting from k/k - Discovery Discovery `json:"discovery,omitempty"` - - // ControlPlane defines the additional control plane instance to be deployed on the joining node. - // If nil, no additional control plane instance will be deployed. - // +optional - ControlPlane *JoinControlPlane `json:"controlPlane,omitempty"` -} - -// JoinControlPlane contains elements describing an additional control plane instance to be deployed on the joining node. -type JoinControlPlane struct { - // LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this node. - LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"` -} - -// Discovery specifies the options for the kubelet to use during the TLS Bootstrap process. -type Discovery struct { - // BootstrapToken is used to set the options for bootstrap token based discovery - // BootstrapToken and File are mutually exclusive - BootstrapToken *BootstrapTokenDiscovery `json:"bootstrapToken,omitempty"` - - // File is used to specify a file or URL to a kubeconfig file from which to load cluster information - // BootstrapToken and File are mutually exclusive - File *FileDiscovery `json:"file,omitempty"` - - // TLSBootstrapToken is a token used for TLS bootstrapping. - // If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, but can be overridden. - // If .File is set, this field **must be set** in case the KubeConfigFile does not contain any other authentication information - // +optional - // TODO: revisit when there is defaulting from k/k - TLSBootstrapToken string `json:"tlsBootstrapToken,omitempty"` - - // Timeout modifies the discovery timeout - Timeout *metav1.Duration `json:"timeout,omitempty"` -} - -// BootstrapTokenDiscovery is used to set the options for bootstrap token based discovery. -type BootstrapTokenDiscovery struct { - // Token is a token used to validate cluster information - // fetched from the control-plane. - Token string `json:"token"` - - // APIServerEndpoint is an IP or domain name to the API server from which info will be fetched. - APIServerEndpoint string `json:"apiServerEndpoint,omitempty"` - - // CACertHashes specifies a set of public key pins to verify - // when token-based discovery is used. The root CA found during discovery - // must match one of these values. Specifying an empty set disables root CA - // pinning, which can be unsafe. Each hash is specified as ":", - // where the only currently supported type is "sha256". This is a hex-encoded - // SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded - // ASN.1. These hashes can be calculated using, for example, OpenSSL: - // openssl x509 -pubkey -in ca.crt openssl rsa -pubin -outform der 2>&/dev/null | openssl dgst -sha256 -hex - CACertHashes []string `json:"caCertHashes,omitempty"` - - // UnsafeSkipCAVerification allows token-based discovery - // without CA verification via CACertHashes. This can weaken - // the security of kubeadm since other nodes can impersonate the control-plane. - UnsafeSkipCAVerification bool `json:"unsafeSkipCAVerification"` -} - -// FileDiscovery is used to specify a file or URL to a kubeconfig file from which to load cluster information. -type FileDiscovery struct { - // KubeConfigPath is used to specify the actual file path or URL to the kubeconfig file from which to load cluster information - KubeConfigPath string `json:"kubeConfigPath"` -} - -// HostPathMount contains elements describing volumes that are mounted from the -// host. -type HostPathMount struct { - // Name of the volume inside the pod template. - Name string `json:"name"` - // HostPath is the path in the host that will be mounted inside - // the pod. - HostPath string `json:"hostPath"` - // MountPath is the path inside the pod where hostPath will be mounted. - MountPath string `json:"mountPath"` - // ReadOnly controls write access to the volume - ReadOnly bool `json:"readOnly,omitempty"` - // PathType is the type of the HostPath. - PathType v1.HostPathType `json:"pathType,omitempty"` -} diff --git a/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go b/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go deleted file mode 100644 index a842e40c6f0d..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/zz_generated.conversion.go +++ /dev/null @@ -1,819 +0,0 @@ -// +build !ignore_autogenerated_kubeadm_bootstrap_v1alpha3 - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1beta1 - -import ( - unsafe "unsafe" - - corev1 "k8s.io/api/core/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - v1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*APIEndpoint)(nil), (*v1alpha4.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(a.(*APIEndpoint), b.(*v1alpha4.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.APIEndpoint)(nil), (*APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(a.(*v1alpha4.APIEndpoint), b.(*APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*APIServer)(nil), (*v1alpha4.APIServer)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_APIServer_To_v1alpha4_APIServer(a.(*APIServer), b.(*v1alpha4.APIServer), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.APIServer)(nil), (*APIServer)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_APIServer_To_v1beta1_APIServer(a.(*v1alpha4.APIServer), b.(*APIServer), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BootstrapToken)(nil), (*v1alpha4.BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BootstrapToken_To_v1alpha4_BootstrapToken(a.(*BootstrapToken), b.(*v1alpha4.BootstrapToken), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.BootstrapToken)(nil), (*BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BootstrapToken_To_v1beta1_BootstrapToken(a.(*v1alpha4.BootstrapToken), b.(*BootstrapToken), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BootstrapTokenDiscovery)(nil), (*v1alpha4.BootstrapTokenDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BootstrapTokenDiscovery_To_v1alpha4_BootstrapTokenDiscovery(a.(*BootstrapTokenDiscovery), b.(*v1alpha4.BootstrapTokenDiscovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.BootstrapTokenDiscovery)(nil), (*BootstrapTokenDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BootstrapTokenDiscovery_To_v1beta1_BootstrapTokenDiscovery(a.(*v1alpha4.BootstrapTokenDiscovery), b.(*BootstrapTokenDiscovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*BootstrapTokenString)(nil), (*v1alpha4.BootstrapTokenString)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_BootstrapTokenString_To_v1alpha4_BootstrapTokenString(a.(*BootstrapTokenString), b.(*v1alpha4.BootstrapTokenString), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.BootstrapTokenString)(nil), (*BootstrapTokenString)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_BootstrapTokenString_To_v1beta1_BootstrapTokenString(a.(*v1alpha4.BootstrapTokenString), b.(*BootstrapTokenString), 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 { - return err - } - if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1alpha4.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(a.(*ClusterStatus), b.(*v1alpha4.ClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(a.(*v1alpha4.ClusterStatus), b.(*ClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ControlPlaneComponent)(nil), (*v1alpha4.ControlPlaneComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(a.(*ControlPlaneComponent), b.(*v1alpha4.ControlPlaneComponent), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.ControlPlaneComponent)(nil), (*ControlPlaneComponent)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(a.(*v1alpha4.ControlPlaneComponent), b.(*ControlPlaneComponent), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.DNS)(nil), (*DNS)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_DNS_To_v1beta1_DNS(a.(*v1alpha4.DNS), b.(*DNS), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Discovery)(nil), (*v1alpha4.Discovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Discovery_To_v1alpha4_Discovery(a.(*Discovery), b.(*v1alpha4.Discovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.Discovery)(nil), (*Discovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Discovery_To_v1beta1_Discovery(a.(*v1alpha4.Discovery), b.(*Discovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Etcd)(nil), (*v1alpha4.Etcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Etcd_To_v1alpha4_Etcd(a.(*Etcd), b.(*v1alpha4.Etcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.Etcd)(nil), (*Etcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Etcd_To_v1beta1_Etcd(a.(*v1alpha4.Etcd), b.(*Etcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ExternalEtcd)(nil), (*v1alpha4.ExternalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ExternalEtcd_To_v1alpha4_ExternalEtcd(a.(*ExternalEtcd), b.(*v1alpha4.ExternalEtcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.ExternalEtcd)(nil), (*ExternalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ExternalEtcd_To_v1beta1_ExternalEtcd(a.(*v1alpha4.ExternalEtcd), b.(*ExternalEtcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*FileDiscovery)(nil), (*v1alpha4.FileDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_FileDiscovery_To_v1alpha4_FileDiscovery(a.(*FileDiscovery), b.(*v1alpha4.FileDiscovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.FileDiscovery)(nil), (*FileDiscovery)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_FileDiscovery_To_v1beta1_FileDiscovery(a.(*v1alpha4.FileDiscovery), b.(*FileDiscovery), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*HostPathMount)(nil), (*v1alpha4.HostPathMount)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_HostPathMount_To_v1alpha4_HostPathMount(a.(*HostPathMount), b.(*v1alpha4.HostPathMount), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.HostPathMount)(nil), (*HostPathMount)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_HostPathMount_To_v1beta1_HostPathMount(a.(*v1alpha4.HostPathMount), b.(*HostPathMount), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ImageMeta)(nil), (*v1alpha4.ImageMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(a.(*ImageMeta), b.(*v1alpha4.ImageMeta), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.ImageMeta)(nil), (*ImageMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(a.(*v1alpha4.ImageMeta), b.(*ImageMeta), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*InitConfiguration)(nil), (*v1alpha4.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(a.(*InitConfiguration), b.(*v1alpha4.InitConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration(a.(*v1alpha4.InitConfiguration), b.(*InitConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*JoinConfiguration)(nil), (*v1alpha4.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(a.(*JoinConfiguration), b.(*v1alpha4.JoinConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration(a.(*v1alpha4.JoinConfiguration), b.(*JoinConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*JoinControlPlane)(nil), (*v1alpha4.JoinControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_JoinControlPlane_To_v1alpha4_JoinControlPlane(a.(*JoinControlPlane), b.(*v1alpha4.JoinControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.JoinControlPlane)(nil), (*JoinControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_JoinControlPlane_To_v1beta1_JoinControlPlane(a.(*v1alpha4.JoinControlPlane), b.(*JoinControlPlane), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*LocalEtcd)(nil), (*v1alpha4.LocalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(a.(*LocalEtcd), b.(*v1alpha4.LocalEtcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.LocalEtcd)(nil), (*LocalEtcd)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_LocalEtcd_To_v1beta1_LocalEtcd(a.(*v1alpha4.LocalEtcd), b.(*LocalEtcd), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Networking)(nil), (*v1alpha4.Networking)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_Networking_To_v1alpha4_Networking(a.(*Networking), b.(*v1alpha4.Networking), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.Networking)(nil), (*Networking)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_Networking_To_v1beta1_Networking(a.(*v1alpha4.Networking), b.(*Networking), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*NodeRegistrationOptions)(nil), (*v1alpha4.NodeRegistrationOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(a.(*NodeRegistrationOptions), b.(*v1alpha4.NodeRegistrationOptions), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha4.NodeRegistrationOptions)(nil), (*NodeRegistrationOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(a.(*v1alpha4.NodeRegistrationOptions), b.(*NodeRegistrationOptions), scope) - }); 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 { - return err - } - return nil -} - -func autoConvert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { - out.AdvertiseAddress = in.AdvertiseAddress - out.BindPort = in.BindPort - return nil -} - -// Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint is an autogenerated conversion function. -func Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { - return autoConvert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(in, out, s) -} - -func autoConvert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { - out.AdvertiseAddress = in.AdvertiseAddress - out.BindPort = in.BindPort - return nil -} - -// Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint is an autogenerated conversion function. -func Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { - return autoConvert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(in, out, s) -} - -func autoConvert_v1beta1_APIServer_To_v1alpha4_APIServer(in *APIServer, out *v1alpha4.APIServer, s conversion.Scope) error { - if err := Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(&in.ControlPlaneComponent, &out.ControlPlaneComponent, s); err != nil { - return err - } - out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs)) - out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane)) - return nil -} - -// Convert_v1beta1_APIServer_To_v1alpha4_APIServer is an autogenerated conversion function. -func Convert_v1beta1_APIServer_To_v1alpha4_APIServer(in *APIServer, out *v1alpha4.APIServer, s conversion.Scope) error { - return autoConvert_v1beta1_APIServer_To_v1alpha4_APIServer(in, out, s) -} - -func autoConvert_v1alpha4_APIServer_To_v1beta1_APIServer(in *v1alpha4.APIServer, out *APIServer, s conversion.Scope) error { - if err := Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(&in.ControlPlaneComponent, &out.ControlPlaneComponent, s); err != nil { - return err - } - out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs)) - out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane)) - return nil -} - -// Convert_v1alpha4_APIServer_To_v1beta1_APIServer is an autogenerated conversion function. -func Convert_v1alpha4_APIServer_To_v1beta1_APIServer(in *v1alpha4.APIServer, out *APIServer, s conversion.Scope) error { - return autoConvert_v1alpha4_APIServer_To_v1beta1_APIServer(in, out, s) -} - -func autoConvert_v1beta1_BootstrapToken_To_v1alpha4_BootstrapToken(in *BootstrapToken, out *v1alpha4.BootstrapToken, s conversion.Scope) error { - out.Token = (*v1alpha4.BootstrapTokenString)(unsafe.Pointer(in.Token)) - out.Description = in.Description - out.TTL = (*v1.Duration)(unsafe.Pointer(in.TTL)) - out.Expires = (*v1.Time)(unsafe.Pointer(in.Expires)) - out.Usages = *(*[]string)(unsafe.Pointer(&in.Usages)) - out.Groups = *(*[]string)(unsafe.Pointer(&in.Groups)) - return nil -} - -// Convert_v1beta1_BootstrapToken_To_v1alpha4_BootstrapToken is an autogenerated conversion function. -func Convert_v1beta1_BootstrapToken_To_v1alpha4_BootstrapToken(in *BootstrapToken, out *v1alpha4.BootstrapToken, s conversion.Scope) error { - return autoConvert_v1beta1_BootstrapToken_To_v1alpha4_BootstrapToken(in, out, s) -} - -func autoConvert_v1alpha4_BootstrapToken_To_v1beta1_BootstrapToken(in *v1alpha4.BootstrapToken, out *BootstrapToken, s conversion.Scope) error { - out.Token = (*BootstrapTokenString)(unsafe.Pointer(in.Token)) - out.Description = in.Description - out.TTL = (*v1.Duration)(unsafe.Pointer(in.TTL)) - out.Expires = (*v1.Time)(unsafe.Pointer(in.Expires)) - out.Usages = *(*[]string)(unsafe.Pointer(&in.Usages)) - out.Groups = *(*[]string)(unsafe.Pointer(&in.Groups)) - return nil -} - -// Convert_v1alpha4_BootstrapToken_To_v1beta1_BootstrapToken is an autogenerated conversion function. -func Convert_v1alpha4_BootstrapToken_To_v1beta1_BootstrapToken(in *v1alpha4.BootstrapToken, out *BootstrapToken, s conversion.Scope) error { - return autoConvert_v1alpha4_BootstrapToken_To_v1beta1_BootstrapToken(in, out, s) -} - -func autoConvert_v1beta1_BootstrapTokenDiscovery_To_v1alpha4_BootstrapTokenDiscovery(in *BootstrapTokenDiscovery, out *v1alpha4.BootstrapTokenDiscovery, s conversion.Scope) error { - out.Token = in.Token - out.APIServerEndpoint = in.APIServerEndpoint - out.CACertHashes = *(*[]string)(unsafe.Pointer(&in.CACertHashes)) - out.UnsafeSkipCAVerification = in.UnsafeSkipCAVerification - return nil -} - -// Convert_v1beta1_BootstrapTokenDiscovery_To_v1alpha4_BootstrapTokenDiscovery is an autogenerated conversion function. -func Convert_v1beta1_BootstrapTokenDiscovery_To_v1alpha4_BootstrapTokenDiscovery(in *BootstrapTokenDiscovery, out *v1alpha4.BootstrapTokenDiscovery, s conversion.Scope) error { - return autoConvert_v1beta1_BootstrapTokenDiscovery_To_v1alpha4_BootstrapTokenDiscovery(in, out, s) -} - -func autoConvert_v1alpha4_BootstrapTokenDiscovery_To_v1beta1_BootstrapTokenDiscovery(in *v1alpha4.BootstrapTokenDiscovery, out *BootstrapTokenDiscovery, s conversion.Scope) error { - out.Token = in.Token - out.APIServerEndpoint = in.APIServerEndpoint - out.CACertHashes = *(*[]string)(unsafe.Pointer(&in.CACertHashes)) - out.UnsafeSkipCAVerification = in.UnsafeSkipCAVerification - return nil -} - -// Convert_v1alpha4_BootstrapTokenDiscovery_To_v1beta1_BootstrapTokenDiscovery is an autogenerated conversion function. -func Convert_v1alpha4_BootstrapTokenDiscovery_To_v1beta1_BootstrapTokenDiscovery(in *v1alpha4.BootstrapTokenDiscovery, out *BootstrapTokenDiscovery, s conversion.Scope) error { - return autoConvert_v1alpha4_BootstrapTokenDiscovery_To_v1beta1_BootstrapTokenDiscovery(in, out, s) -} - -func autoConvert_v1beta1_BootstrapTokenString_To_v1alpha4_BootstrapTokenString(in *BootstrapTokenString, out *v1alpha4.BootstrapTokenString, s conversion.Scope) error { - out.ID = in.ID - out.Secret = in.Secret - return nil -} - -// Convert_v1beta1_BootstrapTokenString_To_v1alpha4_BootstrapTokenString is an autogenerated conversion function. -func Convert_v1beta1_BootstrapTokenString_To_v1alpha4_BootstrapTokenString(in *BootstrapTokenString, out *v1alpha4.BootstrapTokenString, s conversion.Scope) error { - return autoConvert_v1beta1_BootstrapTokenString_To_v1alpha4_BootstrapTokenString(in, out, s) -} - -func autoConvert_v1alpha4_BootstrapTokenString_To_v1beta1_BootstrapTokenString(in *v1alpha4.BootstrapTokenString, out *BootstrapTokenString, s conversion.Scope) error { - out.ID = in.ID - out.Secret = in.Secret - return nil -} - -// Convert_v1alpha4_BootstrapTokenString_To_v1beta1_BootstrapTokenString is an autogenerated conversion function. -func Convert_v1alpha4_BootstrapTokenString_To_v1beta1_BootstrapTokenString(in *v1alpha4.BootstrapTokenString, out *BootstrapTokenString, s conversion.Scope) error { - return autoConvert_v1alpha4_BootstrapTokenString_To_v1beta1_BootstrapTokenString(in, out, s) -} - -func autoConvert_v1beta1_ClusterConfiguration_To_v1alpha4_ClusterConfiguration(in *ClusterConfiguration, out *v1alpha4.ClusterConfiguration, s conversion.Scope) error { - if err := Convert_v1beta1_Etcd_To_v1alpha4_Etcd(&in.Etcd, &out.Etcd, s); err != nil { - return err - } - if err := Convert_v1beta1_Networking_To_v1alpha4_Networking(&in.Networking, &out.Networking, s); err != nil { - return err - } - out.KubernetesVersion = in.KubernetesVersion - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if err := Convert_v1beta1_APIServer_To_v1alpha4_APIServer(&in.APIServer, &out.APIServer, s); err != nil { - return err - } - if err := Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(&in.ControllerManager, &out.ControllerManager, s); err != nil { - return err - } - if err := Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(&in.Scheduler, &out.Scheduler, s); err != nil { - return err - } - if err := Convert_v1beta1_DNS_To_v1alpha4_DNS(&in.DNS, &out.DNS, s); err != nil { - return err - } - out.CertificatesDir = in.CertificatesDir - out.ImageRepository = in.ImageRepository - // 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 -} - -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 - } - if err := Convert_v1alpha4_Networking_To_v1beta1_Networking(&in.Networking, &out.Networking, s); err != nil { - return err - } - out.KubernetesVersion = in.KubernetesVersion - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if err := Convert_v1alpha4_APIServer_To_v1beta1_APIServer(&in.APIServer, &out.APIServer, s); err != nil { - return err - } - if err := Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(&in.ControllerManager, &out.ControllerManager, s); err != nil { - return err - } - if err := Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(&in.Scheduler, &out.Scheduler, s); err != nil { - return err - } - if err := Convert_v1alpha4_DNS_To_v1beta1_DNS(&in.DNS, &out.DNS, s); err != nil { - return err - } - out.CertificatesDir = in.CertificatesDir - out.ImageRepository = in.ImageRepository - out.FeatureGates = *(*map[string]bool)(unsafe.Pointer(&in.FeatureGates)) - out.ClusterName = in.ClusterName - return nil -} - -// Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration is an autogenerated conversion function. -func Convert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in *v1alpha4.ClusterConfiguration, out *ClusterConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha4_ClusterConfiguration_To_v1beta1_ClusterConfiguration(in, out, s) -} - -func autoConvert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in *ClusterStatus, out *v1alpha4.ClusterStatus, s conversion.Scope) error { - out.APIEndpoints = *(*map[string]v1alpha4.APIEndpoint)(unsafe.Pointer(&in.APIEndpoints)) - return nil -} - -// Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in *ClusterStatus, out *v1alpha4.ClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in, out, s) -} - -func autoConvert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(in *v1alpha4.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { - out.APIEndpoints = *(*map[string]APIEndpoint)(unsafe.Pointer(&in.APIEndpoints)) - return nil -} - -// Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus is an autogenerated conversion function. -func Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(in *v1alpha4.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { - return autoConvert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(in, out, s) -} - -func autoConvert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(in *ControlPlaneComponent, out *v1alpha4.ControlPlaneComponent, s conversion.Scope) error { - out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) - out.ExtraVolumes = *(*[]v1alpha4.HostPathMount)(unsafe.Pointer(&in.ExtraVolumes)) - return nil -} - -// Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent is an autogenerated conversion function. -func Convert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(in *ControlPlaneComponent, out *v1alpha4.ControlPlaneComponent, s conversion.Scope) error { - return autoConvert_v1beta1_ControlPlaneComponent_To_v1alpha4_ControlPlaneComponent(in, out, s) -} - -func autoConvert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(in *v1alpha4.ControlPlaneComponent, out *ControlPlaneComponent, s conversion.Scope) error { - out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) - out.ExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.ExtraVolumes)) - return nil -} - -// Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent is an autogenerated conversion function. -func Convert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(in *v1alpha4.ControlPlaneComponent, out *ControlPlaneComponent, s conversion.Scope) error { - return autoConvert_v1alpha4_ControlPlaneComponent_To_v1beta1_ControlPlaneComponent(in, out, s) -} - -func autoConvert_v1beta1_DNS_To_v1alpha4_DNS(in *DNS, out *v1alpha4.DNS, s conversion.Scope) error { - // WARNING: in.Type requires manual conversion: does not exist in peer-type - if err := Convert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha4_DNS_To_v1beta1_DNS(in *v1alpha4.DNS, out *DNS, s conversion.Scope) error { - if err := Convert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_DNS_To_v1beta1_DNS is an autogenerated conversion function. -func Convert_v1alpha4_DNS_To_v1beta1_DNS(in *v1alpha4.DNS, out *DNS, s conversion.Scope) error { - return autoConvert_v1alpha4_DNS_To_v1beta1_DNS(in, out, s) -} - -func autoConvert_v1beta1_Discovery_To_v1alpha4_Discovery(in *Discovery, out *v1alpha4.Discovery, s conversion.Scope) error { - out.BootstrapToken = (*v1alpha4.BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken)) - out.File = (*v1alpha4.FileDiscovery)(unsafe.Pointer(in.File)) - out.TLSBootstrapToken = in.TLSBootstrapToken - out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout)) - return nil -} - -// Convert_v1beta1_Discovery_To_v1alpha4_Discovery is an autogenerated conversion function. -func Convert_v1beta1_Discovery_To_v1alpha4_Discovery(in *Discovery, out *v1alpha4.Discovery, s conversion.Scope) error { - return autoConvert_v1beta1_Discovery_To_v1alpha4_Discovery(in, out, s) -} - -func autoConvert_v1alpha4_Discovery_To_v1beta1_Discovery(in *v1alpha4.Discovery, out *Discovery, s conversion.Scope) error { - out.BootstrapToken = (*BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken)) - out.File = (*FileDiscovery)(unsafe.Pointer(in.File)) - out.TLSBootstrapToken = in.TLSBootstrapToken - out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout)) - return nil -} - -// Convert_v1alpha4_Discovery_To_v1beta1_Discovery is an autogenerated conversion function. -func Convert_v1alpha4_Discovery_To_v1beta1_Discovery(in *v1alpha4.Discovery, out *Discovery, s conversion.Scope) error { - return autoConvert_v1alpha4_Discovery_To_v1beta1_Discovery(in, out, s) -} - -func autoConvert_v1beta1_Etcd_To_v1alpha4_Etcd(in *Etcd, out *v1alpha4.Etcd, s conversion.Scope) error { - out.Local = (*v1alpha4.LocalEtcd)(unsafe.Pointer(in.Local)) - out.External = (*v1alpha4.ExternalEtcd)(unsafe.Pointer(in.External)) - return nil -} - -// Convert_v1beta1_Etcd_To_v1alpha4_Etcd is an autogenerated conversion function. -func Convert_v1beta1_Etcd_To_v1alpha4_Etcd(in *Etcd, out *v1alpha4.Etcd, s conversion.Scope) error { - return autoConvert_v1beta1_Etcd_To_v1alpha4_Etcd(in, out, s) -} - -func autoConvert_v1alpha4_Etcd_To_v1beta1_Etcd(in *v1alpha4.Etcd, out *Etcd, s conversion.Scope) error { - out.Local = (*LocalEtcd)(unsafe.Pointer(in.Local)) - out.External = (*ExternalEtcd)(unsafe.Pointer(in.External)) - return nil -} - -// Convert_v1alpha4_Etcd_To_v1beta1_Etcd is an autogenerated conversion function. -func Convert_v1alpha4_Etcd_To_v1beta1_Etcd(in *v1alpha4.Etcd, out *Etcd, s conversion.Scope) error { - return autoConvert_v1alpha4_Etcd_To_v1beta1_Etcd(in, out, s) -} - -func autoConvert_v1beta1_ExternalEtcd_To_v1alpha4_ExternalEtcd(in *ExternalEtcd, out *v1alpha4.ExternalEtcd, s conversion.Scope) error { - out.Endpoints = *(*[]string)(unsafe.Pointer(&in.Endpoints)) - out.CAFile = in.CAFile - out.CertFile = in.CertFile - out.KeyFile = in.KeyFile - return nil -} - -// Convert_v1beta1_ExternalEtcd_To_v1alpha4_ExternalEtcd is an autogenerated conversion function. -func Convert_v1beta1_ExternalEtcd_To_v1alpha4_ExternalEtcd(in *ExternalEtcd, out *v1alpha4.ExternalEtcd, s conversion.Scope) error { - return autoConvert_v1beta1_ExternalEtcd_To_v1alpha4_ExternalEtcd(in, out, s) -} - -func autoConvert_v1alpha4_ExternalEtcd_To_v1beta1_ExternalEtcd(in *v1alpha4.ExternalEtcd, out *ExternalEtcd, s conversion.Scope) error { - out.Endpoints = *(*[]string)(unsafe.Pointer(&in.Endpoints)) - out.CAFile = in.CAFile - out.CertFile = in.CertFile - out.KeyFile = in.KeyFile - return nil -} - -// Convert_v1alpha4_ExternalEtcd_To_v1beta1_ExternalEtcd is an autogenerated conversion function. -func Convert_v1alpha4_ExternalEtcd_To_v1beta1_ExternalEtcd(in *v1alpha4.ExternalEtcd, out *ExternalEtcd, s conversion.Scope) error { - return autoConvert_v1alpha4_ExternalEtcd_To_v1beta1_ExternalEtcd(in, out, s) -} - -func autoConvert_v1beta1_FileDiscovery_To_v1alpha4_FileDiscovery(in *FileDiscovery, out *v1alpha4.FileDiscovery, s conversion.Scope) error { - out.KubeConfigPath = in.KubeConfigPath - return nil -} - -// Convert_v1beta1_FileDiscovery_To_v1alpha4_FileDiscovery is an autogenerated conversion function. -func Convert_v1beta1_FileDiscovery_To_v1alpha4_FileDiscovery(in *FileDiscovery, out *v1alpha4.FileDiscovery, s conversion.Scope) error { - return autoConvert_v1beta1_FileDiscovery_To_v1alpha4_FileDiscovery(in, out, s) -} - -func autoConvert_v1alpha4_FileDiscovery_To_v1beta1_FileDiscovery(in *v1alpha4.FileDiscovery, out *FileDiscovery, s conversion.Scope) error { - out.KubeConfigPath = in.KubeConfigPath - return nil -} - -// Convert_v1alpha4_FileDiscovery_To_v1beta1_FileDiscovery is an autogenerated conversion function. -func Convert_v1alpha4_FileDiscovery_To_v1beta1_FileDiscovery(in *v1alpha4.FileDiscovery, out *FileDiscovery, s conversion.Scope) error { - return autoConvert_v1alpha4_FileDiscovery_To_v1beta1_FileDiscovery(in, out, s) -} - -func autoConvert_v1beta1_HostPathMount_To_v1alpha4_HostPathMount(in *HostPathMount, out *v1alpha4.HostPathMount, s conversion.Scope) error { - out.Name = in.Name - out.HostPath = in.HostPath - out.MountPath = in.MountPath - out.ReadOnly = in.ReadOnly - out.PathType = corev1.HostPathType(in.PathType) - return nil -} - -// Convert_v1beta1_HostPathMount_To_v1alpha4_HostPathMount is an autogenerated conversion function. -func Convert_v1beta1_HostPathMount_To_v1alpha4_HostPathMount(in *HostPathMount, out *v1alpha4.HostPathMount, s conversion.Scope) error { - return autoConvert_v1beta1_HostPathMount_To_v1alpha4_HostPathMount(in, out, s) -} - -func autoConvert_v1alpha4_HostPathMount_To_v1beta1_HostPathMount(in *v1alpha4.HostPathMount, out *HostPathMount, s conversion.Scope) error { - out.Name = in.Name - out.HostPath = in.HostPath - out.MountPath = in.MountPath - out.ReadOnly = in.ReadOnly - out.PathType = corev1.HostPathType(in.PathType) - return nil -} - -// Convert_v1alpha4_HostPathMount_To_v1beta1_HostPathMount is an autogenerated conversion function. -func Convert_v1alpha4_HostPathMount_To_v1beta1_HostPathMount(in *v1alpha4.HostPathMount, out *HostPathMount, s conversion.Scope) error { - return autoConvert_v1alpha4_HostPathMount_To_v1beta1_HostPathMount(in, out, s) -} - -func autoConvert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(in *ImageMeta, out *v1alpha4.ImageMeta, s conversion.Scope) error { - out.ImageRepository = in.ImageRepository - out.ImageTag = in.ImageTag - return nil -} - -// Convert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta is an autogenerated conversion function. -func Convert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(in *ImageMeta, out *v1alpha4.ImageMeta, s conversion.Scope) error { - return autoConvert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(in, out, s) -} - -func autoConvert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(in *v1alpha4.ImageMeta, out *ImageMeta, s conversion.Scope) error { - out.ImageRepository = in.ImageRepository - out.ImageTag = in.ImageTag - return nil -} - -// Convert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta is an autogenerated conversion function. -func Convert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(in *v1alpha4.ImageMeta, out *ImageMeta, s conversion.Scope) error { - return autoConvert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(in, out, s) -} - -func autoConvert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in *InitConfiguration, out *v1alpha4.InitConfiguration, s conversion.Scope) error { - out.BootstrapTokens = *(*[]v1alpha4.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) - if err := Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { - return err - } - if err := Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration is an autogenerated conversion function. -func Convert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in *InitConfiguration, out *v1alpha4.InitConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_InitConfiguration_To_v1alpha4_InitConfiguration(in, out, s) -} - -func autoConvert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration(in *v1alpha4.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { - out.BootstrapTokens = *(*[]BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens)) - if err := Convert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { - return err - } - if err := Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration is an autogenerated conversion function. -func Convert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration(in *v1alpha4.InitConfiguration, out *InitConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha4_InitConfiguration_To_v1beta1_InitConfiguration(in, out, s) -} - -func autoConvert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *JoinConfiguration, out *v1alpha4.JoinConfiguration, s conversion.Scope) error { - if err := Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { - return err - } - out.CACertPath = in.CACertPath - if err := Convert_v1beta1_Discovery_To_v1alpha4_Discovery(&in.Discovery, &out.Discovery, s); err != nil { - return err - } - out.ControlPlane = (*v1alpha4.JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) - return nil -} - -// Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration is an autogenerated conversion function. -func Convert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in *JoinConfiguration, out *v1alpha4.JoinConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_JoinConfiguration_To_v1alpha4_JoinConfiguration(in, out, s) -} - -func autoConvert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration(in *v1alpha4.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error { - if err := Convert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil { - return err - } - out.CACertPath = in.CACertPath - if err := Convert_v1alpha4_Discovery_To_v1beta1_Discovery(&in.Discovery, &out.Discovery, s); err != nil { - return err - } - out.ControlPlane = (*JoinControlPlane)(unsafe.Pointer(in.ControlPlane)) - return nil -} - -// Convert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration is an autogenerated conversion function. -func Convert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration(in *v1alpha4.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha4_JoinConfiguration_To_v1beta1_JoinConfiguration(in, out, s) -} - -func autoConvert_v1beta1_JoinControlPlane_To_v1alpha4_JoinControlPlane(in *JoinControlPlane, out *v1alpha4.JoinControlPlane, s conversion.Scope) error { - if err := Convert_v1beta1_APIEndpoint_To_v1alpha4_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_JoinControlPlane_To_v1alpha4_JoinControlPlane is an autogenerated conversion function. -func Convert_v1beta1_JoinControlPlane_To_v1alpha4_JoinControlPlane(in *JoinControlPlane, out *v1alpha4.JoinControlPlane, s conversion.Scope) error { - return autoConvert_v1beta1_JoinControlPlane_To_v1alpha4_JoinControlPlane(in, out, s) -} - -func autoConvert_v1alpha4_JoinControlPlane_To_v1beta1_JoinControlPlane(in *v1alpha4.JoinControlPlane, out *JoinControlPlane, s conversion.Scope) error { - if err := Convert_v1alpha4_APIEndpoint_To_v1beta1_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha4_JoinControlPlane_To_v1beta1_JoinControlPlane is an autogenerated conversion function. -func Convert_v1alpha4_JoinControlPlane_To_v1beta1_JoinControlPlane(in *v1alpha4.JoinControlPlane, out *JoinControlPlane, s conversion.Scope) error { - return autoConvert_v1alpha4_JoinControlPlane_To_v1beta1_JoinControlPlane(in, out, s) -} - -func autoConvert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(in *LocalEtcd, out *v1alpha4.LocalEtcd, s conversion.Scope) error { - if err := Convert_v1beta1_ImageMeta_To_v1alpha4_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { - return err - } - out.DataDir = in.DataDir - out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) - out.ServerCertSANs = *(*[]string)(unsafe.Pointer(&in.ServerCertSANs)) - out.PeerCertSANs = *(*[]string)(unsafe.Pointer(&in.PeerCertSANs)) - return nil -} - -// Convert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd is an autogenerated conversion function. -func Convert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(in *LocalEtcd, out *v1alpha4.LocalEtcd, s conversion.Scope) error { - return autoConvert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(in, out, s) -} - -func autoConvert_v1alpha4_LocalEtcd_To_v1beta1_LocalEtcd(in *v1alpha4.LocalEtcd, out *LocalEtcd, s conversion.Scope) error { - if err := Convert_v1alpha4_ImageMeta_To_v1beta1_ImageMeta(&in.ImageMeta, &out.ImageMeta, s); err != nil { - return err - } - out.DataDir = in.DataDir - out.ExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.ExtraArgs)) - out.ServerCertSANs = *(*[]string)(unsafe.Pointer(&in.ServerCertSANs)) - out.PeerCertSANs = *(*[]string)(unsafe.Pointer(&in.PeerCertSANs)) - return nil -} - -// Convert_v1alpha4_LocalEtcd_To_v1beta1_LocalEtcd is an autogenerated conversion function. -func Convert_v1alpha4_LocalEtcd_To_v1beta1_LocalEtcd(in *v1alpha4.LocalEtcd, out *LocalEtcd, s conversion.Scope) error { - return autoConvert_v1alpha4_LocalEtcd_To_v1beta1_LocalEtcd(in, out, s) -} - -func autoConvert_v1beta1_Networking_To_v1alpha4_Networking(in *Networking, out *v1alpha4.Networking, s conversion.Scope) error { - out.ServiceSubnet = in.ServiceSubnet - out.PodSubnet = in.PodSubnet - out.DNSDomain = in.DNSDomain - return nil -} - -// Convert_v1beta1_Networking_To_v1alpha4_Networking is an autogenerated conversion function. -func Convert_v1beta1_Networking_To_v1alpha4_Networking(in *Networking, out *v1alpha4.Networking, s conversion.Scope) error { - return autoConvert_v1beta1_Networking_To_v1alpha4_Networking(in, out, s) -} - -func autoConvert_v1alpha4_Networking_To_v1beta1_Networking(in *v1alpha4.Networking, out *Networking, s conversion.Scope) error { - out.ServiceSubnet = in.ServiceSubnet - out.PodSubnet = in.PodSubnet - out.DNSDomain = in.DNSDomain - return nil -} - -// Convert_v1alpha4_Networking_To_v1beta1_Networking is an autogenerated conversion function. -func Convert_v1alpha4_Networking_To_v1beta1_Networking(in *v1alpha4.Networking, out *Networking, s conversion.Scope) error { - return autoConvert_v1alpha4_Networking_To_v1beta1_Networking(in, out, s) -} - -func autoConvert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in *NodeRegistrationOptions, out *v1alpha4.NodeRegistrationOptions, s conversion.Scope) error { - out.Name = in.Name - out.CRISocket = in.CRISocket - out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) - out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) - return nil -} - -// Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions is an autogenerated conversion function. -func Convert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in *NodeRegistrationOptions, out *v1alpha4.NodeRegistrationOptions, s conversion.Scope) error { - return autoConvert_v1beta1_NodeRegistrationOptions_To_v1alpha4_NodeRegistrationOptions(in, out, s) -} - -func autoConvert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(in *v1alpha4.NodeRegistrationOptions, out *NodeRegistrationOptions, s conversion.Scope) error { - out.Name = in.Name - out.CRISocket = in.CRISocket - out.Taints = *(*[]corev1.Taint)(unsafe.Pointer(&in.Taints)) - out.KubeletExtraArgs = *(*map[string]string)(unsafe.Pointer(&in.KubeletExtraArgs)) - return nil -} - -// Convert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions is an autogenerated conversion function. -func Convert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(in *v1alpha4.NodeRegistrationOptions, out *NodeRegistrationOptions, s conversion.Scope) error { - return autoConvert_v1alpha4_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(in, out, s) -} diff --git a/bootstrap/kubeadm/types/v1beta1/zz_generated.deepcopy.go b/bootstrap/kubeadm/types/v1beta1/zz_generated.deepcopy.go deleted file mode 100644 index 622c19612172..000000000000 --- a/bootstrap/kubeadm/types/v1beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,530 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta1 - -import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIEndpoint) DeepCopyInto(out *APIEndpoint) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIEndpoint. -func (in *APIEndpoint) DeepCopy() *APIEndpoint { - if in == nil { - return nil - } - out := new(APIEndpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIServer) DeepCopyInto(out *APIServer) { - *out = *in - in.ControlPlaneComponent.DeepCopyInto(&out.ControlPlaneComponent) - if in.CertSANs != nil { - in, out := &in.CertSANs, &out.CertSANs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.TimeoutForControlPlane != nil { - in, out := &in.TimeoutForControlPlane, &out.TimeoutForControlPlane - *out = new(v1.Duration) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIServer. -func (in *APIServer) DeepCopy() *APIServer { - if in == nil { - return nil - } - out := new(APIServer) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BootstrapToken) DeepCopyInto(out *BootstrapToken) { - *out = *in - if in.Token != nil { - in, out := &in.Token, &out.Token - *out = new(BootstrapTokenString) - **out = **in - } - if in.TTL != nil { - in, out := &in.TTL, &out.TTL - *out = new(v1.Duration) - **out = **in - } - if in.Expires != nil { - in, out := &in.Expires, &out.Expires - *out = (*in).DeepCopy() - } - if in.Usages != nil { - in, out := &in.Usages, &out.Usages - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Groups != nil { - in, out := &in.Groups, &out.Groups - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapToken. -func (in *BootstrapToken) DeepCopy() *BootstrapToken { - if in == nil { - return nil - } - out := new(BootstrapToken) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BootstrapTokenDiscovery) DeepCopyInto(out *BootstrapTokenDiscovery) { - *out = *in - if in.CACertHashes != nil { - in, out := &in.CACertHashes, &out.CACertHashes - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapTokenDiscovery. -func (in *BootstrapTokenDiscovery) DeepCopy() *BootstrapTokenDiscovery { - if in == nil { - return nil - } - out := new(BootstrapTokenDiscovery) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BootstrapTokenString) DeepCopyInto(out *BootstrapTokenString) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapTokenString. -func (in *BootstrapTokenString) DeepCopy() *BootstrapTokenString { - if in == nil { - return nil - } - out := new(BootstrapTokenString) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterConfiguration) DeepCopyInto(out *ClusterConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - in.Etcd.DeepCopyInto(&out.Etcd) - out.Networking = in.Networking - in.APIServer.DeepCopyInto(&out.APIServer) - in.ControllerManager.DeepCopyInto(&out.ControllerManager) - in.Scheduler.DeepCopyInto(&out.Scheduler) - out.DNS = in.DNS - if in.FeatureGates != nil { - in, out := &in.FeatureGates, &out.FeatureGates - *out = make(map[string]bool, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConfiguration. -func (in *ClusterConfiguration) DeepCopy() *ClusterConfiguration { - if in == nil { - return nil - } - out := new(ClusterConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterConfiguration) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { - *out = *in - out.TypeMeta = in.TypeMeta - if in.APIEndpoints != nil { - in, out := &in.APIEndpoints, &out.APIEndpoints - *out = make(map[string]APIEndpoint, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. -func (in *ClusterStatus) DeepCopy() *ClusterStatus { - if in == nil { - return nil - } - out := new(ClusterStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterStatus) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneComponent) DeepCopyInto(out *ControlPlaneComponent) { - *out = *in - if in.ExtraArgs != nil { - in, out := &in.ExtraArgs, &out.ExtraArgs - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ExtraVolumes != nil { - in, out := &in.ExtraVolumes, &out.ExtraVolumes - *out = make([]HostPathMount, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneComponent. -func (in *ControlPlaneComponent) DeepCopy() *ControlPlaneComponent { - if in == nil { - return nil - } - out := new(ControlPlaneComponent) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DNS) DeepCopyInto(out *DNS) { - *out = *in - out.ImageMeta = in.ImageMeta -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNS. -func (in *DNS) DeepCopy() *DNS { - if in == nil { - return nil - } - out := new(DNS) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Discovery) DeepCopyInto(out *Discovery) { - *out = *in - if in.BootstrapToken != nil { - in, out := &in.BootstrapToken, &out.BootstrapToken - *out = new(BootstrapTokenDiscovery) - (*in).DeepCopyInto(*out) - } - if in.File != nil { - in, out := &in.File, &out.File - *out = new(FileDiscovery) - **out = **in - } - if in.Timeout != nil { - in, out := &in.Timeout, &out.Timeout - *out = new(v1.Duration) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Discovery. -func (in *Discovery) DeepCopy() *Discovery { - if in == nil { - return nil - } - out := new(Discovery) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Etcd) DeepCopyInto(out *Etcd) { - *out = *in - if in.Local != nil { - in, out := &in.Local, &out.Local - *out = new(LocalEtcd) - (*in).DeepCopyInto(*out) - } - if in.External != nil { - in, out := &in.External, &out.External - *out = new(ExternalEtcd) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Etcd. -func (in *Etcd) DeepCopy() *Etcd { - if in == nil { - return nil - } - out := new(Etcd) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalEtcd) DeepCopyInto(out *ExternalEtcd) { - *out = *in - if in.Endpoints != nil { - in, out := &in.Endpoints, &out.Endpoints - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalEtcd. -func (in *ExternalEtcd) DeepCopy() *ExternalEtcd { - if in == nil { - return nil - } - out := new(ExternalEtcd) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FileDiscovery) DeepCopyInto(out *FileDiscovery) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileDiscovery. -func (in *FileDiscovery) DeepCopy() *FileDiscovery { - if in == nil { - return nil - } - out := new(FileDiscovery) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HostPathMount) DeepCopyInto(out *HostPathMount) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HostPathMount. -func (in *HostPathMount) DeepCopy() *HostPathMount { - if in == nil { - return nil - } - out := new(HostPathMount) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ImageMeta) DeepCopyInto(out *ImageMeta) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageMeta. -func (in *ImageMeta) DeepCopy() *ImageMeta { - if in == nil { - return nil - } - out := new(ImageMeta) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - if in.BootstrapTokens != nil { - in, out := &in.BootstrapTokens, &out.BootstrapTokens - *out = make([]BootstrapToken, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.NodeRegistration.DeepCopyInto(&out.NodeRegistration) - out.LocalAPIEndpoint = in.LocalAPIEndpoint -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitConfiguration. -func (in *InitConfiguration) DeepCopy() *InitConfiguration { - if in == nil { - return nil - } - out := new(InitConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InitConfiguration) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JoinConfiguration) DeepCopyInto(out *JoinConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - in.NodeRegistration.DeepCopyInto(&out.NodeRegistration) - in.Discovery.DeepCopyInto(&out.Discovery) - if in.ControlPlane != nil { - in, out := &in.ControlPlane, &out.ControlPlane - *out = new(JoinControlPlane) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JoinConfiguration. -func (in *JoinConfiguration) DeepCopy() *JoinConfiguration { - if in == nil { - return nil - } - out := new(JoinConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *JoinConfiguration) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *JoinControlPlane) DeepCopyInto(out *JoinControlPlane) { - *out = *in - out.LocalAPIEndpoint = in.LocalAPIEndpoint -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JoinControlPlane. -func (in *JoinControlPlane) DeepCopy() *JoinControlPlane { - if in == nil { - return nil - } - out := new(JoinControlPlane) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LocalEtcd) DeepCopyInto(out *LocalEtcd) { - *out = *in - out.ImageMeta = in.ImageMeta - if in.ExtraArgs != nil { - in, out := &in.ExtraArgs, &out.ExtraArgs - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.ServerCertSANs != nil { - in, out := &in.ServerCertSANs, &out.ServerCertSANs - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.PeerCertSANs != nil { - in, out := &in.PeerCertSANs, &out.PeerCertSANs - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalEtcd. -func (in *LocalEtcd) DeepCopy() *LocalEtcd { - if in == nil { - return nil - } - out := new(LocalEtcd) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Networking) DeepCopyInto(out *Networking) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Networking. -func (in *Networking) DeepCopy() *Networking { - if in == nil { - return nil - } - out := new(Networking) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeRegistrationOptions) DeepCopyInto(out *NodeRegistrationOptions) { - *out = *in - if in.Taints != nil { - in, out := &in.Taints, &out.Taints - *out = make([]corev1.Taint, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.KubeletExtraArgs != nil { - in, out := &in.KubeletExtraArgs, &out.KubeletExtraArgs - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeRegistrationOptions. -func (in *NodeRegistrationOptions) DeepCopy() *NodeRegistrationOptions { - if in == nil { - return nil - } - out := new(NodeRegistrationOptions) - in.DeepCopyInto(out) - return out -} diff --git a/cmd/clusterctl/config/manifest/clusterctl-api.yaml b/cmd/clusterctl/config/manifest/clusterctl-api.yaml index 8cbe011c84d7..b62dcaa792f1 100644 --- a/cmd/clusterctl/config/manifest/clusterctl-api.yaml +++ b/cmd/clusterctl/config/manifest/clusterctl-api.yaml @@ -35,10 +35,14 @@ spec: description: Provider defines an entry in the provider inventory. properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string metadata: type: object @@ -46,13 +50,16 @@ spec: description: ProviderName indicates the name of the provider. type: string type: - description: Type indicates the type of the provider. See ProviderType for a list of supported values + description: Type indicates the type of the provider. See ProviderType + for a list of supported values type: string version: description: Version indicates the component version. type: string watchedNamespace: - description: WatchedNamespace indicates the namespace where the provider controller is is watching. if empty the provider controller is watching for objects in all namespaces. + description: WatchedNamespace indicates the namespace where the provider + controller is is watching. if empty the provider controller is watching + for objects in all namespaces. type: string type: object served: true diff --git a/controlplane/kubeadm/api/v1alpha3/conversion_test.go b/controlplane/kubeadm/api/v1alpha3/conversion_test.go index b43afb0dbc32..50291fcb8db8 100644 --- a/controlplane/kubeadm/api/v1alpha3/conversion_test.go +++ b/controlplane/kubeadm/api/v1alpha3/conversion_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" - kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + kubeadmv1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" utilconversion "sigs.k8s.io/cluster-api/util/conversion" ) @@ -61,10 +61,13 @@ func fuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} { cabpkBootstrapTokenStringFuzzer, dnsFuzzer, kubeadmClusterConfigurationFuzzer, + initConfigFuzzer, + joinConfigFuzzer, + nodeRegistrationOptionsFuzzer, } } -func kubeadmBootstrapTokenStringFuzzer(in *kubeadmv1beta1.BootstrapTokenString, c fuzz.Continue) { +func kubeadmBootstrapTokenStringFuzzer(in *kubeadmv1beta2.BootstrapTokenString, c fuzz.Continue) { in.ID = "abcdef" in.Secret = "abcdef0123456789" } @@ -73,14 +76,37 @@ func cabpkBootstrapTokenStringFuzzer(in *cabpkv1.BootstrapTokenString, c fuzz.Co in.Secret = "abcdef0123456789" } -func dnsFuzzer(obj *kubeadmv1beta1.DNS, c fuzz.Continue) { +func dnsFuzzer(obj *kubeadmv1beta2.DNS, c fuzz.Continue) { c.FuzzNoCustom(obj) // 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) { +func initConfigFuzzer(obj *kubeadmv1beta2.InitConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // InitConfiguration.CertificateKey does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + obj.CertificateKey = "" +} + +func joinConfigFuzzer(obj *kubeadmv1beta2.JoinConfiguration, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // JoinConfiguration.ControlPlane.CertificateKey does not exists in v1alpha4, so setting it to empty string in order to avoid v1alpha3 --> v1alpha4 --> v1alpha3 round trip errors. + if obj.ControlPlane != nil { + obj.ControlPlane.CertificateKey = "" + } +} + +func nodeRegistrationOptionsFuzzer(obj *kubeadmv1beta2.NodeRegistrationOptions, c fuzz.Continue) { + c.FuzzNoCustom(obj) + + // NodeRegistrationOptions.IgnorePreflightErrors does not exists in v1alpha4, so setting it to nil in order to avoid v1beta2 --> v1alpha4 --> v1beta2 round trip errors. + obj.IgnorePreflightErrors = nil +} + +func kubeadmClusterConfigurationFuzzer(obj *kubeadmv1beta2.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. diff --git a/controlplane/kubeadm/api/v1alpha3/webhook_test.go b/controlplane/kubeadm/api/v1alpha3/webhook_test.go index b6991fce6702..3674bb4dedec 100644 --- a/controlplane/kubeadm/api/v1alpha3/webhook_test.go +++ b/controlplane/kubeadm/api/v1alpha3/webhook_test.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" + kubeadmv1beta2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta2" "sigs.k8s.io/cluster-api/util" ) @@ -53,13 +53,13 @@ func TestKubeadmControlPlaneConversion(t *testing.T) { Name: infraMachineTemplateName, }, KubeadmConfigSpec: cabpkv1.KubeadmConfigSpec{ - ClusterConfiguration: &kubeadmv1beta1.ClusterConfiguration{ - APIServer: kubeadmv1beta1.APIServer{ - ControlPlaneComponent: kubeadmv1beta1.ControlPlaneComponent{ + ClusterConfiguration: &kubeadmv1beta2.ClusterConfiguration{ + APIServer: kubeadmv1beta2.APIServer{ + ControlPlaneComponent: kubeadmv1beta2.ControlPlaneComponent{ ExtraArgs: map[string]string{ "foo": "bar", }, - ExtraVolumes: []kubeadmv1beta1.HostPathMount{ + ExtraVolumes: []kubeadmv1beta2.HostPathMount{ { Name: "mount-path", HostPath: "/foo", @@ -70,14 +70,14 @@ func TestKubeadmControlPlaneConversion(t *testing.T) { }, }, }, - InitConfiguration: &kubeadmv1beta1.InitConfiguration{ - NodeRegistration: kubeadmv1beta1.NodeRegistrationOptions{ + InitConfiguration: &kubeadmv1beta2.InitConfiguration{ + NodeRegistration: kubeadmv1beta2.NodeRegistrationOptions{ Name: "foo", CRISocket: "/var/run/containerd/containerd.sock", }, }, - JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ - NodeRegistration: kubeadmv1beta1.NodeRegistrationOptions{ + JoinConfiguration: &kubeadmv1beta2.JoinConfiguration{ + NodeRegistration: kubeadmv1beta2.NodeRegistrationOptions{ Name: "foo", CRISocket: "/var/run/containerd/containerd.sock", }, 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 ba8b5123bbc2..e395a46752fe 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 @@ -432,9 +432,12 @@ spec: type: array type: object useHyperKubeImage: - description: UseHyperKubeImage controls if hyperkube should + description: "UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective - separate images + separate images \n 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." type: boolean type: object diskSetup: @@ -641,6 +644,11 @@ spec: - token type: object type: array + certificateKey: + description: CertificateKey sets the key with which certificates + and keys are encrypted prior to being uploaded in a secret + in the cluster during the uploadcerts init phase. + type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this @@ -669,9 +677,6 @@ spec: Server to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object nodeRegistration: description: NodeRegistration holds fields that relate to @@ -685,6 +690,13 @@ spec: info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice of + pre-flight errors to be ignored when the current node + is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -709,7 +721,7 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process it will be defaulted - to []v1.Taint{''node-role.kubernetes.io/master=""''}. + to []corev1.Taint{''node-role.kubernetes.io/master=""''}. If you don''t want to taint your control-plane node, set this field to an empty slice, i.e. `taints: {}` in the YAML file. This field is solely used for Node @@ -756,16 +768,21 @@ spec: values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string caCertPath: - description: 'CACertPath is the path to the SSL certificate + description: CACertPath is the path to the SSL certificate authority used to secure comunications between node and control-plane. Defaults to "/etc/kubernetes/pki/ca.crt". - TODO: revisit when there is defaulting from k/k' type: string controlPlane: description: ControlPlane defines the additional control plane instance to be deployed on the joining node. If nil, no additional control plane instance will be deployed. properties: + certificateKey: + description: CertificateKey is the key that is used for + decryption of certificates after they are downloaded + from the secret upon joining a new control plane node. + The corresponding encryption key is in the InitConfiguration. + type: string localAPIEndpoint: description: LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this node. @@ -779,15 +796,11 @@ spec: API Server to bind to. Defaults to 6443. format: int32 type: integer - required: - - advertiseAddress - - bindPort type: object type: object discovery: - description: 'Discovery specifies the options for the kubelet - to use during the TLS Bootstrap process TODO: revisit when - there is defaulting from k/k' + description: Discovery specifies the options for the kubelet + to use during the TLS Bootstrap process properties: bootstrapToken: description: BootstrapToken is used to set the options @@ -808,9 +821,7 @@ spec: currently supported type is "sha256". This is a hex-encoded SHA-256 hash of the Subject Public Key Info (SPKI) object in DER-encoded ASN.1. These hashes - can be calculated using, for example, OpenSSL: openssl - x509 -pubkey -in ca.crt openssl rsa -pubin -outform - der 2>&/dev/null | openssl dgst -sha256 -hex' + can be calculated using, for example, OpenSSL:' items: type: string type: array @@ -826,7 +837,6 @@ spec: type: boolean required: - token - - unsafeSkipCAVerification type: object file: description: File is used to specify a file or URL to @@ -845,13 +855,12 @@ spec: description: Timeout modifies the discovery timeout type: string tlsBootstrapToken: - description: 'TLSBootstrapToken is a token used for TLS + description: TLSBootstrapToken is a token used for TLS bootstrapping. If .BootstrapToken is set, this field is defaulted to .BootstrapToken.Token, but can be overridden. If .File is set, this field **must be set** in case the KubeConfigFile does not contain any other authentication - information TODO: revisit when there is defaulting from - k/k' + information type: string type: object kind: @@ -872,6 +881,13 @@ spec: info. This information will be annotated to the Node API object, for later re-use type: string + ignorePreflightErrors: + description: IgnorePreflightErrors provides a slice of + pre-flight errors to be ignored when the current node + is registered. + items: + type: string + type: array kubeletExtraArgs: additionalProperties: type: string @@ -896,7 +912,7 @@ spec: description: 'Taints specifies the taints the Node API object should be registered with. If this field is unset, i.e. nil, in the `kubeadm init` process it will be defaulted - to []v1.Taint{''node-role.kubernetes.io/master=""''}. + to []corev1.Taint{''node-role.kubernetes.io/master=""''}. If you don''t want to taint your control-plane node, set this field to an empty slice, i.e. `taints: {}` in the YAML file. This field is solely used for Node diff --git a/controlplane/kubeadm/internal/workload_cluster_test.go b/controlplane/kubeadm/internal/workload_cluster_test.go index b9a18e6347df..ee45560b68a8 100644 --- a/controlplane/kubeadm/internal/workload_cluster_test.go +++ b/controlplane/kubeadm/internal/workload_cluster_test.go @@ -476,41 +476,6 @@ func TestUpdateUpdateClusterConfigurationInKubeadmConfigMap(t *testing.T) { }, }, }, - { - name: "converts kubeadm api version during mutation if required", - version: semver.MustParse("1.17.2"), - objs: []client.Object{&corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: kubeadmConfigKey, - Namespace: metav1.NamespaceSystem, - }, - Data: map[string]string{ - clusterConfigurationKey: "apiVersion: kubeadm.k8s.io/v1beta1\n" + - "kind: ClusterConfiguration\n" + - "kubernetesVersion: v1.16.1\n", - }, - }}, - mutator: func(c *bootstrapv1.ClusterConfiguration) { - c.KubernetesVersion = "v1.17.2" - }, - wantConfigMap: &corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: kubeadmConfigKey, - Namespace: metav1.NamespaceSystem, - }, - Data: map[string]string{ - clusterConfigurationKey: "apiServer: {}\n" + - "apiVersion: kubeadm.k8s.io/v1beta2\n" + - "controllerManager: {}\n" + - "dns: {}\n" + - "etcd: {}\n" + - "kind: ClusterConfiguration\n" + - "kubernetesVersion: v1.17.2\n" + - "networking: {}\n" + - "scheduler: {}\n", - }, - }, - }, } for _, tt := range tests { @@ -652,42 +617,6 @@ func TestUpdateUpdateClusterStatusInKubeadmConfigMap(t *testing.T) { }, }, }, - { - name: "converts kubeadm api version during mutation if required", - version: semver.MustParse("1.17.2"), - objs: []client.Object{&corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: kubeadmConfigKey, - Namespace: metav1.NamespaceSystem, - }, - Data: map[string]string{ - clusterStatusKey: "apiEndpoints:\n" + - " ip-10-0-0-1.ec2.internal:\n" + - " advertiseAddress: 10.0.0.1\n" + - " bindPort: 6443\n" + - "apiVersion: kubeadm.k8s.io/v1beta1\n" + - "kind: ClusterStatus\n", - }, - }}, - mutator: func(status *bootstrapv1.ClusterStatus) { - status.APIEndpoints["ip-10-0-0-2.ec2.internal"] = bootstrapv1.APIEndpoint{} - }, - wantConfigMap: &corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: kubeadmConfigKey, - Namespace: metav1.NamespaceSystem, - }, - Data: map[string]string{ - clusterStatusKey: "apiEndpoints:\n" + - " ip-10-0-0-1.ec2.internal:\n" + - " advertiseAddress: 10.0.0.1\n" + - " bindPort: 6443\n" + - " ip-10-0-0-2.ec2.internal: {}\n" + - "apiVersion: kubeadm.k8s.io/v1beta2\n" + - "kind: ClusterStatus\n", - }, - }, - }, } for _, tt := range tests { @@ -728,7 +657,7 @@ func TestUpdateKubernetesVersionInKubeadmConfigMap(t *testing.T) { { name: "updates the config map and changes the kubeadm API version", version: semver.MustParse("1.17.2"), - clusterConfigurationData: "apiVersion: kubeadm.k8s.io/v1beta1\n" + + clusterConfigurationData: "apiVersion: kubeadm.k8s.io/v1beta2\n" + "kind: ClusterConfiguration\n" + "kubernetesVersion: v1.16.1\n", },