diff --git a/Makefile b/Makefile index 37feeca4442f..f0bee19373e2 100644 --- a/Makefile +++ b/Makefile @@ -231,8 +231,12 @@ generate-go-core: $(CONTROLLER_GEN) $(CONVERSION_GEN) paths=./$(EXP_DIR)/api/... \ paths=./$(EXP_DIR)/addons/api/... \ paths=./cmd/clusterctl/... + $(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha3,./$(EXP_DIR)/api/v1alpha3,./$(EXP_DIR)/addons/api/v1alpha3" $(CONVERSION_GEN) \ - --input-dirs=./api/v1alpha2 \ + --input-dirs=./api/v1alpha3 \ + --input-dirs=./$(EXP_DIR)/api/v1alpha3 \ + --input-dirs=./$(EXP_DIR)/addons/api/v1alpha3 \ + --build-tag=ignore_autogenerated_core_v1alpha3 \ --output-file-base=zz_generated.conversion \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt @@ -242,8 +246,11 @@ generate-go-kubeadm-bootstrap: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go re object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \ paths=./bootstrap/kubeadm/api/... \ paths=./bootstrap/kubeadm/types/... + $(MAKE) clean-generated-conversions SRC_DIRS="./bootstrap/kubeadm/api" $(CONVERSION_GEN) \ - --input-dirs=./bootstrap/kubeadm/api/v1alpha2 \ + --input-dirs=./bootstrap/kubeadm/api/v1alpha3 \ + --build-tag=ignore_autogenerated_kubeadm_bootstrap_v1alpha3 \ + --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \ --output-file-base=zz_generated.conversion \ --go-header-file=./hack/boilerplate/boilerplate.generatego.txt @@ -252,6 +259,13 @@ generate-go-kubeadm-control-plane: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs G $(CONTROLLER_GEN) \ object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \ paths=./controlplane/kubeadm/api/... + $(MAKE) clean-generated-conversions SRC_DIRS="./controlplane/kubeadm/api" + $(CONVERSION_GEN) \ + --input-dirs=./controlplane/kubeadm/api/v1alpha3 \ + --build-tag=ignore_autogenerated_kubeadm_controlplane_v1alpha3 \ + --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3,sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3 \ + --output-file-base=zz_generated.conversion \ + --go-header-file=./hack/boilerplate/boilerplate.generatego.txt .PHONY: generate-bindata generate-bindata: $(KUSTOMIZE) $(GOBINDATA) clean-bindata $(CLOUDINIT_GENERATED) ## Generate code for embedding the clusterctl api manifest @@ -613,3 +627,6 @@ diagrams: ## Build proposal diagrams serve-book: ## Build and serve the book with live-reloading enabled $(MAKE) -C docs/book serve +.PHONY: clean-generated-conversions +clean-generated-conversions: ## Remove files generated by conversion-gen from the mentioned dirs + (IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done) diff --git a/PROJECT b/PROJECT index c2411ffa9413..b0e724a81540 100644 --- a/PROJECT +++ b/PROJECT @@ -3,29 +3,32 @@ domain: x-k8s.io repo: sigs.k8s.io/cluster-api resources: - group: cluster - version: v1alpha2 + version: v1alpha3 kind: Cluster - group: cluster - version: v1alpha2 + version: v1alpha3 kind: Machine - group: cluster - version: v1alpha2 + version: v1alpha3 kind: MachineSet - group: cluster - version: v1alpha2 + version: v1alpha3 kind: MachineDeployment - group: cluster version: v1alpha3 + kind: MachinePool +- group: cluster + version: v1alpha4 kind: Cluster - group: cluster - version: v1alpha3 + version: v1alpha4 kind: Machine - group: cluster - version: v1alpha3 + version: v1alpha4 kind: MachineSet - group: cluster - version: v1alpha3 + version: v1alpha4 kind: MachineDeployment - group: cluster - version: v1alpha3 + version: v1alpha4 kind: MachinePool diff --git a/api/v1alpha2/cluster_webhook.go b/api/v1alpha2/cluster_webhook.go deleted file mode 100644 index 9df2747de0e4..000000000000 --- a/api/v1alpha2/cluster_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("cluster-resource") - -func (r *Cluster) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/clusterlist_webhook.go b/api/v1alpha2/clusterlist_webhook.go deleted file mode 100644 index fdf1333b612b..000000000000 --- a/api/v1alpha2/clusterlist_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("clusterlist-resource") - -func (r *ClusterList) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/conversion.go b/api/v1alpha2/conversion.go deleted file mode 100644 index 757b56df72f2..000000000000 --- a/api/v1alpha2/conversion.go +++ /dev/null @@ -1,417 +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 v1alpha2 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - "sigs.k8s.io/cluster-api/api/v1alpha3" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -var ( - v2Annotations = []string{RevisionAnnotation, RevisionHistoryAnnotation, DesiredReplicasAnnotation, MaxReplicasAnnotation} - v3Annotations = []string{v1alpha3.RevisionAnnotation, v1alpha3.RevisionHistoryAnnotation, v1alpha3.DesiredReplicasAnnotation, v1alpha3.MaxReplicasAnnotation} -) - -func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.Cluster) - if err := Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(src, dst, nil); err != nil { - return err - } - - // Manually convert Status.APIEndpoints to Spec.ControlPlaneEndpoint. - if len(src.Status.APIEndpoints) > 0 { - endpoint := src.Status.APIEndpoints[0] - dst.Spec.ControlPlaneEndpoint.Host = endpoint.Host - dst.Spec.ControlPlaneEndpoint.Port = int32(endpoint.Port) - } - - // Manually restore data. - restored := &v1alpha3.Cluster{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Spec.ControlPlaneRef = restored.Spec.ControlPlaneRef - dst.Status.ControlPlaneReady = restored.Status.ControlPlaneReady - dst.Status.FailureDomains = restored.Status.FailureDomains - dst.Spec.Paused = restored.Spec.Paused - dst.Status.Conditions = restored.Status.Conditions - dst.Status.ObservedGeneration = restored.Status.ObservedGeneration - - return nil -} - -func (dst *Cluster) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.Cluster) - if err := Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(src, dst, nil); err != nil { - return err - } - - // Manually convert Spec.ControlPlaneEndpoint to Status.APIEndpoints. - if !src.Spec.ControlPlaneEndpoint.IsZero() { - dst.Status.APIEndpoints = []APIEndpoint{ - { - Host: src.Spec.ControlPlaneEndpoint.Host, - Port: int(src.Spec.ControlPlaneEndpoint.Port), - }, - } - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - return nil -} - -func (src *ClusterList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.ClusterList) - - return Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(src, dst, nil) -} - -func (dst *ClusterList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.ClusterList) - - return Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(src, dst, nil) -} - -func (src *Machine) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.Machine) - if err := Convert_v1alpha2_Machine_To_v1alpha3_Machine(src, dst, nil); err != nil { - return err - } - - // Manually convert ExcludeNodeDrainingAnnotation annotation if set. - if val, ok := src.Annotations[ExcludeNodeDrainingAnnotation]; ok { - src.Annotations[v1alpha3.ExcludeNodeDrainingAnnotation] = val - delete(src.Annotations, ExcludeNodeDrainingAnnotation) - } - - // Manually convert ClusterName from label, if any. - // This conversion can be overwritten when restoring the ClusterName field. - if name, ok := src.Labels[MachineClusterLabelName]; ok { - dst.Spec.ClusterName = name - } - - // Manually restore data. - restored := &v1alpha3.Machine{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - restoreMachineSpec(&restored.Spec, &dst.Spec) - dst.Status.ObservedGeneration = restored.Status.ObservedGeneration - dst.Status.Conditions = restored.Status.Conditions - - return nil -} - -func restoreMachineSpec(restored *v1alpha3.MachineSpec, dst *v1alpha3.MachineSpec) { - if restored.ClusterName != "" { - dst.ClusterName = restored.ClusterName - } - dst.Bootstrap.DataSecretName = restored.Bootstrap.DataSecretName - dst.FailureDomain = restored.FailureDomain - dst.NodeDrainTimeout = restored.NodeDrainTimeout -} - -func (dst *Machine) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.Machine) - if err := Convert_v1alpha3_Machine_To_v1alpha2_Machine(src, dst, nil); err != nil { - return err - } - - // Manually convert ExcludeNodeDrainingAnnotation annotation if set. - if val, ok := src.Annotations[v1alpha3.ExcludeNodeDrainingAnnotation]; ok { - src.Annotations[ExcludeNodeDrainingAnnotation] = val - delete(src.Annotations, v1alpha3.ExcludeNodeDrainingAnnotation) - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - return nil -} - -func (src *MachineList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.MachineList) - - return Convert_v1alpha2_MachineList_To_v1alpha3_MachineList(src, dst, nil) -} - -func (dst *MachineList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.MachineList) - - return Convert_v1alpha3_MachineList_To_v1alpha2_MachineList(src, dst, nil) -} - -func (src *MachineSet) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.MachineSet) - if err := Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(src, dst, nil); err != nil { - return err - } - - // Manually convert ClusterName from label, if any. - // This conversion can be overwritten when restoring the ClusterName field. - if name, ok := src.Labels[MachineClusterLabelName]; ok { - dst.Spec.ClusterName = name - dst.Spec.Template.Spec.ClusterName = name - } - - // Manually convert annotations - for i := range v2Annotations { - convertAnnotations(v2Annotations[i], v3Annotations[i], dst.Annotations) - } - - // Manually restore data. - restored := &v1alpha3.MachineSet{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if restored.Spec.ClusterName != "" { - dst.Spec.ClusterName = restored.Spec.ClusterName - } - restoreMachineSpec(&restored.Spec.Template.Spec, &dst.Spec.Template.Spec) - - return nil -} - -func (dst *MachineSet) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.MachineSet) - if err := Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(src, dst, nil); err != nil { - return err - } - - // Manually convert annotations - for i := range v3Annotations { - convertAnnotations(v3Annotations[i], v2Annotations[i], dst.Annotations) - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - return nil -} - -func (src *MachineSetList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.MachineSetList) - - return Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(src, dst, nil) -} - -func (dst *MachineSetList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.MachineSetList) - - return Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(src, dst, nil) -} - -func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.MachineDeployment) - if err := Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(src, dst, nil); err != nil { - return err - } - - // Manually convert ClusterName from label, if any. - // This conversion can be overwritten when restoring the ClusterName field. - if name, ok := src.Labels[MachineClusterLabelName]; ok { - dst.Spec.ClusterName = name - dst.Spec.Template.Spec.ClusterName = name - } - - // Manually convert annotations - for i := range v2Annotations { - convertAnnotations(v2Annotations[i], v3Annotations[i], dst.Annotations) - } - - // Manually restore data. - restored := &v1alpha3.MachineDeployment{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - if restored.Spec.ClusterName != "" { - dst.Spec.ClusterName = restored.Spec.ClusterName - } - dst.Spec.Paused = restored.Spec.Paused - dst.Status.Phase = restored.Status.Phase - restoreMachineSpec(&restored.Spec.Template.Spec, &dst.Spec.Template.Spec) - - return nil -} - -func (dst *MachineDeployment) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.MachineDeployment) - if err := Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(src, dst, nil); err != nil { - return err - } - - // Manually convert annotations - for i := range v3Annotations { - convertAnnotations(v3Annotations[i], v2Annotations[i], dst.Annotations) - } - - // Preserve Hub data on down-conversion except for metadata - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - return nil -} - -func convertAnnotations(fromAnnotation string, toAnnotation string, annotations map[string]string) { - if value, ok := annotations[fromAnnotation]; ok { - delete(annotations, fromAnnotation) - annotations[toAnnotation] = value - } -} - -func (src *MachineDeploymentList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*v1alpha3.MachineDeploymentList) - - return Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(src, dst, nil) -} - -func (dst *MachineDeploymentList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*v1alpha3.MachineDeploymentList) - - return Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(src, dst, nil) -} - -func Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(in *MachineSpec, out *v1alpha3.MachineSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(in, out, s); err != nil { - return err - } - - // Discards unused ObjectMeta - - return nil -} - -func Convert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(in *ClusterSpec, out *v1alpha3.ClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(in, out, s); err != nil { - return err - } - - return nil -} - -func Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in *ClusterStatus, out *v1alpha3.ClusterStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Error fields to the Failure fields - out.FailureMessage = in.ErrorMessage - out.FailureReason = in.ErrorReason - - return nil -} - -func Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in *v1alpha3.ClusterStatus, out *ClusterStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Failure fields to the Error fields - out.ErrorMessage = in.FailureMessage - out.ErrorReason = in.FailureReason - - return nil -} - -func Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *MachineSetStatus, out *v1alpha3.MachineSetStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Error fields to the Failure fields - out.FailureMessage = in.ErrorMessage - out.FailureReason = in.ErrorReason - - return nil -} - -func Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in *v1alpha3.MachineSetStatus, out *MachineSetStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Failure fields to the Error fields - out.ErrorMessage = in.FailureMessage - out.ErrorReason = in.FailureReason - - return nil -} - -func Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in *MachineStatus, out *v1alpha3.MachineStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Error fields to the Failure fields - out.FailureMessage = in.ErrorMessage - out.FailureReason = in.ErrorReason - - return nil -} - -func Convert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(in *v1alpha3.ClusterSpec, out *ClusterSpec, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(in, out, s); err != nil { - return err - } - return nil -} - -func Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in *v1alpha3.MachineStatus, out *MachineStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Failure fields to the Error fields - out.ErrorMessage = in.FailureMessage - out.ErrorReason = in.FailureReason - - return nil -} - -func Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(in *v1alpha3.MachineDeploymentSpec, out *MachineDeploymentSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(in, out, s) -} - -func Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(in *v1alpha3.MachineDeploymentStatus, out *MachineDeploymentStatus, s apiconversion.Scope) error { - return autoConvert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(in, out, s) -} - -func Convert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(in *v1alpha3.MachineSetSpec, out *MachineSetSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(in, out, s) -} - -func Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(in *v1alpha3.MachineSpec, out *MachineSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(in, out, s) -} - -func Convert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(in *v1alpha3.Bootstrap, out *Bootstrap, s apiconversion.Scope) error { - return autoConvert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(in, out, s) -} diff --git a/api/v1alpha2/conversion_test.go b/api/v1alpha2/conversion_test.go deleted file mode 100644 index cb9cf58186c4..000000000000 --- a/api/v1alpha2/conversion_test.go +++ /dev/null @@ -1,314 +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 v1alpha2 - -import ( - "testing" - - . "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/utils/pointer" - "sigs.k8s.io/cluster-api/api/v1alpha3" - 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(v1alpha3.AddToScheme(scheme)).To(Succeed()) - - t.Run("for Cluster", utilconversion.FuzzTestFunc(scheme, &v1alpha3.Cluster{}, &Cluster{})) - t.Run("for Machine", utilconversion.FuzzTestFunc(scheme, &v1alpha3.Machine{}, &Machine{})) - t.Run("for MachineSet", utilconversion.FuzzTestFunc(scheme, &v1alpha3.MachineSet{}, &MachineSet{})) - t.Run("for MachineDeployment", utilconversion.FuzzTestFunc(scheme, &v1alpha3.MachineDeployment{}, &MachineDeployment{})) -} - -func TestConvertCluster(t *testing.T) { - t.Run("to hub", func(t *testing.T) { - t.Run("should convert the first value in Status.APIEndpoints to Spec.ControlPlaneEndpoint", func(t *testing.T) { - g := NewWithT(t) - - src := &Cluster{ - Status: ClusterStatus{ - APIEndpoints: []APIEndpoint{ - { - Host: "example.com", - Port: 6443, - }, - }, - }, - } - dst := &v1alpha3.Cluster{} - - g.Expect(src.ConvertTo(dst)).To(Succeed()) - g.Expect(dst.Spec.ControlPlaneEndpoint.Host).To(Equal("example.com")) - g.Expect(dst.Spec.ControlPlaneEndpoint.Port).To(BeEquivalentTo(6443)) - }) - }) - - t.Run("from hub", func(t *testing.T) { - t.Run("preserves fields from hub version", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.Cluster{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hub", - }, - Spec: v1alpha3.ClusterSpec{ - ControlPlaneRef: &corev1.ObjectReference{ - Name: "controlplane-1", - }, - }, - Status: v1alpha3.ClusterStatus{ - ControlPlaneReady: true, - }, - } - dst := &Cluster{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - restored := &v1alpha3.Cluster{} - g.Expect(dst.ConvertTo(restored)).To(Succeed()) - - // Test field restored fields. - g.Expect(restored.Name).To(Equal(src.Name)) - g.Expect(restored.Spec.ControlPlaneRef).To(Equal(src.Spec.ControlPlaneRef)) - g.Expect(restored.Status.ControlPlaneReady).To(Equal(src.Status.ControlPlaneReady)) - }) - - t.Run("should convert Spec.ControlPlaneEndpoint to Status.APIEndpoints[0]", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.Cluster{ - Spec: v1alpha3.ClusterSpec{ - ControlPlaneEndpoint: v1alpha3.APIEndpoint{ - Host: "example.com", - Port: 6443, - }, - }, - } - dst := &Cluster{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - g.Expect(dst.Status.APIEndpoints[0].Host).To(Equal("example.com")) - g.Expect(dst.Status.APIEndpoints[0].Port).To(BeEquivalentTo(6443)) - }) - }) -} - -func TestConvertMachine(t *testing.T) { - t.Run("to hub", func(t *testing.T) { - t.Run("should convert the Spec.ClusterName from label", func(t *testing.T) { - g := NewWithT(t) - - src := &Machine{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - MachineClusterLabelName: "test-cluster", - }, - }, - } - dst := &v1alpha3.Machine{} - - g.Expect(src.ConvertTo(dst)).To(Succeed()) - g.Expect(dst.Spec.ClusterName).To(Equal("test-cluster")) - }) - }) - - t.Run("from hub", func(t *testing.T) { - t.Run("preserves fields from hub version", func(t *testing.T) { - g := NewWithT(t) - - failureDomain := "my failure domain" - src := &v1alpha3.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hub", - }, - Spec: v1alpha3.MachineSpec{ - ClusterName: "test-cluster", - Bootstrap: v1alpha3.Bootstrap{ - DataSecretName: pointer.StringPtr("secret-data"), - }, - FailureDomain: &failureDomain, - }, - } - dst := &Machine{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - restored := &v1alpha3.Machine{} - g.Expect(dst.ConvertTo(restored)).To(Succeed()) - - // Test field restored fields. - g.Expect(restored.Name).To(Equal(src.Name)) - g.Expect(restored.Spec.Bootstrap.DataSecretName).To(Equal(src.Spec.Bootstrap.DataSecretName)) - g.Expect(restored.Spec.ClusterName).To(Equal(src.Spec.ClusterName)) - g.Expect(restored.Spec.FailureDomain).To(Equal(src.Spec.FailureDomain)) - }) - }) -} - -func TestConvertMachineSet(t *testing.T) { - t.Run("to hub", func(t *testing.T) { - t.Run("should convert the Spec.ClusterName from label", func(t *testing.T) { - g := NewWithT(t) - - src := &MachineSet{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - MachineClusterLabelName: "test-cluster", - }, - }, - } - dst := &v1alpha3.MachineSet{} - - g.Expect(src.ConvertTo(dst)).To(Succeed()) - g.Expect(dst.Spec.ClusterName).To(Equal("test-cluster")) - g.Expect(dst.Spec.Template.Spec.ClusterName).To(Equal("test-cluster")) - }) - }) - - t.Run("from hub", func(t *testing.T) { - t.Run("preserves field from hub version", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.MachineSet{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hub", - }, - Spec: v1alpha3.MachineSetSpec{ - ClusterName: "test-cluster", - Template: v1alpha3.MachineTemplateSpec{ - Spec: v1alpha3.MachineSpec{ - ClusterName: "test-cluster", - }, - }, - }, - } - dst := &MachineSet{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - restored := &v1alpha3.MachineSet{} - g.Expect(dst.ConvertTo(restored)).To(Succeed()) - - // Test field restored fields. - g.Expect(restored.Name).To(Equal(src.Name)) - g.Expect(restored.Spec.ClusterName).To(Equal(src.Spec.ClusterName)) - g.Expect(restored.Spec.Template.Spec.ClusterName).To(Equal(src.Spec.Template.Spec.ClusterName)) - }) - }) -} - -func TestConvertMachineDeployment(t *testing.T) { - t.Run("to hub", func(t *testing.T) { - t.Run("should convert the Spec.ClusterName from label", func(t *testing.T) { - g := NewWithT(t) - - src := &MachineDeployment{ - ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{ - MachineClusterLabelName: "test-cluster", - }, - }, - } - dst := &v1alpha3.MachineDeployment{} - - g.Expect(src.ConvertTo(dst)).To(Succeed()) - g.Expect(dst.Spec.ClusterName).To(Equal("test-cluster")) - g.Expect(dst.Spec.Template.Spec.ClusterName).To(Equal("test-cluster")) - }) - - t.Run("should convert the annotations", func(t *testing.T) { - g := NewWithT(t) - - src := &MachineDeployment{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - RevisionAnnotation: "test", - RevisionHistoryAnnotation: "test", - DesiredReplicasAnnotation: "test", - MaxReplicasAnnotation: "test", - }, - }, - } - dst := &v1alpha3.MachineDeployment{} - - g.Expect(src.ConvertTo(dst)).To(Succeed()) - g.Expect(dst.Annotations).To(HaveKey(v1alpha3.RevisionAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(v1alpha3.RevisionHistoryAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(v1alpha3.DesiredReplicasAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(v1alpha3.MaxReplicasAnnotation)) - }) - }) - - t.Run("from hub", func(t *testing.T) { - t.Run("preserves fields from hub version", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.MachineDeployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hub", - }, - Spec: v1alpha3.MachineDeploymentSpec{ - ClusterName: "test-cluster", - Paused: true, - Template: v1alpha3.MachineTemplateSpec{ - Spec: v1alpha3.MachineSpec{ - ClusterName: "test-cluster", - }, - }, - }, - } - src.Status.SetTypedPhase(v1alpha3.MachineDeploymentPhaseRunning) - dst := &MachineDeployment{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - restored := &v1alpha3.MachineDeployment{} - g.Expect(dst.ConvertTo(restored)).To(Succeed()) - - // Test field restored fields. - g.Expect(restored.Name).To(Equal(src.Name)) - g.Expect(restored.Spec.ClusterName).To(Equal(src.Spec.ClusterName)) - g.Expect(restored.Spec.Paused).To(Equal(src.Spec.Paused)) - g.Expect(restored.Spec.Template.Spec.ClusterName).To(Equal(src.Spec.Template.Spec.ClusterName)) - }) - - t.Run("should convert the annotations", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.MachineDeployment{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - v1alpha3.RevisionAnnotation: "test", - v1alpha3.RevisionHistoryAnnotation: "test", - v1alpha3.DesiredReplicasAnnotation: "test", - v1alpha3.MaxReplicasAnnotation: "test", - }, - }, - } - dst := &MachineDeployment{} - - g.Expect(dst.ConvertFrom(src)).To(Succeed()) - g.Expect(dst.Annotations).To(HaveKey(RevisionAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(RevisionHistoryAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(DesiredReplicasAnnotation)) - g.Expect(dst.Annotations).To(HaveKey(MaxReplicasAnnotation)) - }) - }) -} diff --git a/api/v1alpha2/defaults.go b/api/v1alpha2/defaults.go deleted file mode 100644 index 15c40afdaae1..000000000000 --- a/api/v1alpha2/defaults.go +++ /dev/null @@ -1,73 +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 v1alpha2 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -// PopulateDefaultsMachineDeployment fills in default field values -// Currently it is called after reading objects, but it could be called in an admission webhook also -func PopulateDefaultsMachineDeployment(d *MachineDeployment) { - if d.Spec.Replicas == nil { - d.Spec.Replicas = new(int32) - *d.Spec.Replicas = 1 - } - - if d.Spec.MinReadySeconds == nil { - d.Spec.MinReadySeconds = new(int32) - *d.Spec.MinReadySeconds = 0 - } - - if d.Spec.RevisionHistoryLimit == nil { - d.Spec.RevisionHistoryLimit = new(int32) - *d.Spec.RevisionHistoryLimit = 1 - } - - if d.Spec.ProgressDeadlineSeconds == nil { - d.Spec.ProgressDeadlineSeconds = new(int32) - *d.Spec.ProgressDeadlineSeconds = 600 - } - - if d.Spec.Strategy == nil { - d.Spec.Strategy = &MachineDeploymentStrategy{} - } - - if d.Spec.Strategy.Type == "" { - d.Spec.Strategy.Type = RollingUpdateMachineDeploymentStrategyType - } - - // Default RollingUpdate strategy only if strategy type is RollingUpdate. - if d.Spec.Strategy.Type == RollingUpdateMachineDeploymentStrategyType { - if d.Spec.Strategy.RollingUpdate == nil { - d.Spec.Strategy.RollingUpdate = &MachineRollingUpdateDeployment{} - } - if d.Spec.Strategy.RollingUpdate.MaxSurge == nil { - ios1 := intstr.FromInt(1) - d.Spec.Strategy.RollingUpdate.MaxSurge = &ios1 - } - if d.Spec.Strategy.RollingUpdate.MaxUnavailable == nil { - ios0 := intstr.FromInt(0) - d.Spec.Strategy.RollingUpdate.MaxUnavailable = &ios0 - } - } - - if len(d.Namespace) == 0 { - d.Namespace = metav1.NamespaceDefault - } -} diff --git a/api/v1alpha2/machinedeploymentlist_webhook.go b/api/v1alpha2/machinedeploymentlist_webhook.go deleted file mode 100644 index d838fe2298b6..000000000000 --- a/api/v1alpha2/machinedeploymentlist_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machinedeploymentlist-resource") - -func (r *MachineDeploymentList) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/machinelist_webhook.go b/api/v1alpha2/machinelist_webhook.go deleted file mode 100644 index ce12405ed97e..000000000000 --- a/api/v1alpha2/machinelist_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machinelist-resource") - -func (r *MachineList) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/machineset_webhook.go b/api/v1alpha2/machineset_webhook.go deleted file mode 100644 index 9c1a4a81ebfe..000000000000 --- a/api/v1alpha2/machineset_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machineset-resource") - -func (r *MachineSet) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/machinesetlist_webhook.go b/api/v1alpha2/machinesetlist_webhook.go deleted file mode 100644 index 1bc8b140bb8f..000000000000 --- a/api/v1alpha2/machinesetlist_webhook.go +++ /dev/null @@ -1,31 +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 v1alpha2 - -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machinesetlist-resource") - -func (r *MachineSetList) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} diff --git a/api/v1alpha2/zz_generated.conversion.go b/api/v1alpha2/zz_generated.conversion.go deleted file mode 100644 index 435282bf0890..000000000000 --- a/api/v1alpha2/zz_generated.conversion.go +++ /dev/null @@ -1,1004 +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 conversion-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - unsafe "unsafe" - - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - intstr "k8s.io/apimachinery/pkg/util/intstr" - v1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" -) - -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), (*v1alpha3.APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(a.(*APIEndpoint), b.(*v1alpha3.APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.APIEndpoint)(nil), (*APIEndpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(a.(*v1alpha3.APIEndpoint), b.(*APIEndpoint), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Bootstrap)(nil), (*v1alpha3.Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(a.(*Bootstrap), b.(*v1alpha3.Bootstrap), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*v1alpha3.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(a.(*Cluster), b.(*v1alpha3.Cluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(a.(*v1alpha3.Cluster), b.(*Cluster), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ClusterList)(nil), (*v1alpha3.ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(a.(*ClusterList), b.(*v1alpha3.ClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterList)(nil), (*ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(a.(*v1alpha3.ClusterList), b.(*ClusterList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ClusterNetwork)(nil), (*v1alpha3.ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(a.(*ClusterNetwork), b.(*v1alpha3.ClusterNetwork), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.ClusterNetwork)(nil), (*ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(a.(*v1alpha3.ClusterNetwork), b.(*ClusterNetwork), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*Machine)(nil), (*v1alpha3.Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_Machine_To_v1alpha3_Machine(a.(*Machine), b.(*v1alpha3.Machine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.Machine)(nil), (*Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Machine_To_v1alpha2_Machine(a.(*v1alpha3.Machine), b.(*Machine), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineAddress)(nil), (*v1alpha3.MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(a.(*MachineAddress), b.(*v1alpha3.MachineAddress), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineAddress)(nil), (*MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(a.(*v1alpha3.MachineAddress), b.(*MachineAddress), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineDeployment)(nil), (*v1alpha3.MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(a.(*MachineDeployment), b.(*v1alpha3.MachineDeployment), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeployment)(nil), (*MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(a.(*v1alpha3.MachineDeployment), b.(*MachineDeployment), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineDeploymentList)(nil), (*v1alpha3.MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(a.(*MachineDeploymentList), b.(*v1alpha3.MachineDeploymentList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeploymentList)(nil), (*MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(a.(*v1alpha3.MachineDeploymentList), b.(*MachineDeploymentList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineDeploymentSpec)(nil), (*v1alpha3.MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(a.(*MachineDeploymentSpec), b.(*v1alpha3.MachineDeploymentSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineDeploymentStatus)(nil), (*v1alpha3.MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(a.(*MachineDeploymentStatus), b.(*v1alpha3.MachineDeploymentStatus), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineDeploymentStrategy)(nil), (*v1alpha3.MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(a.(*MachineDeploymentStrategy), b.(*v1alpha3.MachineDeploymentStrategy), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineDeploymentStrategy)(nil), (*MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(a.(*v1alpha3.MachineDeploymentStrategy), b.(*MachineDeploymentStrategy), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1alpha3.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineList_To_v1alpha3_MachineList(a.(*MachineList), b.(*v1alpha3.MachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineList)(nil), (*MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineList_To_v1alpha2_MachineList(a.(*v1alpha3.MachineList), b.(*MachineList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineRollingUpdateDeployment)(nil), (*v1alpha3.MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(a.(*MachineRollingUpdateDeployment), b.(*v1alpha3.MachineRollingUpdateDeployment), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineRollingUpdateDeployment)(nil), (*MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(a.(*v1alpha3.MachineRollingUpdateDeployment), b.(*MachineRollingUpdateDeployment), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineSet)(nil), (*v1alpha3.MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(a.(*MachineSet), b.(*v1alpha3.MachineSet), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineSet)(nil), (*MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(a.(*v1alpha3.MachineSet), b.(*MachineSet), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineSetList)(nil), (*v1alpha3.MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(a.(*MachineSetList), b.(*v1alpha3.MachineSetList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineSetList)(nil), (*MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(a.(*v1alpha3.MachineSetList), b.(*MachineSetList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineSetSpec)(nil), (*v1alpha3.MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(a.(*MachineSetSpec), b.(*v1alpha3.MachineSetSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*MachineTemplateSpec)(nil), (*v1alpha3.MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(a.(*MachineTemplateSpec), b.(*v1alpha3.MachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.MachineTemplateSpec)(nil), (*MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(a.(*v1alpha3.MachineTemplateSpec), b.(*MachineTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*NetworkRanges)(nil), (*v1alpha3.NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(a.(*NetworkRanges), b.(*v1alpha3.NetworkRanges), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.NetworkRanges)(nil), (*NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(a.(*v1alpha3.NetworkRanges), b.(*NetworkRanges), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*ObjectMeta)(nil), (*v1alpha3.ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(a.(*ObjectMeta), b.(*v1alpha3.ObjectMeta), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.ObjectMeta)(nil), (*ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(a.(*v1alpha3.ObjectMeta), b.(*ObjectMeta), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*ClusterSpec)(nil), (*v1alpha3.ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(a.(*ClusterSpec), b.(*v1alpha3.ClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*ClusterStatus)(nil), (*v1alpha3.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(a.(*ClusterStatus), b.(*v1alpha3.ClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*MachineSetStatus)(nil), (*v1alpha3.MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(a.(*MachineSetStatus), b.(*v1alpha3.MachineSetStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*MachineSpec)(nil), (*v1alpha3.MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(a.(*MachineSpec), b.(*v1alpha3.MachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*MachineStatus)(nil), (*v1alpha3.MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(a.(*MachineStatus), b.(*v1alpha3.MachineStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.Bootstrap)(nil), (*Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(a.(*v1alpha3.Bootstrap), b.(*Bootstrap), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(a.(*v1alpha3.ClusterSpec), b.(*ClusterSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(a.(*v1alpha3.ClusterStatus), b.(*ClusterStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineDeploymentSpec)(nil), (*MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(a.(*v1alpha3.MachineDeploymentSpec), b.(*MachineDeploymentSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineDeploymentStatus)(nil), (*MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(a.(*v1alpha3.MachineDeploymentStatus), b.(*MachineDeploymentStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineSetSpec)(nil), (*MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(a.(*v1alpha3.MachineSetSpec), b.(*MachineSetSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineSetStatus)(nil), (*MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(a.(*v1alpha3.MachineSetStatus), b.(*MachineSetStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineSpec)(nil), (*MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(a.(*v1alpha3.MachineSpec), b.(*MachineSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.MachineStatus)(nil), (*MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(a.(*v1alpha3.MachineStatus), b.(*MachineStatus), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in *APIEndpoint, out *v1alpha3.APIEndpoint, s conversion.Scope) error { - out.Host = in.Host - out.Port = int32(in.Port) - return nil -} - -// Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint is an autogenerated conversion function. -func Convert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in *APIEndpoint, out *v1alpha3.APIEndpoint, s conversion.Scope) error { - return autoConvert_v1alpha2_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s) -} - -func autoConvert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in *v1alpha3.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { - out.Host = in.Host - out.Port = int(in.Port) - return nil -} - -// Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint is an autogenerated conversion function. -func Convert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in *v1alpha3.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { - return autoConvert_v1alpha3_APIEndpoint_To_v1alpha2_APIEndpoint(in, out, s) -} - -func autoConvert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in *Bootstrap, out *v1alpha3.Bootstrap, s conversion.Scope) error { - out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) - out.Data = (*string)(unsafe.Pointer(in.Data)) - return nil -} - -// Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap is an autogenerated conversion function. -func Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in *Bootstrap, out *v1alpha3.Bootstrap, s conversion.Scope) error { - return autoConvert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(in, out, s) -} - -func autoConvert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(in *v1alpha3.Bootstrap, out *Bootstrap, s conversion.Scope) error { - out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) - out.Data = (*string)(unsafe.Pointer(in.Data)) - // WARNING: in.DataSecretName requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_Cluster_To_v1alpha3_Cluster(in *Cluster, out *v1alpha3.Cluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_Cluster_To_v1alpha3_Cluster is an autogenerated conversion function. -func Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(in *Cluster, out *v1alpha3.Cluster, s conversion.Scope) error { - return autoConvert_v1alpha2_Cluster_To_v1alpha3_Cluster(in, out, s) -} - -func autoConvert_v1alpha3_Cluster_To_v1alpha2_Cluster(in *v1alpha3.Cluster, out *Cluster, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_Cluster_To_v1alpha2_Cluster is an autogenerated conversion function. -func Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(in *v1alpha3.Cluster, out *Cluster, s conversion.Scope) error { - return autoConvert_v1alpha3_Cluster_To_v1alpha2_Cluster(in, out, s) -} - -func autoConvert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in *ClusterList, out *v1alpha3.ClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.Cluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_Cluster_To_v1alpha3_Cluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList is an autogenerated conversion function. -func Convert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in *ClusterList, out *v1alpha3.ClusterList, s conversion.Scope) error { - return autoConvert_v1alpha2_ClusterList_To_v1alpha3_ClusterList(in, out, s) -} - -func autoConvert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in *v1alpha3.ClusterList, out *ClusterList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Cluster, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_Cluster_To_v1alpha2_Cluster(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList is an autogenerated conversion function. -func Convert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in *v1alpha3.ClusterList, out *ClusterList, s conversion.Scope) error { - return autoConvert_v1alpha3_ClusterList_To_v1alpha2_ClusterList(in, out, s) -} - -func autoConvert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *ClusterNetwork, out *v1alpha3.ClusterNetwork, s conversion.Scope) error { - out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) - out.Services = (*v1alpha3.NetworkRanges)(unsafe.Pointer(in.Services)) - out.Pods = (*v1alpha3.NetworkRanges)(unsafe.Pointer(in.Pods)) - out.ServiceDomain = in.ServiceDomain - return nil -} - -// Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork is an autogenerated conversion function. -func Convert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *ClusterNetwork, out *v1alpha3.ClusterNetwork, s conversion.Scope) error { - return autoConvert_v1alpha2_ClusterNetwork_To_v1alpha3_ClusterNetwork(in, out, s) -} - -func autoConvert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in *v1alpha3.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { - out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) - out.Services = (*NetworkRanges)(unsafe.Pointer(in.Services)) - out.Pods = (*NetworkRanges)(unsafe.Pointer(in.Pods)) - out.ServiceDomain = in.ServiceDomain - return nil -} - -// Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork is an autogenerated conversion function. -func Convert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in *v1alpha3.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { - return autoConvert_v1alpha3_ClusterNetwork_To_v1alpha2_ClusterNetwork(in, out, s) -} - -func autoConvert_v1alpha2_ClusterSpec_To_v1alpha3_ClusterSpec(in *ClusterSpec, out *v1alpha3.ClusterSpec, s conversion.Scope) error { - out.ClusterNetwork = (*v1alpha3.ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) - out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) - return nil -} - -func autoConvert_v1alpha3_ClusterSpec_To_v1alpha2_ClusterSpec(in *v1alpha3.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { - // WARNING: in.Paused requires manual conversion: does not exist in peer-type - out.ClusterNetwork = (*ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) - // WARNING: in.ControlPlaneEndpoint requires manual conversion: does not exist in peer-type - // WARNING: in.ControlPlaneRef requires manual conversion: does not exist in peer-type - out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) - return nil -} - -func autoConvert_v1alpha2_ClusterStatus_To_v1alpha3_ClusterStatus(in *ClusterStatus, out *v1alpha3.ClusterStatus, s conversion.Scope) error { - // WARNING: in.APIEndpoints requires manual conversion: does not exist in peer-type - // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type - // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type - out.Phase = in.Phase - out.InfrastructureReady = in.InfrastructureReady - out.ControlPlaneInitialized = in.ControlPlaneInitialized - return nil -} - -func autoConvert_v1alpha3_ClusterStatus_To_v1alpha2_ClusterStatus(in *v1alpha3.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { - // WARNING: in.FailureDomains requires manual conversion: does not exist in peer-type - // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type - // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type - out.Phase = in.Phase - out.InfrastructureReady = in.InfrastructureReady - out.ControlPlaneInitialized = in.ControlPlaneInitialized - // WARNING: in.ControlPlaneReady requires manual conversion: does not exist in peer-type - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - // WARNING: in.ObservedGeneration requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_Machine_To_v1alpha3_Machine(in *Machine, out *v1alpha3.Machine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_Machine_To_v1alpha3_Machine is an autogenerated conversion function. -func Convert_v1alpha2_Machine_To_v1alpha3_Machine(in *Machine, out *v1alpha3.Machine, s conversion.Scope) error { - return autoConvert_v1alpha2_Machine_To_v1alpha3_Machine(in, out, s) -} - -func autoConvert_v1alpha3_Machine_To_v1alpha2_Machine(in *v1alpha3.Machine, out *Machine, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_Machine_To_v1alpha2_Machine is an autogenerated conversion function. -func Convert_v1alpha3_Machine_To_v1alpha2_Machine(in *v1alpha3.Machine, out *Machine, s conversion.Scope) error { - return autoConvert_v1alpha3_Machine_To_v1alpha2_Machine(in, out, s) -} - -func autoConvert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in *MachineAddress, out *v1alpha3.MachineAddress, s conversion.Scope) error { - out.Type = v1alpha3.MachineAddressType(in.Type) - out.Address = in.Address - return nil -} - -// Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress is an autogenerated conversion function. -func Convert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in *MachineAddress, out *v1alpha3.MachineAddress, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineAddress_To_v1alpha3_MachineAddress(in, out, s) -} - -func autoConvert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in *v1alpha3.MachineAddress, out *MachineAddress, s conversion.Scope) error { - out.Type = MachineAddressType(in.Type) - out.Address = in.Address - return nil -} - -// Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress is an autogenerated conversion function. -func Convert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in *v1alpha3.MachineAddress, out *MachineAddress, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineAddress_To_v1alpha2_MachineAddress(in, out, s) -} - -func autoConvert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in *MachineDeployment, out *v1alpha3.MachineDeployment, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment is an autogenerated conversion function. -func Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in *MachineDeployment, out *v1alpha3.MachineDeployment, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(in, out, s) -} - -func autoConvert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in *v1alpha3.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment is an autogenerated conversion function. -func Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in *v1alpha3.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(in, out, s) -} - -func autoConvert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha3.MachineDeploymentList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.MachineDeployment, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_MachineDeployment_To_v1alpha3_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList is an autogenerated conversion function. -func Convert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha3.MachineDeploymentList, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in, out, s) -} - -func autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in *v1alpha3.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]MachineDeployment, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_MachineDeployment_To_v1alpha2_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList is an autogenerated conversion function. -func Convert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in *v1alpha3.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha2_MachineDeploymentList(in, out, s) -} - -func autoConvert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha3.MachineDeploymentSpec, s conversion.Scope) error { - out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - out.Selector = in.Selector - if err := Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - out.Strategy = (*v1alpha3.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) - out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) - out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) - out.Paused = in.Paused - out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) - return nil -} - -// Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec is an autogenerated conversion function. -func Convert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha3.MachineDeploymentSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in, out, s) -} - -func autoConvert_v1alpha3_MachineDeploymentSpec_To_v1alpha2_MachineDeploymentSpec(in *v1alpha3.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { - // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type - out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - out.Selector = in.Selector - if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - out.Strategy = (*MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) - out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) - out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) - out.Paused = in.Paused - out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) - return nil -} - -func autoConvert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha3.MachineDeploymentStatus, s conversion.Scope) error { - out.ObservedGeneration = in.ObservedGeneration - out.Selector = in.Selector - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.UnavailableReplicas = in.UnavailableReplicas - return nil -} - -// Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus is an autogenerated conversion function. -func Convert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha3.MachineDeploymentStatus, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in, out, s) -} - -func autoConvert_v1alpha3_MachineDeploymentStatus_To_v1alpha2_MachineDeploymentStatus(in *v1alpha3.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { - out.ObservedGeneration = in.ObservedGeneration - out.Selector = in.Selector - out.Replicas = in.Replicas - out.UpdatedReplicas = in.UpdatedReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.UnavailableReplicas = in.UnavailableReplicas - // WARNING: in.Phase requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha3.MachineDeploymentStrategy, s conversion.Scope) error { - out.Type = v1alpha3.MachineDeploymentStrategyType(in.Type) - out.RollingUpdate = (*v1alpha3.MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy is an autogenerated conversion function. -func Convert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha3.MachineDeploymentStrategy, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in, out, s) -} - -func autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in *v1alpha3.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { - out.Type = MachineDeploymentStrategyType(in.Type) - out.RollingUpdate = (*MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) - return nil -} - -// Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy is an autogenerated conversion function. -func Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in *v1alpha3.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha2_MachineDeploymentStrategy(in, out, s) -} - -func autoConvert_v1alpha2_MachineList_To_v1alpha3_MachineList(in *MachineList, out *v1alpha3.MachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.Machine, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_Machine_To_v1alpha3_Machine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_MachineList_To_v1alpha3_MachineList is an autogenerated conversion function. -func Convert_v1alpha2_MachineList_To_v1alpha3_MachineList(in *MachineList, out *v1alpha3.MachineList, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineList_To_v1alpha3_MachineList(in, out, s) -} - -func autoConvert_v1alpha3_MachineList_To_v1alpha2_MachineList(in *v1alpha3.MachineList, out *MachineList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Machine, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_Machine_To_v1alpha2_Machine(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_MachineList_To_v1alpha2_MachineList is an autogenerated conversion function. -func Convert_v1alpha3_MachineList_To_v1alpha2_MachineList(in *v1alpha3.MachineList, out *MachineList, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineList_To_v1alpha2_MachineList(in, out, s) -} - -func autoConvert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha3.MachineRollingUpdateDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - return nil -} - -// Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment is an autogenerated conversion function. -func Convert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha3.MachineRollingUpdateDeployment, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in, out, s) -} - -func autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in *v1alpha3.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { - out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) - out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) - return nil -} - -// Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment is an autogenerated conversion function. -func Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in *v1alpha3.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha2_MachineRollingUpdateDeployment(in, out, s) -} - -func autoConvert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in *MachineSet, out *v1alpha3.MachineSet, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet is an autogenerated conversion function. -func Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in *MachineSet, out *v1alpha3.MachineSet, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(in, out, s) -} - -func autoConvert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in *v1alpha3.MachineSet, out *MachineSet, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet is an autogenerated conversion function. -func Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in *v1alpha3.MachineSet, out *MachineSet, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(in, out, s) -} - -func autoConvert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in *MachineSetList, out *v1alpha3.MachineSetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.MachineSet, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_MachineSet_To_v1alpha3_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList is an autogenerated conversion function. -func Convert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in *MachineSetList, out *v1alpha3.MachineSetList, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineSetList_To_v1alpha3_MachineSetList(in, out, s) -} - -func autoConvert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in *v1alpha3.MachineSetList, out *MachineSetList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]MachineSet, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_MachineSet_To_v1alpha2_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList is an autogenerated conversion function. -func Convert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in *v1alpha3.MachineSetList, out *MachineSetList, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineSetList_To_v1alpha2_MachineSetList(in, out, s) -} - -func autoConvert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *MachineSetSpec, out *v1alpha3.MachineSetSpec, s conversion.Scope) error { - out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - out.MinReadySeconds = in.MinReadySeconds - out.DeletePolicy = in.DeletePolicy - out.Selector = in.Selector - if err := Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec is an autogenerated conversion function. -func Convert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *MachineSetSpec, out *v1alpha3.MachineSetSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineSetSpec_To_v1alpha3_MachineSetSpec(in, out, s) -} - -func autoConvert_v1alpha3_MachineSetSpec_To_v1alpha2_MachineSetSpec(in *v1alpha3.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { - // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type - out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - out.MinReadySeconds = in.MinReadySeconds - out.DeletePolicy = in.DeletePolicy - out.Selector = in.Selector - if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha2_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *MachineSetStatus, out *v1alpha3.MachineSetStatus, s conversion.Scope) error { - out.Selector = in.Selector - out.Replicas = in.Replicas - out.FullyLabeledReplicas = in.FullyLabeledReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.ObservedGeneration = in.ObservedGeneration - // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type - // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_MachineSetStatus_To_v1alpha2_MachineSetStatus(in *v1alpha3.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { - out.Selector = in.Selector - out.Replicas = in.Replicas - out.FullyLabeledReplicas = in.FullyLabeledReplicas - out.ReadyReplicas = in.ReadyReplicas - out.AvailableReplicas = in.AvailableReplicas - out.ObservedGeneration = in.ObservedGeneration - // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type - // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(in *MachineSpec, out *v1alpha3.MachineSpec, s conversion.Scope) error { - // WARNING: in.ObjectMeta requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha2_Bootstrap_To_v1alpha3_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { - return err - } - out.InfrastructureRef = in.InfrastructureRef - out.Version = (*string)(unsafe.Pointer(in.Version)) - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - return nil -} - -func autoConvert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(in *v1alpha3.MachineSpec, out *MachineSpec, s conversion.Scope) error { - // WARNING: in.ClusterName requires manual conversion: does not exist in peer-type - if err := Convert_v1alpha3_Bootstrap_To_v1alpha2_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { - return err - } - out.InfrastructureRef = in.InfrastructureRef - out.Version = (*string)(unsafe.Pointer(in.Version)) - out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) - // WARNING: in.FailureDomain requires manual conversion: does not exist in peer-type - // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_MachineStatus_To_v1alpha3_MachineStatus(in *MachineStatus, out *v1alpha3.MachineStatus, s conversion.Scope) error { - out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) - out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) - out.Version = (*string)(unsafe.Pointer(in.Version)) - // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type - // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type - out.Addresses = *(*v1alpha3.MachineAddresses)(unsafe.Pointer(&in.Addresses)) - out.Phase = in.Phase - out.BootstrapReady = in.BootstrapReady - out.InfrastructureReady = in.InfrastructureReady - return nil -} - -func autoConvert_v1alpha3_MachineStatus_To_v1alpha2_MachineStatus(in *v1alpha3.MachineStatus, out *MachineStatus, s conversion.Scope) error { - out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) - out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) - out.Version = (*string)(unsafe.Pointer(in.Version)) - // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type - // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type - out.Addresses = *(*MachineAddresses)(unsafe.Pointer(&in.Addresses)) - out.Phase = in.Phase - out.BootstrapReady = in.BootstrapReady - out.InfrastructureReady = in.InfrastructureReady - // WARNING: in.ObservedGeneration requires manual conversion: does not exist in peer-type - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha3.MachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := Convert_v1alpha2_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha3.MachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in *v1alpha3.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { - return err - } - if err := Convert_v1alpha3_MachineSpec_To_v1alpha2_MachineSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in *v1alpha3.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha2_MachineTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in *NetworkRanges, out *v1alpha3.NetworkRanges, s conversion.Scope) error { - out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) - return nil -} - -// Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges is an autogenerated conversion function. -func Convert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in *NetworkRanges, out *v1alpha3.NetworkRanges, s conversion.Scope) error { - return autoConvert_v1alpha2_NetworkRanges_To_v1alpha3_NetworkRanges(in, out, s) -} - -func autoConvert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in *v1alpha3.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { - out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) - return nil -} - -// Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges is an autogenerated conversion function. -func Convert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in *v1alpha3.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { - return autoConvert_v1alpha3_NetworkRanges_To_v1alpha2_NetworkRanges(in, out, s) -} - -func autoConvert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in *ObjectMeta, out *v1alpha3.ObjectMeta, s conversion.Scope) error { - out.Name = in.Name - out.GenerateName = in.GenerateName - out.Namespace = in.Namespace - out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) - out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) - out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) - return nil -} - -// Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta is an autogenerated conversion function. -func Convert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in *ObjectMeta, out *v1alpha3.ObjectMeta, s conversion.Scope) error { - return autoConvert_v1alpha2_ObjectMeta_To_v1alpha3_ObjectMeta(in, out, s) -} - -func autoConvert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in *v1alpha3.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { - out.Name = in.Name - out.GenerateName = in.GenerateName - out.Namespace = in.Namespace - out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) - out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) - out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) - return nil -} - -// Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta is an autogenerated conversion function. -func Convert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in *v1alpha3.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { - return autoConvert_v1alpha3_ObjectMeta_To_v1alpha2_ObjectMeta(in, out, s) -} diff --git a/api/v1alpha3/cluster_types.go b/api/v1alpha3/cluster_types.go index 79eb71063219..3d62c28ae419 100644 --- a/api/v1alpha3/cluster_types.go +++ b/api/v1alpha3/cluster_types.go @@ -197,7 +197,6 @@ func (v APIEndpoint) String() string { // +kubebuilder:object:root=true // +kubebuilder:resource:path=clusters,shortName=cl,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Cluster status such as Pending/Provisioning/Provisioned/Deleting/Failed" diff --git a/api/v1alpha3/conversion.go b/api/v1alpha3/conversion.go index 99dbce979afb..feac0b4e45cd 100644 --- a/api/v1alpha3/conversion.go +++ b/api/v1alpha3/conversion.go @@ -16,13 +16,127 @@ limitations under the License. package v1alpha3 -func (*Cluster) Hub() {} -func (*ClusterList) Hub() {} -func (*Machine) Hub() {} -func (*MachineList) Hub() {} -func (*MachineSet) Hub() {} -func (*MachineSetList) Hub() {} -func (*MachineDeployment) Hub() {} -func (*MachineDeploymentList) Hub() {} -func (*MachineHealthCheck) Hub() {} -func (*MachineHealthCheckList) Hub() {} +import ( + "sigs.k8s.io/cluster-api/api/v1alpha4" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.Cluster) + + return Convert_v1alpha3_Cluster_To_v1alpha4_Cluster(src, dst, nil) +} + +func (dst *Cluster) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.Cluster) + + return Convert_v1alpha4_Cluster_To_v1alpha3_Cluster(src, dst, nil) +} + +func (src *ClusterList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.ClusterList) + + return Convert_v1alpha3_ClusterList_To_v1alpha4_ClusterList(src, dst, nil) +} + +func (dst *ClusterList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.ClusterList) + + return Convert_v1alpha4_ClusterList_To_v1alpha3_ClusterList(src, dst, nil) +} + +func (src *Machine) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.Machine) + + return Convert_v1alpha3_Machine_To_v1alpha4_Machine(src, dst, nil) +} + +func (dst *Machine) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.Machine) + + return Convert_v1alpha4_Machine_To_v1alpha3_Machine(src, dst, nil) +} + +func (src *MachineList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineList) + + return Convert_v1alpha3_MachineList_To_v1alpha4_MachineList(src, dst, nil) +} + +func (dst *MachineList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineList) + + return Convert_v1alpha4_MachineList_To_v1alpha3_MachineList(src, dst, nil) +} + +func (src *MachineSet) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineSet) + + return Convert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(src, dst, nil) +} + +func (dst *MachineSet) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineSet) + + return Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(src, dst, nil) +} + +func (src *MachineSetList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineSetList) + + return Convert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(src, dst, nil) +} + +func (dst *MachineSetList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineSetList) + + return Convert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(src, dst, nil) +} + +func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineDeployment) + + return Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(src, dst, nil) +} + +func (dst *MachineDeployment) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineDeployment) + + return Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(src, dst, nil) +} + +func (src *MachineDeploymentList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineDeploymentList) + + return Convert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(src, dst, nil) +} + +func (dst *MachineDeploymentList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineDeploymentList) + + return Convert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(src, dst, nil) +} + +func (src *MachineHealthCheck) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineHealthCheck) + + return Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(src, dst, nil) +} + +func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineHealthCheck) + + return Convert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck(src, dst, nil) +} + +func (src *MachineHealthCheckList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*v1alpha4.MachineHealthCheckList) + + return Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(src, dst, nil) +} + +func (dst *MachineHealthCheckList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.MachineHealthCheckList) + + return Convert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(src, dst, nil) +} diff --git a/api/v1alpha3/conversion_test.go b/api/v1alpha3/conversion_test.go new file mode 100644 index 000000000000..1e0c2de3941e --- /dev/null +++ b/api/v1alpha3/conversion_test.go @@ -0,0 +1,39 @@ +/* +Copyright 2020 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 v1alpha3 + +import ( + "testing" + + . "github.com/onsi/gomega" + + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/cluster-api/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 Cluster", utilconversion.FuzzTestFunc(scheme, &v1alpha4.Cluster{}, &Cluster{})) + t.Run("for Machine", utilconversion.FuzzTestFunc(scheme, &v1alpha4.Machine{}, &Machine{})) + t.Run("for MachineSet", utilconversion.FuzzTestFunc(scheme, &v1alpha4.MachineSet{}, &MachineSet{})) + t.Run("for MachineDeployment", utilconversion.FuzzTestFunc(scheme, &v1alpha4.MachineDeployment{}, &MachineDeployment{})) +} diff --git a/api/v1alpha3/doc.go b/api/v1alpha3/doc.go index 999cec2ac553..f0da60a3f35e 100644 --- a/api/v1alpha3/doc.go +++ b/api/v1alpha3/doc.go @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/api/v1alpha4 package v1alpha3 diff --git a/api/v1alpha3/groupversion_info.go b/api/v1alpha3/groupversion_info.go index 75c56d621805..a4cc23271a73 100644 --- a/api/v1alpha3/groupversion_info.go +++ b/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/api/v1alpha3/machine_types.go b/api/v1alpha3/machine_types.go index 43ab63c312cc..c52729b0d3cf 100644 --- a/api/v1alpha3/machine_types.go +++ b/api/v1alpha3/machine_types.go @@ -239,7 +239,6 @@ type Bootstrap struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=machines,shortName=ma,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="Provider ID" // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Machine status such as Terminating/Pending/Running/Failed etc" // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version",description="Kubernetes version associated with this Machine" diff --git a/api/v1alpha3/machinedeployment_types.go b/api/v1alpha3/machinedeployment_types.go index b249caa3ba45..959c1c794328 100644 --- a/api/v1alpha3/machinedeployment_types.go +++ b/api/v1alpha3/machinedeployment_types.go @@ -241,7 +241,6 @@ func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase { // +kubebuilder:object:root=true // +kubebuilder:resource:path=machinedeployments,shortName=md,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="MachineDeployment status such as ScalingUp/ScalingDown/Running/Failed/Unknown" diff --git a/api/v1alpha3/machinehealthcheck_types.go b/api/v1alpha3/machinehealthcheck_types.go index 0e8b70adf64e..0b0b55a1555e 100644 --- a/api/v1alpha3/machinehealthcheck_types.go +++ b/api/v1alpha3/machinehealthcheck_types.go @@ -97,7 +97,6 @@ type MachineHealthCheckStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=machinehealthchecks,shortName=mhc;mhcs,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="MaxUnhealthy",type="string",JSONPath=".spec.maxUnhealthy",description="Maximum number of unhealthy machines allowed" // +kubebuilder:printcolumn:name="ExpectedMachines",type="integer",JSONPath=".status.expectedMachines",description="Number of machines currently monitored" diff --git a/api/v1alpha3/machineset_types.go b/api/v1alpha3/machineset_types.go index 45c69a569968..927641d8b9f8 100644 --- a/api/v1alpha3/machineset_types.go +++ b/api/v1alpha3/machineset_types.go @@ -185,7 +185,6 @@ func (m *MachineSet) Validate() field.ErrorList { // +kubebuilder:object:root=true // +kubebuilder:resource:path=machinesets,shortName=ms,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector // +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".status.replicas",description="Total number of non-terminated machines targeted by this machineset" diff --git a/api/v1alpha3/zz_generated.conversion.go b/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..973eef514e6b --- /dev/null +++ b/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,1267 @@ +// +build !ignore_autogenerated_core_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 v1alpha3 + +import ( + unsafe "unsafe" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" + v1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + errors "sigs.k8s.io/cluster-api/errors" +) + +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_v1alpha3_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_v1alpha3_APIEndpoint(a.(*v1alpha4.APIEndpoint), b.(*APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Bootstrap)(nil), (*v1alpha4.Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(a.(*Bootstrap), b.(*v1alpha4.Bootstrap), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Bootstrap)(nil), (*Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(a.(*v1alpha4.Bootstrap), b.(*Bootstrap), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Cluster)(nil), (*v1alpha4.Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Cluster_To_v1alpha4_Cluster(a.(*Cluster), b.(*v1alpha4.Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Cluster)(nil), (*Cluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Cluster_To_v1alpha3_Cluster(a.(*v1alpha4.Cluster), b.(*Cluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterList)(nil), (*v1alpha4.ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterList_To_v1alpha4_ClusterList(a.(*ClusterList), b.(*v1alpha4.ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterList)(nil), (*ClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterList_To_v1alpha3_ClusterList(a.(*v1alpha4.ClusterList), b.(*ClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterNetwork)(nil), (*v1alpha4.ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterNetwork_To_v1alpha4_ClusterNetwork(a.(*ClusterNetwork), b.(*v1alpha4.ClusterNetwork), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterNetwork)(nil), (*ClusterNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterNetwork_To_v1alpha3_ClusterNetwork(a.(*v1alpha4.ClusterNetwork), b.(*ClusterNetwork), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterSpec)(nil), (*v1alpha4.ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec(a.(*ClusterSpec), b.(*v1alpha4.ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec(a.(*v1alpha4.ClusterSpec), b.(*ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1alpha4.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_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_v1alpha3_ClusterStatus(a.(*v1alpha4.ClusterStatus), b.(*ClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Condition)(nil), (*v1alpha4.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Condition_To_v1alpha4_Condition(a.(*Condition), b.(*v1alpha4.Condition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Condition)(nil), (*Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Condition_To_v1alpha3_Condition(a.(*v1alpha4.Condition), b.(*Condition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*FailureDomainSpec)(nil), (*v1alpha4.FailureDomainSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(a.(*FailureDomainSpec), b.(*v1alpha4.FailureDomainSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.FailureDomainSpec)(nil), (*FailureDomainSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(a.(*v1alpha4.FailureDomainSpec), b.(*FailureDomainSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Machine)(nil), (*v1alpha4.Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Machine_To_v1alpha4_Machine(a.(*Machine), b.(*v1alpha4.Machine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Machine)(nil), (*Machine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Machine_To_v1alpha3_Machine(a.(*v1alpha4.Machine), b.(*Machine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineAddress)(nil), (*v1alpha4.MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(a.(*MachineAddress), b.(*v1alpha4.MachineAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineAddress)(nil), (*MachineAddress)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(a.(*v1alpha4.MachineAddress), b.(*MachineAddress), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeployment)(nil), (*v1alpha4.MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(a.(*MachineDeployment), b.(*v1alpha4.MachineDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineDeployment)(nil), (*MachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(a.(*v1alpha4.MachineDeployment), b.(*MachineDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentList)(nil), (*v1alpha4.MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(a.(*MachineDeploymentList), b.(*v1alpha4.MachineDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineDeploymentList)(nil), (*MachineDeploymentList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(a.(*v1alpha4.MachineDeploymentList), b.(*MachineDeploymentList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentSpec)(nil), (*v1alpha4.MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(a.(*MachineDeploymentSpec), b.(*v1alpha4.MachineDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineDeploymentSpec)(nil), (*MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(a.(*v1alpha4.MachineDeploymentSpec), b.(*MachineDeploymentSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentStatus)(nil), (*v1alpha4.MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(a.(*MachineDeploymentStatus), b.(*v1alpha4.MachineDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineDeploymentStatus)(nil), (*MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(a.(*v1alpha4.MachineDeploymentStatus), b.(*MachineDeploymentStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineDeploymentStrategy)(nil), (*v1alpha4.MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy(a.(*MachineDeploymentStrategy), b.(*v1alpha4.MachineDeploymentStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineDeploymentStrategy)(nil), (*MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(a.(*v1alpha4.MachineDeploymentStrategy), b.(*MachineDeploymentStrategy), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineHealthCheck)(nil), (*v1alpha4.MachineHealthCheck)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(a.(*MachineHealthCheck), b.(*v1alpha4.MachineHealthCheck), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineHealthCheck)(nil), (*MachineHealthCheck)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck(a.(*v1alpha4.MachineHealthCheck), b.(*MachineHealthCheck), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineHealthCheckList)(nil), (*v1alpha4.MachineHealthCheckList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(a.(*MachineHealthCheckList), b.(*v1alpha4.MachineHealthCheckList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineHealthCheckList)(nil), (*MachineHealthCheckList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(a.(*v1alpha4.MachineHealthCheckList), b.(*MachineHealthCheckList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineHealthCheckSpec)(nil), (*v1alpha4.MachineHealthCheckSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(a.(*MachineHealthCheckSpec), b.(*v1alpha4.MachineHealthCheckSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineHealthCheckSpec)(nil), (*MachineHealthCheckSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(a.(*v1alpha4.MachineHealthCheckSpec), b.(*MachineHealthCheckSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineHealthCheckStatus)(nil), (*v1alpha4.MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(a.(*MachineHealthCheckStatus), b.(*v1alpha4.MachineHealthCheckStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineHealthCheckStatus)(nil), (*MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(a.(*v1alpha4.MachineHealthCheckStatus), b.(*MachineHealthCheckStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1alpha4.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineList_To_v1alpha4_MachineList(a.(*MachineList), b.(*v1alpha4.MachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineList)(nil), (*MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineList_To_v1alpha3_MachineList(a.(*v1alpha4.MachineList), b.(*MachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineRollingUpdateDeployment)(nil), (*v1alpha4.MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(a.(*MachineRollingUpdateDeployment), b.(*v1alpha4.MachineRollingUpdateDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineRollingUpdateDeployment)(nil), (*MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(a.(*v1alpha4.MachineRollingUpdateDeployment), b.(*MachineRollingUpdateDeployment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSet)(nil), (*v1alpha4.MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(a.(*MachineSet), b.(*v1alpha4.MachineSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineSet)(nil), (*MachineSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(a.(*v1alpha4.MachineSet), b.(*MachineSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSetList)(nil), (*v1alpha4.MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(a.(*MachineSetList), b.(*v1alpha4.MachineSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineSetList)(nil), (*MachineSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(a.(*v1alpha4.MachineSetList), b.(*MachineSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSetSpec)(nil), (*v1alpha4.MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec(a.(*MachineSetSpec), b.(*v1alpha4.MachineSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineSetSpec)(nil), (*MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec(a.(*v1alpha4.MachineSetSpec), b.(*MachineSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSetStatus)(nil), (*v1alpha4.MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus(a.(*MachineSetStatus), b.(*v1alpha4.MachineSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineSetStatus)(nil), (*MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus(a.(*v1alpha4.MachineSetStatus), b.(*MachineSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineSpec)(nil), (*v1alpha4.MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(a.(*MachineSpec), b.(*v1alpha4.MachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineSpec)(nil), (*MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(a.(*v1alpha4.MachineSpec), b.(*MachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineStatus)(nil), (*v1alpha4.MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus(a.(*MachineStatus), b.(*v1alpha4.MachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineStatus)(nil), (*MachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus(a.(*v1alpha4.MachineStatus), b.(*MachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachineTemplateSpec)(nil), (*v1alpha4.MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(a.(*MachineTemplateSpec), b.(*v1alpha4.MachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachineTemplateSpec)(nil), (*MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(a.(*v1alpha4.MachineTemplateSpec), b.(*MachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NetworkRanges)(nil), (*v1alpha4.NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_NetworkRanges_To_v1alpha4_NetworkRanges(a.(*NetworkRanges), b.(*v1alpha4.NetworkRanges), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.NetworkRanges)(nil), (*NetworkRanges)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_NetworkRanges_To_v1alpha3_NetworkRanges(a.(*v1alpha4.NetworkRanges), b.(*NetworkRanges), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ObjectMeta)(nil), (*v1alpha4.ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta(a.(*ObjectMeta), b.(*v1alpha4.ObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ObjectMeta)(nil), (*ObjectMeta)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta(a.(*v1alpha4.ObjectMeta), b.(*ObjectMeta), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*UnhealthyCondition)(nil), (*v1alpha4.UnhealthyCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_UnhealthyCondition_To_v1alpha4_UnhealthyCondition(a.(*UnhealthyCondition), b.(*v1alpha4.UnhealthyCondition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.UnhealthyCondition)(nil), (*UnhealthyCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_UnhealthyCondition_To_v1alpha3_UnhealthyCondition(a.(*v1alpha4.UnhealthyCondition), b.(*UnhealthyCondition), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = in.Port + return nil +} + +// Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = in.Port + return nil +} + +// Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in *Bootstrap, out *v1alpha4.Bootstrap, s conversion.Scope) error { + out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) + out.Data = (*string)(unsafe.Pointer(in.Data)) + out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) + return nil +} + +// Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap is an autogenerated conversion function. +func Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in *Bootstrap, out *v1alpha4.Bootstrap, s conversion.Scope) error { + return autoConvert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in, out, s) +} + +func autoConvert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(in *v1alpha4.Bootstrap, out *Bootstrap, s conversion.Scope) error { + out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) + out.Data = (*string)(unsafe.Pointer(in.Data)) + out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) + return nil +} + +// Convert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap is an autogenerated conversion function. +func Convert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(in *v1alpha4.Bootstrap, out *Bootstrap, s conversion.Scope) error { + return autoConvert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(in, out, s) +} + +func autoConvert_v1alpha3_Cluster_To_v1alpha4_Cluster(in *Cluster, out *v1alpha4.Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_ClusterStatus_To_v1alpha4_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Cluster_To_v1alpha4_Cluster is an autogenerated conversion function. +func Convert_v1alpha3_Cluster_To_v1alpha4_Cluster(in *Cluster, out *v1alpha4.Cluster, s conversion.Scope) error { + return autoConvert_v1alpha3_Cluster_To_v1alpha4_Cluster(in, out, s) +} + +func autoConvert_v1alpha4_Cluster_To_v1alpha3_Cluster(in *v1alpha4.Cluster, out *Cluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_ClusterStatus_To_v1alpha3_ClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_Cluster_To_v1alpha3_Cluster is an autogenerated conversion function. +func Convert_v1alpha4_Cluster_To_v1alpha3_Cluster(in *v1alpha4.Cluster, out *Cluster, s conversion.Scope) error { + return autoConvert_v1alpha4_Cluster_To_v1alpha3_Cluster(in, out, s) +} + +func autoConvert_v1alpha3_ClusterList_To_v1alpha4_ClusterList(in *ClusterList, out *v1alpha4.ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.Cluster)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_ClusterList_To_v1alpha4_ClusterList is an autogenerated conversion function. +func Convert_v1alpha3_ClusterList_To_v1alpha4_ClusterList(in *ClusterList, out *v1alpha4.ClusterList, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterList_To_v1alpha4_ClusterList(in, out, s) +} + +func autoConvert_v1alpha4_ClusterList_To_v1alpha3_ClusterList(in *v1alpha4.ClusterList, out *ClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Cluster)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_ClusterList_To_v1alpha3_ClusterList is an autogenerated conversion function. +func Convert_v1alpha4_ClusterList_To_v1alpha3_ClusterList(in *v1alpha4.ClusterList, out *ClusterList, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterList_To_v1alpha3_ClusterList(in, out, s) +} + +func autoConvert_v1alpha3_ClusterNetwork_To_v1alpha4_ClusterNetwork(in *ClusterNetwork, out *v1alpha4.ClusterNetwork, s conversion.Scope) error { + out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) + out.Services = (*v1alpha4.NetworkRanges)(unsafe.Pointer(in.Services)) + out.Pods = (*v1alpha4.NetworkRanges)(unsafe.Pointer(in.Pods)) + out.ServiceDomain = in.ServiceDomain + return nil +} + +// Convert_v1alpha3_ClusterNetwork_To_v1alpha4_ClusterNetwork is an autogenerated conversion function. +func Convert_v1alpha3_ClusterNetwork_To_v1alpha4_ClusterNetwork(in *ClusterNetwork, out *v1alpha4.ClusterNetwork, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterNetwork_To_v1alpha4_ClusterNetwork(in, out, s) +} + +func autoConvert_v1alpha4_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *v1alpha4.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { + out.APIServerPort = (*int32)(unsafe.Pointer(in.APIServerPort)) + out.Services = (*NetworkRanges)(unsafe.Pointer(in.Services)) + out.Pods = (*NetworkRanges)(unsafe.Pointer(in.Pods)) + out.ServiceDomain = in.ServiceDomain + return nil +} + +// Convert_v1alpha4_ClusterNetwork_To_v1alpha3_ClusterNetwork is an autogenerated conversion function. +func Convert_v1alpha4_ClusterNetwork_To_v1alpha3_ClusterNetwork(in *v1alpha4.ClusterNetwork, out *ClusterNetwork, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterNetwork_To_v1alpha3_ClusterNetwork(in, out, s) +} + +func autoConvert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec(in *ClusterSpec, out *v1alpha4.ClusterSpec, s conversion.Scope) error { + out.Paused = in.Paused + out.ClusterNetwork = (*v1alpha4.ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) + if err := Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { + return err + } + out.ControlPlaneRef = (*v1.ObjectReference)(unsafe.Pointer(in.ControlPlaneRef)) + out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) + return nil +} + +// Convert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec is an autogenerated conversion function. +func Convert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec(in *ClusterSpec, out *v1alpha4.ClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterSpec_To_v1alpha4_ClusterSpec(in, out, s) +} + +func autoConvert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec(in *v1alpha4.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { + out.Paused = in.Paused + out.ClusterNetwork = (*ClusterNetwork)(unsafe.Pointer(in.ClusterNetwork)) + if err := Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { + return err + } + out.ControlPlaneRef = (*v1.ObjectReference)(unsafe.Pointer(in.ControlPlaneRef)) + out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) + return nil +} + +// Convert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec is an autogenerated conversion function. +func Convert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec(in *v1alpha4.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterSpec_To_v1alpha3_ClusterSpec(in, out, s) +} + +func autoConvert_v1alpha3_ClusterStatus_To_v1alpha4_ClusterStatus(in *ClusterStatus, out *v1alpha4.ClusterStatus, s conversion.Scope) error { + out.FailureDomains = *(*v1alpha4.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) + out.FailureReason = (*errors.ClusterStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Phase = in.Phase + out.InfrastructureReady = in.InfrastructureReady + out.ControlPlaneInitialized = in.ControlPlaneInitialized + out.ControlPlaneReady = in.ControlPlaneReady + out.Conditions = *(*v1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_v1alpha3_ClusterStatus_To_v1alpha4_ClusterStatus is an autogenerated conversion function. +func Convert_v1alpha3_ClusterStatus_To_v1alpha4_ClusterStatus(in *ClusterStatus, out *v1alpha4.ClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterStatus_To_v1alpha4_ClusterStatus(in, out, s) +} + +func autoConvert_v1alpha4_ClusterStatus_To_v1alpha3_ClusterStatus(in *v1alpha4.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { + out.FailureDomains = *(*FailureDomains)(unsafe.Pointer(&in.FailureDomains)) + out.FailureReason = (*errors.ClusterStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Phase = in.Phase + out.InfrastructureReady = in.InfrastructureReady + out.ControlPlaneInitialized = in.ControlPlaneInitialized + out.ControlPlaneReady = in.ControlPlaneReady + out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + out.ObservedGeneration = in.ObservedGeneration + return nil +} + +// Convert_v1alpha4_ClusterStatus_To_v1alpha3_ClusterStatus is an autogenerated conversion function. +func Convert_v1alpha4_ClusterStatus_To_v1alpha3_ClusterStatus(in *v1alpha4.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterStatus_To_v1alpha3_ClusterStatus(in, out, s) +} + +func autoConvert_v1alpha3_Condition_To_v1alpha4_Condition(in *Condition, out *v1alpha4.Condition, s conversion.Scope) error { + out.Type = v1alpha4.ConditionType(in.Type) + out.Status = v1.ConditionStatus(in.Status) + out.Severity = v1alpha4.ConditionSeverity(in.Severity) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha3_Condition_To_v1alpha4_Condition is an autogenerated conversion function. +func Convert_v1alpha3_Condition_To_v1alpha4_Condition(in *Condition, out *v1alpha4.Condition, s conversion.Scope) error { + return autoConvert_v1alpha3_Condition_To_v1alpha4_Condition(in, out, s) +} + +func autoConvert_v1alpha4_Condition_To_v1alpha3_Condition(in *v1alpha4.Condition, out *Condition, s conversion.Scope) error { + out.Type = ConditionType(in.Type) + out.Status = v1.ConditionStatus(in.Status) + out.Severity = ConditionSeverity(in.Severity) + out.LastTransitionTime = in.LastTransitionTime + out.Reason = in.Reason + out.Message = in.Message + return nil +} + +// Convert_v1alpha4_Condition_To_v1alpha3_Condition is an autogenerated conversion function. +func Convert_v1alpha4_Condition_To_v1alpha3_Condition(in *v1alpha4.Condition, out *Condition, s conversion.Scope) error { + return autoConvert_v1alpha4_Condition_To_v1alpha3_Condition(in, out, s) +} + +func autoConvert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(in *FailureDomainSpec, out *v1alpha4.FailureDomainSpec, s conversion.Scope) error { + out.ControlPlane = in.ControlPlane + out.Attributes = *(*map[string]string)(unsafe.Pointer(&in.Attributes)) + return nil +} + +// Convert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec is an autogenerated conversion function. +func Convert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(in *FailureDomainSpec, out *v1alpha4.FailureDomainSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(in, out, s) +} + +func autoConvert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(in *v1alpha4.FailureDomainSpec, out *FailureDomainSpec, s conversion.Scope) error { + out.ControlPlane = in.ControlPlane + out.Attributes = *(*map[string]string)(unsafe.Pointer(&in.Attributes)) + return nil +} + +// Convert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec is an autogenerated conversion function. +func Convert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(in *v1alpha4.FailureDomainSpec, out *FailureDomainSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(in, out, s) +} + +func autoConvert_v1alpha3_Machine_To_v1alpha4_Machine(in *Machine, out *v1alpha4.Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_Machine_To_v1alpha4_Machine is an autogenerated conversion function. +func Convert_v1alpha3_Machine_To_v1alpha4_Machine(in *Machine, out *v1alpha4.Machine, s conversion.Scope) error { + return autoConvert_v1alpha3_Machine_To_v1alpha4_Machine(in, out, s) +} + +func autoConvert_v1alpha4_Machine_To_v1alpha3_Machine(in *v1alpha4.Machine, out *Machine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_Machine_To_v1alpha3_Machine is an autogenerated conversion function. +func Convert_v1alpha4_Machine_To_v1alpha3_Machine(in *v1alpha4.Machine, out *Machine, s conversion.Scope) error { + return autoConvert_v1alpha4_Machine_To_v1alpha3_Machine(in, out, s) +} + +func autoConvert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(in *MachineAddress, out *v1alpha4.MachineAddress, s conversion.Scope) error { + out.Type = v1alpha4.MachineAddressType(in.Type) + out.Address = in.Address + return nil +} + +// Convert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress is an autogenerated conversion function. +func Convert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(in *MachineAddress, out *v1alpha4.MachineAddress, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(in, out, s) +} + +func autoConvert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(in *v1alpha4.MachineAddress, out *MachineAddress, s conversion.Scope) error { + out.Type = MachineAddressType(in.Type) + out.Address = in.Address + return nil +} + +// Convert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress is an autogenerated conversion function. +func Convert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(in *v1alpha4.MachineAddress, out *MachineAddress, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(in *MachineDeployment, out *v1alpha4.MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(in *MachineDeployment, out *v1alpha4.MachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(in, out, s) +} + +func autoConvert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(in *v1alpha4.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment is an autogenerated conversion function. +func Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(in *v1alpha4.MachineDeployment, out *MachineDeployment, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha4.MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.MachineDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha4.MachineDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(in, out, s) +} + +func autoConvert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *v1alpha4.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachineDeployment)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList is an autogenerated conversion function. +func Convert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *v1alpha4.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha4.MachineDeploymentSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Selector = in.Selector + if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.Strategy = (*v1alpha4.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +// Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(in *MachineDeploymentSpec, out *v1alpha4.MachineDeploymentSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *v1alpha4.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Selector = in.Selector + if err := Convert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + out.Strategy = (*MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.RevisionHistoryLimit = (*int32)(unsafe.Pointer(in.RevisionHistoryLimit)) + out.Paused = in.Paused + out.ProgressDeadlineSeconds = (*int32)(unsafe.Pointer(in.ProgressDeadlineSeconds)) + return nil +} + +// Convert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in *v1alpha4.MachineDeploymentSpec, out *MachineDeploymentSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha4.MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Phase = in.Phase + return nil +} + +// Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in *MachineDeploymentStatus, out *v1alpha4.MachineDeploymentStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in, out, s) +} + +func autoConvert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *v1alpha4.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Phase = in.Phase + return nil +} + +// Convert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus is an autogenerated conversion function. +func Convert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *v1alpha4.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in, out, s) +} + +func autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha4.MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = v1alpha4.MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*v1alpha4.MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_v1alpha3_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1alpha4.MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_v1alpha4_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *v1alpha4.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + out.Type = MachineDeploymentStrategyType(in.Type) + out.RollingUpdate = (*MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) + return nil +} + +// Convert_v1alpha4_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy is an autogenerated conversion function. +func Convert_v1alpha4_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in *v1alpha4.MachineDeploymentStrategy, out *MachineDeploymentStrategy, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineDeploymentStrategy_To_v1alpha3_MachineDeploymentStrategy(in, out, s) +} + +func autoConvert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(in *MachineHealthCheck, out *v1alpha4.MachineHealthCheck, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck is an autogenerated conversion function. +func Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(in *MachineHealthCheck, out *v1alpha4.MachineHealthCheck, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(in, out, s) +} + +func autoConvert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck(in *v1alpha4.MachineHealthCheck, out *MachineHealthCheck, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck is an autogenerated conversion function. +func Convert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck(in *v1alpha4.MachineHealthCheck, out *MachineHealthCheck, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineHealthCheck_To_v1alpha3_MachineHealthCheck(in, out, s) +} + +func autoConvert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(in *MachineHealthCheckList, out *v1alpha4.MachineHealthCheckList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.MachineHealthCheck)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList is an autogenerated conversion function. +func Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(in *MachineHealthCheckList, out *v1alpha4.MachineHealthCheckList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(in, out, s) +} + +func autoConvert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(in *v1alpha4.MachineHealthCheckList, out *MachineHealthCheckList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachineHealthCheck)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList is an autogenerated conversion function. +func Convert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(in *v1alpha4.MachineHealthCheckList, out *MachineHealthCheckList, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(in, out, s) +} + +func autoConvert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(in *MachineHealthCheckSpec, out *v1alpha4.MachineHealthCheckSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Selector = in.Selector + out.UnhealthyConditions = *(*[]v1alpha4.UnhealthyCondition)(unsafe.Pointer(&in.UnhealthyConditions)) + out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) + out.NodeStartupTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeStartupTimeout)) + return nil +} + +// Convert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(in *MachineHealthCheckSpec, out *v1alpha4.MachineHealthCheckSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(in *v1alpha4.MachineHealthCheckSpec, out *MachineHealthCheckSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Selector = in.Selector + out.UnhealthyConditions = *(*[]UnhealthyCondition)(unsafe.Pointer(&in.UnhealthyConditions)) + out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) + out.NodeStartupTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeStartupTimeout)) + return nil +} + +// Convert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(in *v1alpha4.MachineHealthCheckSpec, out *MachineHealthCheckSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in *MachineHealthCheckStatus, out *v1alpha4.MachineHealthCheckStatus, s conversion.Scope) error { + out.ExpectedMachines = in.ExpectedMachines + out.CurrentHealthy = in.CurrentHealthy + out.ObservedGeneration = in.ObservedGeneration + out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) + return nil +} + +// Convert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus is an autogenerated conversion function. +func Convert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in *MachineHealthCheckStatus, out *v1alpha4.MachineHealthCheckStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in, out, s) +} + +func autoConvert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in *v1alpha4.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s conversion.Scope) error { + out.ExpectedMachines = in.ExpectedMachines + out.CurrentHealthy = in.CurrentHealthy + out.ObservedGeneration = in.ObservedGeneration + out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) + return nil +} + +// Convert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus is an autogenerated conversion function. +func Convert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in *v1alpha4.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in, out, s) +} + +func autoConvert_v1alpha3_MachineList_To_v1alpha4_MachineList(in *MachineList, out *v1alpha4.MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.Machine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_MachineList_To_v1alpha4_MachineList is an autogenerated conversion function. +func Convert_v1alpha3_MachineList_To_v1alpha4_MachineList(in *MachineList, out *v1alpha4.MachineList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineList_To_v1alpha4_MachineList(in, out, s) +} + +func autoConvert_v1alpha4_MachineList_To_v1alpha3_MachineList(in *v1alpha4.MachineList, out *MachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Machine)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_MachineList_To_v1alpha3_MachineList is an autogenerated conversion function. +func Convert_v1alpha4_MachineList_To_v1alpha3_MachineList(in *v1alpha4.MachineList, out *MachineList, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineList_To_v1alpha3_MachineList(in, out, s) +} + +func autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha4.MachineRollingUpdateDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment is an autogenerated conversion function. +func Convert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in *MachineRollingUpdateDeployment, out *v1alpha4.MachineRollingUpdateDeployment, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineRollingUpdateDeployment_To_v1alpha4_MachineRollingUpdateDeployment(in, out, s) +} + +func autoConvert_v1alpha4_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *v1alpha4.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { + out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable)) + out.MaxSurge = (*intstr.IntOrString)(unsafe.Pointer(in.MaxSurge)) + return nil +} + +// Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment is an autogenerated conversion function. +func Convert_v1alpha4_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in *v1alpha4.MachineRollingUpdateDeployment, out *MachineRollingUpdateDeployment, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(in, out, s) +} + +func autoConvert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(in *MachineSet, out *v1alpha4.MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineSet_To_v1alpha4_MachineSet is an autogenerated conversion function. +func Convert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(in *MachineSet, out *v1alpha4.MachineSet, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(in, out, s) +} + +func autoConvert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(in *v1alpha4.MachineSet, out *MachineSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet is an autogenerated conversion function. +func Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(in *v1alpha4.MachineSet, out *MachineSet, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(in, out, s) +} + +func autoConvert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(in *MachineSetList, out *v1alpha4.MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.MachineSet)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList is an autogenerated conversion function. +func Convert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(in *MachineSetList, out *v1alpha4.MachineSetList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(in, out, s) +} + +func autoConvert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(in *v1alpha4.MachineSetList, out *MachineSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachineSet)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList is an autogenerated conversion function. +func Convert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(in *v1alpha4.MachineSetList, out *MachineSetList, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(in, out, s) +} + +func autoConvert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec(in *MachineSetSpec, out *v1alpha4.MachineSetSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.MinReadySeconds = in.MinReadySeconds + out.DeletePolicy = in.DeletePolicy + out.Selector = in.Selector + if err := Convert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec(in *MachineSetSpec, out *v1alpha4.MachineSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSetSpec_To_v1alpha4_MachineSetSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *v1alpha4.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.MinReadySeconds = in.MinReadySeconds + out.DeletePolicy = in.DeletePolicy + out.Selector = in.Selector + if err := Convert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec(in *v1alpha4.MachineSetSpec, out *MachineSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineSetSpec_To_v1alpha3_MachineSetSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus(in *MachineSetStatus, out *v1alpha4.MachineSetStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.ObservedGeneration = in.ObservedGeneration + out.FailureReason = (*errors.MachineSetStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + return nil +} + +// Convert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus is an autogenerated conversion function. +func Convert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus(in *MachineSetStatus, out *v1alpha4.MachineSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSetStatus_To_v1alpha4_MachineSetStatus(in, out, s) +} + +func autoConvert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *v1alpha4.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.FullyLabeledReplicas = in.FullyLabeledReplicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.ObservedGeneration = in.ObservedGeneration + out.FailureReason = (*errors.MachineSetStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + return nil +} + +// Convert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus is an autogenerated conversion function. +func Convert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *v1alpha4.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineSetStatus_To_v1alpha3_MachineSetStatus(in, out, s) +} + +func autoConvert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(in *MachineSpec, out *v1alpha4.MachineSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + if err := Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { + return err + } + out.InfrastructureRef = in.InfrastructureRef + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) + out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) + return nil +} + +// Convert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(in *MachineSpec, out *v1alpha4.MachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(in *v1alpha4.MachineSpec, out *MachineSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + if err := Convert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { + return err + } + out.InfrastructureRef = in.InfrastructureRef + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) + out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) + return nil +} + +// Convert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(in *v1alpha4.MachineSpec, out *MachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus(in *MachineStatus, out *v1alpha4.MachineStatus, s conversion.Scope) error { + out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) + out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Addresses = *(*v1alpha4.MachineAddresses)(unsafe.Pointer(&in.Addresses)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*v1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus is an autogenerated conversion function. +func Convert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus(in *MachineStatus, out *v1alpha4.MachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineStatus_To_v1alpha4_MachineStatus(in, out, s) +} + +func autoConvert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus(in *v1alpha4.MachineStatus, out *MachineStatus, s conversion.Scope) error { + out.NodeRef = (*v1.ObjectReference)(unsafe.Pointer(in.NodeRef)) + out.LastUpdated = (*metav1.Time)(unsafe.Pointer(in.LastUpdated)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.FailureReason = (*errors.MachineStatusError)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Addresses = *(*MachineAddresses)(unsafe.Pointer(&in.Addresses)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus is an autogenerated conversion function. +func Convert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus(in *v1alpha4.MachineStatus, out *MachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineStatus_To_v1alpha3_MachineStatus(in, out, s) +} + +func autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha4.MachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachineSpec_To_v1alpha4_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(in *MachineTemplateSpec, out *v1alpha4.MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *v1alpha4.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachineSpec_To_v1alpha3_MachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *v1alpha4.MachineTemplateSpec, out *MachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha3_NetworkRanges_To_v1alpha4_NetworkRanges(in *NetworkRanges, out *v1alpha4.NetworkRanges, s conversion.Scope) error { + out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) + return nil +} + +// Convert_v1alpha3_NetworkRanges_To_v1alpha4_NetworkRanges is an autogenerated conversion function. +func Convert_v1alpha3_NetworkRanges_To_v1alpha4_NetworkRanges(in *NetworkRanges, out *v1alpha4.NetworkRanges, s conversion.Scope) error { + return autoConvert_v1alpha3_NetworkRanges_To_v1alpha4_NetworkRanges(in, out, s) +} + +func autoConvert_v1alpha4_NetworkRanges_To_v1alpha3_NetworkRanges(in *v1alpha4.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { + out.CIDRBlocks = *(*[]string)(unsafe.Pointer(&in.CIDRBlocks)) + return nil +} + +// Convert_v1alpha4_NetworkRanges_To_v1alpha3_NetworkRanges is an autogenerated conversion function. +func Convert_v1alpha4_NetworkRanges_To_v1alpha3_NetworkRanges(in *v1alpha4.NetworkRanges, out *NetworkRanges, s conversion.Scope) error { + return autoConvert_v1alpha4_NetworkRanges_To_v1alpha3_NetworkRanges(in, out, s) +} + +func autoConvert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta(in *ObjectMeta, out *v1alpha4.ObjectMeta, s conversion.Scope) error { + out.Name = in.Name + out.GenerateName = in.GenerateName + out.Namespace = in.Namespace + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) + return nil +} + +// Convert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta is an autogenerated conversion function. +func Convert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta(in *ObjectMeta, out *v1alpha4.ObjectMeta, s conversion.Scope) error { + return autoConvert_v1alpha3_ObjectMeta_To_v1alpha4_ObjectMeta(in, out, s) +} + +func autoConvert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta(in *v1alpha4.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { + out.Name = in.Name + out.GenerateName = in.GenerateName + out.Namespace = in.Namespace + out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels)) + out.Annotations = *(*map[string]string)(unsafe.Pointer(&in.Annotations)) + out.OwnerReferences = *(*[]metav1.OwnerReference)(unsafe.Pointer(&in.OwnerReferences)) + return nil +} + +// Convert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta is an autogenerated conversion function. +func Convert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta(in *v1alpha4.ObjectMeta, out *ObjectMeta, s conversion.Scope) error { + return autoConvert_v1alpha4_ObjectMeta_To_v1alpha3_ObjectMeta(in, out, s) +} + +func autoConvert_v1alpha3_UnhealthyCondition_To_v1alpha4_UnhealthyCondition(in *UnhealthyCondition, out *v1alpha4.UnhealthyCondition, s conversion.Scope) error { + out.Type = v1.NodeConditionType(in.Type) + out.Status = v1.ConditionStatus(in.Status) + out.Timeout = in.Timeout + return nil +} + +// Convert_v1alpha3_UnhealthyCondition_To_v1alpha4_UnhealthyCondition is an autogenerated conversion function. +func Convert_v1alpha3_UnhealthyCondition_To_v1alpha4_UnhealthyCondition(in *UnhealthyCondition, out *v1alpha4.UnhealthyCondition, s conversion.Scope) error { + return autoConvert_v1alpha3_UnhealthyCondition_To_v1alpha4_UnhealthyCondition(in, out, s) +} + +func autoConvert_v1alpha4_UnhealthyCondition_To_v1alpha3_UnhealthyCondition(in *v1alpha4.UnhealthyCondition, out *UnhealthyCondition, s conversion.Scope) error { + out.Type = v1.NodeConditionType(in.Type) + out.Status = v1.ConditionStatus(in.Status) + out.Timeout = in.Timeout + return nil +} + +// Convert_v1alpha4_UnhealthyCondition_To_v1alpha3_UnhealthyCondition is an autogenerated conversion function. +func Convert_v1alpha4_UnhealthyCondition_To_v1alpha3_UnhealthyCondition(in *v1alpha4.UnhealthyCondition, out *UnhealthyCondition, s conversion.Scope) error { + return autoConvert_v1alpha4_UnhealthyCondition_To_v1alpha3_UnhealthyCondition(in, out, s) +} diff --git a/api/v1alpha2/cluster_phase_types.go b/api/v1alpha4/cluster_phase_types.go similarity index 83% rename from api/v1alpha2/cluster_phase_types.go rename to api/v1alpha4/cluster_phase_types.go index d63d70bcd644..49471c1f6641 100644 --- a/api/v1alpha2/cluster_phase_types.go +++ b/api/v1alpha4/cluster_phase_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 // ClusterPhase is a string representation of a Cluster Phase. // @@ -31,25 +31,25 @@ type ClusterPhase string const ( // ClusterPhasePending is the first state a Cluster is assigned by // Cluster API Cluster controller after being created. - ClusterPhasePending = ClusterPhase("pending") + ClusterPhasePending = ClusterPhase("Pending") // ClusterPhaseProvisioning is the state when the Cluster has a provider infrastructure // object associated and can start provisioning. - ClusterPhaseProvisioning = ClusterPhase("provisioning") + ClusterPhaseProvisioning = ClusterPhase("Provisioning") // ClusterPhaseProvisioned is the state when its // infrastructure has been created and configured. - ClusterPhaseProvisioned = ClusterPhase("provisioned") + ClusterPhaseProvisioned = ClusterPhase("Provisioned") // ClusterPhaseDeleting is the Cluster state when a delete // request has been sent to the API Server, // but its infrastructure has not yet been fully deleted. - ClusterPhaseDeleting = ClusterPhase("deleting") + ClusterPhaseDeleting = ClusterPhase("Deleting") // ClusterPhaseFailed is the Cluster state when the system // might require user intervention. - ClusterPhaseFailed = ClusterPhase("failed") + ClusterPhaseFailed = ClusterPhase("Failed") // ClusterPhaseUnknown is returned if the Cluster state cannot be determined. - ClusterPhaseUnknown = ClusterPhase("") + ClusterPhaseUnknown = ClusterPhase("Unknown") ) diff --git a/api/v1alpha2/cluster_types.go b/api/v1alpha4/cluster_types.go similarity index 56% rename from api/v1alpha2/cluster_types.go rename to api/v1alpha4/cluster_types.go index 0996d7e32155..50ed38b47e4c 100644 --- a/api/v1alpha2/cluster_types.go +++ b/api/v1alpha4/cluster_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,11 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( + "fmt" + "strings" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/pointer" + capierrors "sigs.k8s.io/cluster-api/errors" ) @@ -30,10 +35,23 @@ const ( // ClusterSpec defines the desired state of Cluster type ClusterSpec struct { - // Cluster network configuration + // Paused can be used to prevent controllers from processing the Cluster and all its associated objects. + // +optional + Paused bool `json:"paused,omitempty"` + + // Cluster network configuration. // +optional ClusterNetwork *ClusterNetwork `json:"clusterNetwork,omitempty"` + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"` + + // ControlPlaneRef is an optional reference to a provider-specific resource that holds + // the details for provisioning the Control Plane for a Cluster. + // +optional + ControlPlaneRef *corev1.ObjectReference `json:"controlPlaneRef,omitempty"` + // InfrastructureRef is a reference to a provider-specific resource that holds the details // for provisioning infrastructure for a cluster in said provider. // +optional @@ -73,26 +91,32 @@ type NetworkRanges struct { CIDRBlocks []string `json:"cidrBlocks"` } +func (n *NetworkRanges) String() string { + if n == nil { + return "" + } + return strings.Join(n.CIDRBlocks, ",") +} + // ANCHOR_END: NetworkRanges // ANCHOR: ClusterStatus // ClusterStatus defines the observed state of Cluster type ClusterStatus struct { - // APIEndpoints represents the endpoints to communicate with the control plane. - // +optional - APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"` + // FailureDomains is a slice of failure domain objects synced from the infrastructure provider. + FailureDomains FailureDomains `json:"failureDomains,omitempty"` - // ErrorReason indicates that there is a problem reconciling the + // FailureReason indicates that there is a fatal problem reconciling the // state, and will be set to a token value suitable for // programmatic interpretation. // +optional - ErrorReason *capierrors.ClusterStatusError `json:"errorReason,omitempty"` + FailureReason *capierrors.ClusterStatusError `json:"failureReason,omitempty"` - // ErrorMessage indicates that there is a problem reconciling the + // FailureMessage indicates that there is a fatal problem reconciling the // state, and will be set to a descriptive error message. // +optional - ErrorMessage *string `json:"errorMessage,omitempty"` + FailureMessage *string `json:"failureMessage,omitempty"` // Phase represents the current phase of cluster actuation. // E.g. Pending, Running, Terminating, Failed etc. @@ -106,6 +130,18 @@ type ClusterStatus struct { // ControlPlaneInitialized defines if the control plane has been initialized. // +optional ControlPlaneInitialized bool `json:"controlPlaneInitialized"` + + // ControlPlaneReady defines if the control plane is ready. + // +optional + ControlPlaneReady bool `json:"controlPlaneReady,omitempty"` + + // Conditions defines current service state of the cluster. + // +optional + Conditions Conditions `json:"conditions,omitempty"` + + // ObservedGeneration is the latest generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` } // ANCHOR_END: ClusterStatus @@ -139,13 +175,29 @@ type APIEndpoint struct { Host string `json:"host"` // The port on which the API server is serving. - Port int `json:"port"` + Port int32 `json:"port"` +} + +// IsZero returns true if both host and port are zero values. +func (v APIEndpoint) IsZero() bool { + return v.Host == "" && v.Port == 0 +} + +// IsValid returns true if both host and port are non-zero values. +func (v APIEndpoint) IsValid() bool { + return v.Host != "" && v.Port != 0 +} + +// String returns a formatted version HOST:PORT of this APIEndpoint. +func (v APIEndpoint) String() string { + return fmt.Sprintf("%s:%d", v.Host, v.Port) } // ANCHOR_END: APIEndpoint // +kubebuilder:object:root=true // +kubebuilder:resource:path=clusters,shortName=cl,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Cluster status such as Pending/Provisioning/Provisioned/Deleting/Failed" @@ -158,6 +210,14 @@ type Cluster struct { Status ClusterStatus `json:"status,omitempty"` } +func (c *Cluster) GetConditions() Conditions { + return c.Status.Conditions +} + +func (c *Cluster) SetConditions(conditions Conditions) { + c.Status.Conditions = conditions +} + // +kubebuilder:object:root=true // ClusterList contains a list of Cluster @@ -170,3 +230,39 @@ type ClusterList struct { func init() { SchemeBuilder.Register(&Cluster{}, &ClusterList{}) } + +// FailureDomains is a slice of FailureDomains. +type FailureDomains map[string]FailureDomainSpec + +// FilterControlPlane returns a FailureDomain slice containing only the domains suitable to be used +// for control plane nodes. +func (in FailureDomains) FilterControlPlane() FailureDomains { + res := make(FailureDomains) + for id, spec := range in { + if spec.ControlPlane { + res[id] = spec + } + } + return res +} + +// GetIDs returns a slice containing the ids for failure domains +func (in FailureDomains) GetIDs() []*string { + ids := make([]*string, 0, len(in)) + for id := range in { + ids = append(ids, pointer.StringPtr(id)) + } + return ids +} + +// FailureDomainSpec is the Schema for Cluster API failure domains. +// It allows controllers to understand how many failure domains a cluster can optionally span across. +type FailureDomainSpec struct { + // ControlPlane determines if this failure domain is suitable for use by control plane machines. + // +optional + ControlPlane bool `json:"controlPlane"` + + // Attributes is a free form map of attributes an infrastructure provider might use or require. + // +optional + Attributes map[string]string `json:"attributes,omitempty"` +} diff --git a/api/v1alpha3/cluster_webhook.go b/api/v1alpha4/cluster_webhook.go similarity index 90% rename from api/v1alpha3/cluster_webhook.go rename to api/v1alpha4/cluster_webhook.go index 494ea1120b39..60f9e2c35dfa 100644 --- a/api/v1alpha3/cluster_webhook.go +++ b/api/v1alpha4/cluster_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -30,8 +30,8 @@ func (c *Cluster) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha3-cluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=clusters,versions=v1alpha3,name=validation.cluster.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha3-cluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=clusters,versions=v1alpha3,name=default.cluster.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha4-cluster,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=clusters,versions=v1alpha4,name=validation.cluster.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha4-cluster,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=clusters,versions=v1alpha4,name=default.cluster.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &Cluster{} var _ webhook.Validator = &Cluster{} diff --git a/api/v1alpha3/cluster_webhook_test.go b/api/v1alpha4/cluster_webhook_test.go similarity index 97% rename from api/v1alpha3/cluster_webhook_test.go rename to api/v1alpha4/cluster_webhook_test.go index a6b3e13fbc85..cc585aebd40d 100644 --- a/api/v1alpha3/cluster_webhook_test.go +++ b/api/v1alpha4/cluster_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/api/v1alpha2/common_types.go b/api/v1alpha4/common_types.go similarity index 75% rename from api/v1alpha2/common_types.go rename to api/v1alpha4/common_types.go index 347d88959b99..b131714d2e71 100644 --- a/api/v1alpha2/common_types.go +++ b/api/v1alpha4/common_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,12 +14,42 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +const ( + // ClusterLabelName is the label set on machines linked to a cluster and + // external objects(bootstrap and infrastructure providers) + ClusterLabelName = "cluster.x-k8s.io/cluster-name" + + // ProviderLabelName is the label set on components in the provider manifest. + // This label allows to easily identify all the components belonging to a provider; the clusterctl + // tool uses this label for implementing provider's lifecycle operations. + ProviderLabelName = "cluster.x-k8s.io/provider" + + // PausedAnnotation is an annotation that can be applied to any Cluster API + // object to prevent a controller from processing a resource. + // + // Controllers working with Cluster API objects must check the existence of this annotation + // on the reconciled object. + PausedAnnotation = "cluster.x-k8s.io/paused" + + // TemplateClonedFromNameAnnotation is the infrastructure machine annotation that stores the name of the infrastructure template resource + // that was cloned for the machine. This annotation is set only during cloning a template. Older/adopted machines will not have this annotation. + TemplateClonedFromNameAnnotation = "cluster.x-k8s.io/cloned-from-name" + + // TemplateClonedFromGroupKindAnnotation is the infrastructure machine annotation that stores the group-kind of the infrastructure template resource + // that was cloned for the machine. This annotation is set only during cloning a template. Older/adopted machines will not have this annotation. + TemplateClonedFromGroupKindAnnotation = "cluster.x-k8s.io/cloned-from-groupkind" + + // ClusterSecretType defines the type of secret created by core components + ClusterSecretType corev1.SecretType = "cluster.x-k8s.io/secret" //nolint:gosec +) + // MachineAddressType describes a valid MachineAddress type. type MachineAddressType string @@ -29,6 +59,9 @@ const ( MachineInternalIP MachineAddressType = "InternalIP" MachineExternalDNS MachineAddressType = "ExternalDNS" MachineInternalDNS MachineAddressType = "InternalDNS" + + // MachineNodeNameIndex is used by the Machine Controller to index Machines by Node name, and add a watch on Nodes. + MachineNodeNameIndex = "status.nodeRef.name" ) // MachineAddress contains information for the node's address. diff --git a/api/v1alpha4/condition_consts.go b/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..2e7d6420fc44 --- /dev/null +++ b/api/v1alpha4/condition_consts.go @@ -0,0 +1,129 @@ +/* +Copyright 2020 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 v1alpha4 + +// ANCHOR: CommonConditions + +// Common ConditionTypes used by Cluster API objects. +const ( + // ReadyCondition defines the Ready condition type that summarizes the operational state of a Cluster API object. + ReadyCondition ConditionType = "Ready" +) + +// Common ConditionReason used by Cluster API objects. +const ( + // DeletingReason (Severity=Info) documents an condition not in Status=True because the underlying object it is currently being deleted. + DeletingReason = "Deleting" + + // DeletionFailedReason (Severity=Warning) documents an condition not in Status=True because the underlying object + // encountered problems during deletion. This is a warning because the reconciler will retry deletion. + DeletionFailedReason = "DeletionFailed" + + // DeletedReason (Severity=Info) documents an condition not in Status=True because the underlying object was deleted. + DeletedReason = "Deleted" +) + +const ( + // InfrastructureReadyCondition reports a summary of current status of the infrastructure object defined for this cluster/machine/machinepool. + // This condition is mirrored from the Ready condition in the infrastructure ref object, and + // the absence of this condition might signal problems in the reconcile external loops or the fact that + // the infrastructure provider does not implement the Ready condition yet. + InfrastructureReadyCondition ConditionType = "InfrastructureReady" + + // WaitingForInfrastructureFallbackReason (Severity=Info) documents a cluster/machine/machinepool waiting for the underlying infrastructure + // to be available. + // NOTE: This reason is used only as a fallback when the infrastructure object is not reporting its own ready condition. + WaitingForInfrastructureFallbackReason = "WaitingForInfrastructure" +) + +// ANCHOR_END: CommonConditions + +// Conditions and condition Reasons for the Cluster object + +const ( + // ControlPlaneReady reports the ready condition from the control plane object defined for this cluster. + // This condition is mirrored from the Ready condition in the control plane ref object, and + // the absence of this condition might signal problems in the reconcile external loops or the fact that + // the control plane provider does not not implements the Ready condition yet. + ControlPlaneReadyCondition ConditionType = "ControlPlaneReady" + + // WaitingForControlPlaneFallbackReason (Severity=Info) documents a cluster waiting for the control plane + // to be available. + // NOTE: This reason is used only as a fallback when the control plane object is not reporting its own ready condition. + WaitingForControlPlaneFallbackReason = "WaitingForControlPlane" +) + +// Conditions and condition Reasons for the Machine object + +const ( + // BootstrapReadyCondition reports a summary of current status of the bootstrap object defined for this machine. + // This condition is mirrored from the Ready condition in the bootstrap ref object, and + // the absence of this condition might signal problems in the reconcile external loops or the fact that + // the bootstrap provider does not implement the Ready condition yet. + BootstrapReadyCondition ConditionType = "BootstrapReady" + + // WaitingForDataSecretFallbackReason (Severity=Info) documents a machine waiting for the bootstrap data secret + // to be available. + // NOTE: This reason is used only as a fallback when the bootstrap object is not reporting its own ready condition. + WaitingForDataSecretFallbackReason = "WaitingForDataSecret" + + // DrainingSucceededCondition provide evidence of the status of the node drain operation which happens during the machine + // deletion process. + DrainingSucceededCondition ConditionType = "DrainingSucceeded" + + // DrainingReason (Severity=Info) documents a machine node being drained. + DrainingReason = "Draining" + + // DrainingFailedReason (Severity=Warning) documents a machine node drain operation failed. + DrainingFailedReason = "DrainingFailed" + + // PreDrainDeleteHookSucceededCondition reports a machine waiting for a PreDrainDeleteHook before being delete. + PreDrainDeleteHookSucceededCondition ConditionType = "PreDrainDeleteHookSucceeded" + + // PreTerminateDeleteHookSucceededCondition reports a machine waiting for a PreDrainDeleteHook before being delete. + PreTerminateDeleteHookSucceededCondition ConditionType = "PreTerminateDeleteHookSucceeded" + + // WaitingExternalHookReason (Severity=Info) provide evidence that we are waiting for an external hook to complete. + WaitingExternalHookReason = "WaitingExternalHook" +) + +const ( + // MachineHealthCheckSuccededCondition is set on machines that have passed a healthcheck by the MachineHealthCheck controller. + // In the event that the health check fails it will be set to False. + MachineHealthCheckSuccededCondition ConditionType = "HealthCheckSucceeded" + + // MachineHasFailureReason is the reason used when a machine has either a FailureReason or a FailureMessage set on its status. + MachineHasFailureReason = "MachineHasFailure" + + // NodeNotFoundReason is the reason used when a machine's node has previously been observed but is now gone. + NodeNotFoundReason = "NodeNotFound" + + // NodeStartupTimeoutReason is the reason used when a machine's node does not appear within the specified timeout. + NodeStartupTimeoutReason = "NodeStartupTimeout" + + // UnhealthyNodeConditionReason is the reason used when a machine's node has one of the MachineHealthCheck's unhealthy conditions. + UnhealthyNodeConditionReason = "UnhealthyNode" +) + +const ( + // MachineOwnerRemediatedCondition is set on machines that have failed a healthcheck by the MachineHealthCheck controller. + // MachineOwnerRemediatedCondition is set to False after a health check fails, but should be changed to True by the owning controller after remediation succeeds. + MachineOwnerRemediatedCondition ConditionType = "OwnerRemediated" + + // WaitingForRemediationReason is the reason used when a machine fails a health check and remediation is needed. + WaitingForRemediationReason = "WaitingForRemediation" +) diff --git a/api/v1alpha4/condition_types.go b/api/v1alpha4/condition_types.go new file mode 100644 index 000000000000..6c90c0b3e7c4 --- /dev/null +++ b/api/v1alpha4/condition_types.go @@ -0,0 +1,97 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ANCHOR: ConditionSeverity + +// ConditionSeverity expresses the severity of a Condition Type failing. +type ConditionSeverity string + +const ( + // ConditionSeverityError specifies that a condition with `Status=False` is an error. + ConditionSeverityError ConditionSeverity = "Error" + + // ConditionSeverityWarning specifies that a condition with `Status=False` is a warning. + ConditionSeverityWarning ConditionSeverity = "Warning" + + // ConditionSeverityInfo specifies that a condition with `Status=False` is informative. + ConditionSeverityInfo ConditionSeverity = "Info" + + // ConditionSeverityNone should apply only to conditions with `Status=True`. + ConditionSeverityNone ConditionSeverity = "" +) + +// ANCHOR_END: ConditionSeverity + +// ANCHOR: ConditionType + +// ConditionType is a valid value for Condition.Type. +type ConditionType string + +// ANCHOR_END: ConditionType + +// ANCHOR: Condition + +// Condition defines an observation of a Cluster API resource operational state. +type Condition struct { + // Type of condition in CamelCase or in foo.example.com/CamelCase. + // Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + // can be useful (see .node.status.conditions), the ability to deconflict is important. + // +required + Type ConditionType `json:"type"` + + // Status of the condition, one of True, False, Unknown. + // +required + Status corev1.ConditionStatus `json:"status"` + + // Severity provides an explicit classification of Reason code, so the users or machines can immediately + // understand the current situation and act accordingly. + // The Severity field MUST be set only when Status=False. + // +optional + Severity ConditionSeverity `json:"severity,omitempty"` + + // Last time the condition transitioned from one status to another. + // This should be when the underlying condition changed. If that is not known, then using the time when + // the API field changed is acceptable. + // +required + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + + // The reason for the condition's last transition in CamelCase. + // The specific API may choose whether or not this field is considered a guaranteed API. + // This field may not be empty. + // +optional + Reason string `json:"reason,omitempty"` + + // A human readable message indicating details about the transition. + // This field may be empty. + // +optional + Message string `json:"message,omitempty"` +} + +// ANCHOR_END: Condition + +// ANCHOR: Conditions + +// Conditions provide observations of the operational state of a Cluster API resource. +type Conditions []Condition + +// ANCHOR_END: Conditions diff --git a/api/v1alpha2/machinedeployment_webhook.go b/api/v1alpha4/conversion.go similarity index 53% rename from api/v1alpha2/machinedeployment_webhook.go rename to api/v1alpha4/conversion.go index 9c45c1ec3b40..edfdee99e242 100644 --- a/api/v1alpha2/machinedeployment_webhook.go +++ b/api/v1alpha4/conversion.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,18 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machinedeployment-resource") - -func (r *MachineDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} +func (*Cluster) Hub() {} +func (*ClusterList) Hub() {} +func (*Machine) Hub() {} +func (*MachineList) Hub() {} +func (*MachineSet) Hub() {} +func (*MachineSetList) Hub() {} +func (*MachineDeployment) Hub() {} +func (*MachineDeploymentList) Hub() {} +func (*MachineHealthCheck) Hub() {} +func (*MachineHealthCheckList) Hub() {} diff --git a/api/v1alpha2/doc.go b/api/v1alpha4/doc.go similarity index 82% rename from api/v1alpha2/doc.go rename to api/v1alpha4/doc.go index 73130e117adb..b0efd4cde559 100644 --- a/api/v1alpha2/doc.go +++ b/api/v1alpha4/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,5 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:conversion-gen=sigs.k8s.io/cluster-api/api/v1alpha3 -package v1alpha2 +package v1alpha4 diff --git a/api/v1alpha2/groupversion_info.go b/api/v1alpha4/groupversion_info.go similarity index 83% rename from api/v1alpha2/groupversion_info.go rename to api/v1alpha4/groupversion_info.go index 7be687d2bfdc..d68b6ff4fdc5 100644 --- a/api/v1alpha2/groupversion_info.go +++ b/api/v1alpha4/groupversion_info.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha2 contains API Schema definitions for the cluster v1alpha2 API group +// Package v1alpha4 contains API Schema definitions for the cluster v1alpha4 API group // +kubebuilder:object:generate=true // +groupName=cluster.x-k8s.io -package v1alpha2 +package v1alpha4 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,13 +26,11 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "cluster.x-k8s.io", Version: "v1alpha2"} + GroupVersion = schema.GroupVersion{Group: "cluster.x-k8s.io", Version: "v1alpha4"} // 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/api/v1alpha2/machine_phase_types.go b/api/v1alpha4/machine_phase_types.go similarity index 82% rename from api/v1alpha2/machine_phase_types.go rename to api/v1alpha4/machine_phase_types.go index c23f7824f652..a2edb1107bf5 100644 --- a/api/v1alpha2/machine_phase_types.go +++ b/api/v1alpha4/machine_phase_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 // MachinePhase is a string representation of a Machine Phase. // @@ -31,34 +31,34 @@ type MachinePhase string const ( // MachinePhasePending is the first state a Machine is assigned by // Cluster API Machine controller after being created. - MachinePhasePending = MachinePhase("pending") + MachinePhasePending = MachinePhase("Pending") // MachinePhaseProvisioning is the state when the // Machine infrastructure is being created. - MachinePhaseProvisioning = MachinePhase("provisioning") + MachinePhaseProvisioning = MachinePhase("Provisioning") // MachinePhaseProvisioned is the state when its // infrastructure has been created and configured. - MachinePhaseProvisioned = MachinePhase("provisioned") + MachinePhaseProvisioned = MachinePhase("Provisioned") // MachinePhaseRunning is the Machine state when it has // become a Kubernetes Node in a Ready state. - MachinePhaseRunning = MachinePhase("running") + MachinePhaseRunning = MachinePhase("Running") // MachinePhaseDeleting is the Machine state when a delete // request has been sent to the API Server, // but its infrastructure has not yet been fully deleted. - MachinePhaseDeleting = MachinePhase("deleting") + MachinePhaseDeleting = MachinePhase("Deleting") // MachinePhaseDeleted is the Machine state when the object // and the related infrastructure is deleted and // ready to be garbage collected by the API Server. - MachinePhaseDeleted = MachinePhase("deleted") + MachinePhaseDeleted = MachinePhase("Deleted") // MachinePhaseFailed is the Machine state when the system // might require user intervention. - MachinePhaseFailed = MachinePhase("failed") + MachinePhaseFailed = MachinePhase("Failed") // MachinePhaseUnknown is returned if the Machine state cannot be determined. - MachinePhaseUnknown = MachinePhase("") + MachinePhaseUnknown = MachinePhase("Unknown") ) diff --git a/api/v1alpha2/machine_types.go b/api/v1alpha4/machine_types.go similarity index 70% rename from api/v1alpha2/machine_types.go rename to api/v1alpha4/machine_types.go index 26a56699230b..ce0efd57c438 100644 --- a/api/v1alpha2/machine_types.go +++ b/api/v1alpha4/machine_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( corev1 "k8s.io/api/core/v1" @@ -26,23 +26,38 @@ const ( // MachineFinalizer is set on PrepareForCreate callback. MachineFinalizer = "machine.cluster.x-k8s.io" - // MachineClusterLabelName is the label set on machines linked to a cluster. - MachineClusterLabelName = "cluster.x-k8s.io/cluster-name" - - // MachineControlPlaneLabelName is the label set on machines part of a control plane. + // MachineControlPlaneLabelName is the label set on machines or related objects that are part of a control plane. MachineControlPlaneLabelName = "cluster.x-k8s.io/control-plane" // ExcludeNodeDrainingAnnotation annotation explicitly skips node draining if set - ExcludeNodeDrainingAnnotation = "machine.cluster.x-k8s.io.io/exclude-node-draining" + ExcludeNodeDrainingAnnotation = "machine.cluster.x-k8s.io/exclude-node-draining" + + // MachineSetLabelName is the label set on machines if they're controlled by MachineSet + MachineSetLabelName = "cluster.x-k8s.io/set-name" + + // MachineDeploymentLabelName is the label set on machines if they're controlled by MachineDeployment + MachineDeploymentLabelName = "cluster.x-k8s.io/deployment-name" + + // PreDrainDeleteHookAnnotationPrefix annotation specifies the prefix we + // search each annotation for during the pre-drain.delete lifecycle hook + // to pause reconciliation of deletion. These hooks will prevent removal of + // draining the associated node until all are removed. + PreDrainDeleteHookAnnotationPrefix = "pre-drain.delete.hook.machine.cluster.x-k8s.io" + + // PreTerminateDeleteHookAnnotationPrefix annotation specifies the prefix we + // search each annotation for during the pre-terminate.delete lifecycle hook + // to pause reconciliation of deletion. These hooks will prevent removal of + // an instance from an infrastructure provider until all are removed. + PreTerminateDeleteHookAnnotationPrefix = "pre-terminate.delete.hook.machine.cluster.x-k8s.io" ) // ANCHOR: MachineSpec // MachineSpec defines the desired state of Machine type MachineSpec struct { - // DEPRECATED: ObjectMeta has no function and isn't used anywhere. - // +optional - ObjectMeta `json:"metadata,omitempty"` + // ClusterName is the name of the Cluster this object belongs to. + // +kubebuilder:validation:MinLength=1 + ClusterName string `json:"clusterName"` // Bootstrap is a reference to a local struct which encapsulates // fields to configure the Machine’s bootstrapping mechanism. @@ -69,6 +84,17 @@ type MachineSpec struct { // be interfacing with cluster-api as generic provider. // +optional ProviderID *string `json:"providerID,omitempty"` + + // FailureDomain is the failure domain the machine will be created in. + // Must match a key in the FailureDomains map stored on the cluster object. + // +optional + FailureDomain *string `json:"failureDomain,omitempty"` + + // NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` + // +optional + NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"` } // ANCHOR_END: MachineSpec @@ -81,7 +107,7 @@ type MachineStatus struct { // +optional NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` - // LastUpdated identifies when this status was last observed. + // LastUpdated identifies when the phase of the Machine last transitioned. // +optional LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` @@ -92,7 +118,7 @@ type MachineStatus struct { // +optional Version *string `json:"version,omitempty"` - // ErrorReason will be set in the event that there is a terminal problem + // FailureReason will be set in the event that there is a terminal problem // reconciling the Machine and will contain a succinct value suitable // for machine interpretation. // @@ -109,9 +135,9 @@ type MachineStatus struct { // can be added as events to the Machine object and/or logged in the // controller's output. // +optional - ErrorReason *capierrors.MachineStatusError `json:"errorReason,omitempty"` + FailureReason *capierrors.MachineStatusError `json:"failureReason,omitempty"` - // ErrorMessage will be set in the event that there is a terminal problem + // FailureMessage will be set in the event that there is a terminal problem // reconciling the Machine and will contain a more verbose string suitable // for logging and human consumption. // @@ -128,7 +154,7 @@ type MachineStatus struct { // can be added as events to the Machine object and/or logged in the // controller's output. // +optional - ErrorMessage *string `json:"errorMessage,omitempty"` + FailureMessage *string `json:"failureMessage,omitempty"` // Addresses is a list of addresses assigned to the machine. // This field is copied from the infrastructure provider reference. @@ -147,6 +173,14 @@ type MachineStatus struct { // InfrastructureReady is the state of the infrastructure provider. // +optional InfrastructureReady bool `json:"infrastructureReady"` + + // ObservedGeneration is the latest generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Conditions defines current service state of the Machine. + // +optional + Conditions Conditions `json:"conditions,omitempty"` } // ANCHOR_END: MachineStatus @@ -187,8 +221,17 @@ type Bootstrap struct { // Data contains the bootstrap data, such as cloud-init details scripts. // If nil, the Machine should remain in the Pending state. + // + // Deprecated: This field has been deprecated in v1alpha4 and + // will be removed in a future version. Switch to DataSecretName. + // // +optional Data *string `json:"data,omitempty"` + + // DataSecretName is the name of the secret that stores the bootstrap data script. + // If nil, the Machine should remain in the Pending state. + // +optional + DataSecretName *string `json:"dataSecretName,omitempty"` } // ANCHOR_END: Bootstrap @@ -196,8 +239,10 @@ type Bootstrap struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=machines,shortName=ma,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status +// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="Provider ID" // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Machine status such as Terminating/Pending/Running/Failed etc" +// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version",description="Kubernetes version associated with this Machine" // +kubebuilder:printcolumn:name="NodeName",type="string",JSONPath=".status.nodeRef.name",description="Node name associated with this machine",priority=1 // Machine is the Schema for the machines API @@ -209,6 +254,14 @@ type Machine struct { Status MachineStatus `json:"status,omitempty"` } +func (m *Machine) GetConditions() Conditions { + return m.Status.Conditions +} + +func (m *Machine) SetConditions(conditions Conditions) { + m.Status.Conditions = conditions +} + // +kubebuilder:object:root=true // MachineList contains a list of Machine diff --git a/api/v1alpha3/machine_webhook.go b/api/v1alpha4/machine_webhook.go similarity index 93% rename from api/v1alpha3/machine_webhook.go rename to api/v1alpha4/machine_webhook.go index 1ae18483874d..e4250a35108c 100644 --- a/api/v1alpha3/machine_webhook.go +++ b/api/v1alpha4/machine_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -34,8 +34,8 @@ func (m *Machine) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha3-machine,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machines,versions=v1alpha3,name=validation.machine.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha3-machine,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machines,versions=v1alpha3,name=default.machine.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha4-machine,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machines,versions=v1alpha4,name=validation.machine.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha4-machine,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machines,versions=v1alpha4,name=default.machine.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Validator = &Machine{} var _ webhook.Defaulter = &Machine{} diff --git a/api/v1alpha3/machine_webhook_test.go b/api/v1alpha4/machine_webhook_test.go similarity index 99% rename from api/v1alpha3/machine_webhook_test.go rename to api/v1alpha4/machine_webhook_test.go index 02dedf92b6b6..e4996d3a7962 100644 --- a/api/v1alpha3/machine_webhook_test.go +++ b/api/v1alpha4/machine_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/api/v1alpha2/machinedeployment_types.go b/api/v1alpha4/machinedeployment_types.go similarity index 72% rename from api/v1alpha2/machinedeployment_types.go rename to api/v1alpha4/machinedeployment_types.go index 2e65142c35a3..30adcc501755 100644 --- a/api/v1alpha2/machinedeployment_types.go +++ b/api/v1alpha4/machinedeployment_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -29,23 +29,27 @@ const ( RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" // RevisionAnnotation is the revision annotation of a machine deployment's machine sets which records its rollout sequence - RevisionAnnotation = "machinedeployment.clusters.k8s.io/revision" + RevisionAnnotation = "machinedeployment.clusters.x-k8s.io/revision" // RevisionHistoryAnnotation maintains the history of all old revisions that a machine set has served for a machine deployment. - RevisionHistoryAnnotation = "machinedeployment.clusters.k8s.io/revision-history" + RevisionHistoryAnnotation = "machinedeployment.clusters.x-k8s.io/revision-history" // DesiredReplicasAnnotation is the desired replicas for a machine deployment recorded as an annotation // in its machine sets. Helps in separating scaling events from the rollout process and for // determining if the new machine set for a deployment is really saturated. - DesiredReplicasAnnotation = "machinedeployment.clusters.k8s.io/desired-replicas" + DesiredReplicasAnnotation = "machinedeployment.clusters.x-k8s.io/desired-replicas" // MaxReplicasAnnotation is the maximum replicas a deployment can have at a given point, which // is machinedeployment.spec.replicas + maxSurge. Used by the underlying machine sets to estimate their // proportions in case the deployment has surge replicas. - MaxReplicasAnnotation = "machinedeployment.clusters.k8s.io/max-replicas" + MaxReplicasAnnotation = "machinedeployment.clusters.x-k8s.io/max-replicas" ) // ANCHOR: MachineDeploymentSpec // MachineDeploymentSpec defines the desired state of MachineDeployment type MachineDeploymentSpec struct { + // ClusterName is the name of the Cluster this object belongs to. + // +kubebuilder:validation:MinLength=1 + ClusterName string `json:"clusterName"` + // Number of desired machines. Defaults to 1. // This is a pointer to distinguish between explicit zero and not specified. Replicas *int32 `json:"replicas,omitempty"` @@ -187,14 +191,64 @@ type MachineDeploymentStatus struct { // that still have not been created. // +optional UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"` + + // Phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown). + // +optional + Phase string `json:"phase,omitempty"` } // ANCHOR_END: MachineDeploymentStatus +// MachineDeploymentPhase indicates the progress of the machine deployment +type MachineDeploymentPhase string + +const ( + // MachineDeploymentPhaseScalingUp indicates the MachineDeployment is scaling up. + MachineDeploymentPhaseScalingUp = MachineDeploymentPhase("ScalingUp") + + // MachineDeploymentPhaseScalingDown indicates the MachineDeployment is scaling down. + MachineDeploymentPhaseScalingDown = MachineDeploymentPhase("ScalingDown") + + // MachineDeploymentPhaseRunning indicates scaling has completed and all Machines are running. + MachineDeploymentPhaseRunning = MachineDeploymentPhase("Running") + + // MachineDeploymentPhaseFailed indicates there was a problem scaling and user intervention might be required. + MachineDeploymentPhaseFailed = MachineDeploymentPhase("Failed") + + // MachineDeploymentPhaseUnknown indicates the state of the MachineDeployment cannot be determined. + MachineDeploymentPhaseUnknown = MachineDeploymentPhase("Unknown") +) + +// SetTypedPhase sets the Phase field to the string representation of MachineDeploymentPhase. +func (md *MachineDeploymentStatus) SetTypedPhase(p MachineDeploymentPhase) { + md.Phase = string(p) +} + +// GetTypedPhase attempts to parse the Phase field and return +// the typed MachineDeploymentPhase representation. +func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase { + switch phase := MachineDeploymentPhase(md.Phase); phase { + case + MachineDeploymentPhaseScalingDown, + MachineDeploymentPhaseScalingUp, + MachineDeploymentPhaseRunning, + MachineDeploymentPhaseFailed: + return phase + default: + return MachineDeploymentPhaseUnknown + } +} + // +kubebuilder:object:root=true // +kubebuilder:resource:path=machinedeployments,shortName=md,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="MachineDeployment status such as ScalingUp/ScalingDown/Running/Failed/Unknown" +// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".status.replicas",description="Total number of non-terminated machines targeted by this MachineDeployment" +// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Total number of ready machines targeted by this MachineDeployment" +// +kubebuilder:printcolumn:name="Updated",type=integer,JSONPath=".status.updatedReplicas",description="Total number of non-terminated machines targeted by this deployment that have the desired template spec" +// +kubebuilder:printcolumn:name="Unavailable",type=integer,JSONPath=".status.unavailableReplicas",description="Total number of unavailable machines targeted by this MachineDeployment" // MachineDeployment is the Schema for the machinedeployments API type MachineDeployment struct { diff --git a/api/v1alpha3/machinedeployment_webhook.go b/api/v1alpha4/machinedeployment_webhook.go similarity index 94% rename from api/v1alpha3/machinedeployment_webhook.go rename to api/v1alpha4/machinedeployment_webhook.go index 37027e6f4d7b..c55241a17701 100644 --- a/api/v1alpha3/machinedeployment_webhook.go +++ b/api/v1alpha4/machinedeployment_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -36,8 +36,8 @@ func (m *MachineDeployment) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha3-machinedeployment,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinedeployments,versions=v1alpha3,name=validation.machinedeployment.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha3-machinedeployment,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinedeployments,versions=v1alpha3,name=default.machinedeployment.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha4-machinedeployment,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinedeployments,versions=v1alpha4,name=validation.machinedeployment.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha4-machinedeployment,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinedeployments,versions=v1alpha4,name=default.machinedeployment.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &MachineDeployment{} var _ webhook.Validator = &MachineDeployment{} diff --git a/api/v1alpha3/machinedeployment_webhook_test.go b/api/v1alpha4/machinedeployment_webhook_test.go similarity index 98% rename from api/v1alpha3/machinedeployment_webhook_test.go rename to api/v1alpha4/machinedeployment_webhook_test.go index ae23ec5ed5a5..f4c114694826 100644 --- a/api/v1alpha3/machinedeployment_webhook_test.go +++ b/api/v1alpha4/machinedeployment_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/api/v1alpha4/machinehealthcheck_types.go b/api/v1alpha4/machinehealthcheck_types.go new file mode 100644 index 000000000000..e31c38469148 --- /dev/null +++ b/api/v1alpha4/machinehealthcheck_types.go @@ -0,0 +1,129 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// ANCHOR: MachineHealthCheckSpec + +// MachineHealthCheckSpec defines the desired state of MachineHealthCheck +type MachineHealthCheckSpec struct { + // ClusterName is the name of the Cluster this object belongs to. + // +kubebuilder:validation:MinLength=1 + ClusterName string `json:"clusterName"` + + // Label selector to match machines whose health will be exercised + Selector metav1.LabelSelector `json:"selector"` + + // UnhealthyConditions contains a list of the conditions that determine + // whether a node is considered unhealthy. The conditions are combined in a + // logical OR, i.e. if any of the conditions is met, the node is unhealthy. + // + // +kubebuilder:validation:MinItems=1 + UnhealthyConditions []UnhealthyCondition `json:"unhealthyConditions"` + + // Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by + // "selector" are not healthy. + // +optional + MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"` + + // Machines older than this duration without a node will be considered to have + // failed and will be remediated. + // +optional + NodeStartupTimeout *metav1.Duration `json:"nodeStartupTimeout,omitempty"` +} + +// ANCHOR_END: MachineHealthCHeckSpec + +// ANCHOR: UnhealthyCondition + +// UnhealthyCondition represents a Node condition type and value with a timeout +// specified as a duration. When the named condition has been in the given +// status for at least the timeout value, a node is considered unhealthy. +type UnhealthyCondition struct { + // +kubebuilder:validation:Type=string + // +kubebuilder:validation:MinLength=1 + Type corev1.NodeConditionType `json:"type"` + + // +kubebuilder:validation:Type=string + // +kubebuilder:validation:MinLength=1 + Status corev1.ConditionStatus `json:"status"` + + Timeout metav1.Duration `json:"timeout"` +} + +// ANCHOR_END: UnhealthyCondition + +// ANCHOR: MachineHealthCheckStatus + +// MachineHealthCheckStatus defines the observed state of MachineHealthCheck +type MachineHealthCheckStatus struct { + // total number of machines counted by this machine health check + // +kubebuilder:validation:Minimum=0 + ExpectedMachines int32 `json:"expectedMachines,omitempty"` + + // total number of healthy machines counted by this machine health check + // +kubebuilder:validation:Minimum=0 + CurrentHealthy int32 `json:"currentHealthy,omitempty"` + + // ObservedGeneration is the latest generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Targets shows the current list of machines the machine health check is watching + // +optional + Targets []string `json:"targets,omitempty"` +} + +// ANCHOR_END: MachineHealthCheckStatus + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=machinehealthchecks,shortName=mhc;mhcs,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="MaxUnhealthy",type="string",JSONPath=".spec.maxUnhealthy",description="Maximum number of unhealthy machines allowed" +// +kubebuilder:printcolumn:name="ExpectedMachines",type="integer",JSONPath=".status.expectedMachines",description="Number of machines currently monitored" +// +kubebuilder:printcolumn:name="CurrentHealthy",type="integer",JSONPath=".status.currentHealthy",description="Current observed healthy machines" + +// MachineHealthCheck is the Schema for the machinehealthchecks API +type MachineHealthCheck struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of machine health check policy + Spec MachineHealthCheckSpec `json:"spec,omitempty"` + + // Most recently observed status of MachineHealthCheck resource + Status MachineHealthCheckStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// MachineHealthCheckList contains a list of MachineHealthCheck +type MachineHealthCheckList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineHealthCheck `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineHealthCheck{}, &MachineHealthCheckList{}) +} diff --git a/api/v1alpha3/machinehealthcheck_webhook.go b/api/v1alpha4/machinehealthcheck_webhook.go similarity index 95% rename from api/v1alpha3/machinehealthcheck_webhook.go rename to api/v1alpha4/machinehealthcheck_webhook.go index 7420008e133e..5dcb9b5f904b 100644 --- a/api/v1alpha3/machinehealthcheck_webhook.go +++ b/api/v1alpha4/machinehealthcheck_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -55,8 +55,8 @@ func (m *MachineHealthCheck) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha3-machinehealthcheck,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinehealthchecks,versions=v1alpha3,name=validation.machinehealthcheck.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha3-machinehealthcheck,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinehealthchecks,versions=v1alpha3,name=default.machinehealthcheck.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha4-machinehealthcheck,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinehealthchecks,versions=v1alpha4,name=validation.machinehealthcheck.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha4-machinehealthcheck,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinehealthchecks,versions=v1alpha4,name=default.machinehealthcheck.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &MachineHealthCheck{} var _ webhook.Validator = &MachineHealthCheck{} diff --git a/api/v1alpha3/machinehealthcheck_webhook_test.go b/api/v1alpha4/machinehealthcheck_webhook_test.go similarity index 99% rename from api/v1alpha3/machinehealthcheck_webhook_test.go rename to api/v1alpha4/machinehealthcheck_webhook_test.go index 1ca885b75eb2..6d624cb19ecc 100644 --- a/api/v1alpha3/machinehealthcheck_webhook_test.go +++ b/api/v1alpha4/machinehealthcheck_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/api/v1alpha2/machineset_types.go b/api/v1alpha4/machineset_types.go similarity index 85% rename from api/v1alpha2/machineset_types.go rename to api/v1alpha4/machineset_types.go index ae9d527a3695..4df1b426de2b 100644 --- a/api/v1alpha2/machineset_types.go +++ b/api/v1alpha4/machineset_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,11 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( - "log" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" "k8s.io/apimachinery/pkg/labels" @@ -30,6 +28,10 @@ import ( // MachineSetSpec defines the desired state of MachineSet type MachineSetSpec struct { + // ClusterName is the name of the Cluster this object belongs to. + // +kubebuilder:validation:MinLength=1 + ClusterName string `json:"clusterName"` + // Replicas is the number of desired replicas. // This is a pointer to distinguish between explicit zero and unspecified. // Defaults to 1. @@ -85,19 +87,19 @@ type MachineSetDeletePolicy string const ( // RandomMachineSetDeletePolicy prioritizes both Machines that have the annotation // "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy - // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // (Status.FailureReason or Status.FailureMessage are set to a non-empty value). // Finally, it picks Machines at random to delete. RandomMachineSetDeletePolicy MachineSetDeletePolicy = "Random" // NewestMachineSetDeletePolicy prioritizes both Machines that have the annotation // "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy - // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // (Status.FailureReason or Status.FailureMessage are set to a non-empty value). // It then prioritizes the newest Machines for deletion based on the Machine's CreationTimestamp. NewestMachineSetDeletePolicy MachineSetDeletePolicy = "Newest" // OldestMachineSetDeletePolicy prioritizes both Machines that have the annotation // "cluster.x-k8s.io/delete-machine=yes" and Machines that are unhealthy - // (Status.ErrorReason or Status.ErrorMessage are set to a non-empty value). + // (Status.FailureReason or Status.FailureMessage are set to a non-empty value). // It then prioritizes the oldest Machines for deletion based on the Machine's CreationTimestamp. OldestMachineSetDeletePolicy MachineSetDeletePolicy = "Oldest" ) @@ -113,7 +115,8 @@ type MachineSetStatus struct { Selector string `json:"selector,omitempty"` // Replicas is the most recently observed number of replicas. - Replicas int32 `json:"replicas"` + // +optional + Replicas int32 `json:"replicas,omitempty"` // The number of replicas that have labels matching the labels of the machine template of the MachineSet. // +optional @@ -132,9 +135,9 @@ type MachineSetStatus struct { ObservedGeneration int64 `json:"observedGeneration,omitempty"` // In the event that there is a terminal problem reconciling the - // replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + // replicas, both FailureReason and FailureMessage will be set. FailureReason // will be populated with a succinct value suitable for machine - // interpretation, while ErrorMessage will contain a more verbose + // interpretation, while FailureMessage will contain a more verbose // string suitable for logging and human consumption. // // These fields should not be set for transitive errors that a @@ -150,9 +153,9 @@ type MachineSetStatus struct { // can be added as events to the MachineSet object and/or logged in the // controller's output. // +optional - ErrorReason *capierrors.MachineSetStatusError `json:"errorReason,omitempty"` + FailureReason *capierrors.MachineSetStatusError `json:"failureReason,omitempty"` // +optional - ErrorMessage *string `json:"errorMessage,omitempty"` + FailureMessage *string `json:"failureMessage,omitempty"` } // ANCHOR_END: MachineSetStatus @@ -180,30 +183,14 @@ func (m *MachineSet) Validate() field.ErrorList { return errors } -// DefaultingFunction sets default MachineSet field values. -func (m *MachineSet) Default() { - log.Printf("Defaulting fields for MachineSet %s\n", m.Name) - - if m.Spec.Replicas == nil { - m.Spec.Replicas = new(int32) - *m.Spec.Replicas = 1 - } - - if len(m.Namespace) == 0 { - m.Namespace = metav1.NamespaceDefault - } - - if m.Spec.DeletePolicy == "" { - randomPolicy := string(RandomMachineSetDeletePolicy) - log.Printf("Defaulting to %s\n", randomPolicy) - m.Spec.DeletePolicy = randomPolicy - } -} - // +kubebuilder:object:root=true // +kubebuilder:resource:path=machinesets,shortName=ms,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector +// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".status.replicas",description="Total number of non-terminated machines targeted by this machineset" +// +kubebuilder:printcolumn:name="Available",type="integer",JSONPath=".status.availableReplicas",description="Total number of available machines (ready for at least minReadySeconds)" +// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Total number of ready machines targeted by this machineset." // MachineSet is the Schema for the machinesets API type MachineSet struct { diff --git a/api/v1alpha3/machineset_webhook.go b/api/v1alpha4/machineset_webhook.go similarity index 92% rename from api/v1alpha3/machineset_webhook.go rename to api/v1alpha4/machineset_webhook.go index b2f0fef88a93..9d37556ae479 100644 --- a/api/v1alpha3/machineset_webhook.go +++ b/api/v1alpha4/machineset_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -35,8 +35,8 @@ func (m *MachineSet) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha3-machineset,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinesets,versions=v1alpha3,name=validation.machineset.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha3-machineset,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinesets,versions=v1alpha3,name=default.machineset.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-cluster-x-k8s-io-v1alpha4-machineset,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinesets,versions=v1alpha4,name=validation.machineset.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-cluster-x-k8s-io-v1alpha4-machineset,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=cluster.x-k8s.io,resources=machinesets,versions=v1alpha4,name=default.machineset.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &MachineSet{} var _ webhook.Validator = &MachineSet{} diff --git a/api/v1alpha3/machineset_webhook_test.go b/api/v1alpha4/machineset_webhook_test.go similarity index 98% rename from api/v1alpha3/machineset_webhook_test.go rename to api/v1alpha4/machineset_webhook_test.go index a525adc3c1d0..466a86e53d11 100644 --- a/api/v1alpha3/machineset_webhook_test.go +++ b/api/v1alpha4/machineset_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/api/v1alpha2/zz_generated.deepcopy.go b/api/v1alpha4/zz_generated.deepcopy.go similarity index 72% rename from api/v1alpha2/zz_generated.deepcopy.go rename to api/v1alpha4/zz_generated.deepcopy.go index c5c76802f62e..5bf0295a7f65 100644 --- a/api/v1alpha2/zz_generated.deepcopy.go +++ b/api/v1alpha4/zz_generated.deepcopy.go @@ -18,12 +18,12 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha4 import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/cluster-api/errors" ) @@ -56,6 +56,11 @@ func (in *Bootstrap) DeepCopyInto(out *Bootstrap) { *out = new(string) **out = **in } + if in.DataSecretName != nil { + in, out := &in.DataSecretName, &out.DataSecretName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bootstrap. @@ -165,6 +170,12 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = new(ClusterNetwork) (*in).DeepCopyInto(*out) } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.ControlPlaneRef != nil { + in, out := &in.ControlPlaneRef, &out.ControlPlaneRef + *out = new(v1.ObjectReference) + **out = **in + } if in.InfrastructureRef != nil { in, out := &in.InfrastructureRef, &out.InfrastructureRef *out = new(v1.ObjectReference) @@ -185,21 +196,30 @@ func (in *ClusterSpec) DeepCopy() *ClusterSpec { // 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 - if in.APIEndpoints != nil { - in, out := &in.APIEndpoints, &out.APIEndpoints - *out = make([]APIEndpoint, len(*in)) - copy(*out, *in) + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } } - if in.ErrorReason != nil { - in, out := &in.ErrorReason, &out.ErrorReason + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason *out = new(errors.ClusterStatusError) **out = **in } - if in.ErrorMessage != nil { - in, out := &in.ErrorMessage, &out.ErrorMessage + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage *out = new(string) **out = **in } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. @@ -212,6 +232,86 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Condition) DeepCopyInto(out *Condition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition. +func (in *Condition) DeepCopy() *Condition { + if in == nil { + return nil + } + out := new(Condition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Conditions) DeepCopyInto(out *Conditions) { + { + in := &in + *out = make(Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditions. +func (in Conditions) DeepCopy() Conditions { + if in == nil { + return nil + } + out := new(Conditions) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FailureDomainSpec) DeepCopyInto(out *FailureDomainSpec) { + *out = *in + if in.Attributes != nil { + in, out := &in.Attributes, &out.Attributes + *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 FailureDomainSpec. +func (in *FailureDomainSpec) DeepCopy() *FailureDomainSpec { + if in == nil { + return nil + } + out := new(FailureDomainSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in FailureDomains) DeepCopyInto(out *FailureDomains) { + { + in := &in + *out = make(FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FailureDomains. +func (in FailureDomains) DeepCopy() FailureDomains { + if in == nil { + return nil + } + out := new(FailureDomains) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Machine) DeepCopyInto(out *Machine) { *out = *in @@ -409,6 +509,116 @@ func (in *MachineDeploymentStrategy) DeepCopy() *MachineDeploymentStrategy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineHealthCheck) DeepCopyInto(out *MachineHealthCheck) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheck. +func (in *MachineHealthCheck) DeepCopy() *MachineHealthCheck { + if in == nil { + return nil + } + out := new(MachineHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineHealthCheck) 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 *MachineHealthCheckList) DeepCopyInto(out *MachineHealthCheckList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineHealthCheck, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckList. +func (in *MachineHealthCheckList) DeepCopy() *MachineHealthCheckList { + if in == nil { + return nil + } + out := new(MachineHealthCheckList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineHealthCheckList) 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 *MachineHealthCheckSpec) DeepCopyInto(out *MachineHealthCheckSpec) { + *out = *in + in.Selector.DeepCopyInto(&out.Selector) + if in.UnhealthyConditions != nil { + in, out := &in.UnhealthyConditions, &out.UnhealthyConditions + *out = make([]UnhealthyCondition, len(*in)) + copy(*out, *in) + } + if in.MaxUnhealthy != nil { + in, out := &in.MaxUnhealthy, &out.MaxUnhealthy + *out = new(intstr.IntOrString) + **out = **in + } + if in.NodeStartupTimeout != nil { + in, out := &in.NodeStartupTimeout, &out.NodeStartupTimeout + *out = new(metav1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckSpec. +func (in *MachineHealthCheckSpec) DeepCopy() *MachineHealthCheckSpec { + if in == nil { + return nil + } + out := new(MachineHealthCheckSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineHealthCheckStatus) DeepCopyInto(out *MachineHealthCheckStatus) { + *out = *in + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckStatus. +func (in *MachineHealthCheckStatus) DeepCopy() *MachineHealthCheckStatus { + if in == nil { + return nil + } + out := new(MachineHealthCheckStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineList) DeepCopyInto(out *MachineList) { *out = *in @@ -550,13 +760,13 @@ func (in *MachineSetSpec) DeepCopy() *MachineSetSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { *out = *in - if in.ErrorReason != nil { - in, out := &in.ErrorReason, &out.ErrorReason + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason *out = new(errors.MachineSetStatusError) **out = **in } - if in.ErrorMessage != nil { - in, out := &in.ErrorMessage, &out.ErrorMessage + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage *out = new(string) **out = **in } @@ -575,7 +785,6 @@ func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Bootstrap.DeepCopyInto(&out.Bootstrap) out.InfrastructureRef = in.InfrastructureRef if in.Version != nil { @@ -588,6 +797,16 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(string) **out = **in } + if in.FailureDomain != nil { + in, out := &in.FailureDomain, &out.FailureDomain + *out = new(string) + **out = **in + } + if in.NodeDrainTimeout != nil { + in, out := &in.NodeDrainTimeout, &out.NodeDrainTimeout + *out = new(metav1.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. @@ -617,13 +836,13 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = new(string) **out = **in } - if in.ErrorReason != nil { - in, out := &in.ErrorReason, &out.ErrorReason + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason *out = new(errors.MachineStatusError) **out = **in } - if in.ErrorMessage != nil { - in, out := &in.ErrorMessage, &out.ErrorMessage + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage *out = new(string) **out = **in } @@ -632,6 +851,13 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = make(MachineAddresses, len(*in)) copy(*out, *in) } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. @@ -716,3 +942,19 @@ func (in *ObjectMeta) DeepCopy() *ObjectMeta { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UnhealthyCondition) DeepCopyInto(out *UnhealthyCondition) { + *out = *in + out.Timeout = in.Timeout +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnhealthyCondition. +func (in *UnhealthyCondition) DeepCopy() *UnhealthyCondition { + if in == nil { + return nil + } + out := new(UnhealthyCondition) + in.DeepCopyInto(out) + return out +} diff --git a/bootstrap/kubeadm/PROJECT b/bootstrap/kubeadm/PROJECT index 10e59ac978dd..9064f8e3d55b 100644 --- a/bootstrap/kubeadm/PROJECT +++ b/bootstrap/kubeadm/PROJECT @@ -3,14 +3,14 @@ domain: cluster.x-k8s.io repo: sigs.k8s.io/cluster-api/bootstrap/kubeadm resources: - group: bootstrap - version: v1alpha2 + version: v1alpha3 kind: KubeadmConfig - group: bootstrap - version: v1alpha2 + version: v1alpha3 kind: KubeadmConfigTemplate - group: bootstrap - version: v1alpha3 + version: v1alpha4 kind: KubeadmConfig - group: bootstrap - version: v1alpha3 + version: v1alpha4 kind: KubeadmConfigTemplate diff --git a/bootstrap/kubeadm/api/v1alpha2/conversion.go b/bootstrap/kubeadm/api/v1alpha2/conversion.go deleted file mode 100644 index e2898cf5479f..000000000000 --- a/bootstrap/kubeadm/api/v1alpha2/conversion.go +++ /dev/null @@ -1,164 +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 v1alpha2 - -import ( - apiconversion "k8s.io/apimachinery/pkg/conversion" - kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" - "sigs.k8s.io/controller-runtime/pkg/conversion" -) - -// ConvertTo converts this KubeadmConfig to the Hub version (v1alpha3). -func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) - if err := Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(src, dst, nil); err != nil { - return err - } - - // Manually restore data. - restored := &kubeadmbootstrapv1alpha3.KubeadmConfig{} - if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { - return err - } - - dst.Status.DataSecretName = restored.Status.DataSecretName - dst.Status.ObservedGeneration = restored.Status.ObservedGeneration - dst.Spec.Verbosity = restored.Spec.Verbosity - dst.Spec.UseExperimentalRetryJoin = restored.Spec.UseExperimentalRetryJoin - dst.Spec.DiskSetup = restored.Spec.DiskSetup - dst.Spec.Mounts = restored.Spec.Mounts - dst.Spec.Files = restored.Spec.Files - dst.Status.Conditions = restored.Status.Conditions - - // Track files successfully up-converted. We need this to dedupe - // restored files from user-updated files on up-conversion. We store - // them as pointers for later modification without paying for second - // lookup. - dstPaths := make(map[string]*kubeadmbootstrapv1alpha3.File, len(dst.Spec.Files)) - for i := range dst.Spec.Files { - path := dst.Spec.Files[i].Path - dstPaths[path] = &dst.Spec.Files[i] - } - - // If we find a restored file matching the file path of a v1alpha2 - // file with no content, we should restore contentFrom to that file. - for i := range restored.Spec.Files { - restoredFile := restored.Spec.Files[i] - dstFile, exists := dstPaths[restoredFile.Path] - if exists && dstFile.Content == "" { - if dstFile.ContentFrom == nil { - dstFile.ContentFrom = new(kubeadmbootstrapv1alpha3.FileSource) - } - *dstFile.ContentFrom = *restoredFile.ContentFrom - } - } - - return nil -} - -// ConvertFrom converts from the KubeadmConfig Hub version (v1alpha3) to this version. -func (dst *KubeadmConfig) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) - if err := Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(src, dst, nil); err != nil { - return nil - } - - // Preserve Hub data on down-conversion. - if err := utilconversion.MarshalData(src, dst); err != nil { - return err - } - - return nil -} - -// ConvertTo converts this KubeadmConfigList to the Hub version (v1alpha3). -func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) - return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil) -} - -// ConvertFrom converts from the KubeadmConfigList Hub version (v1alpha3) to this version. -func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) - return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(src, dst, nil) -} - -// ConvertTo converts this KubeadmConfigTemplate to the Hub version (v1alpha3). -func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) - return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(src, dst, nil) -} - -// ConvertFrom converts from the KubeadmConfigTemplate Hub version (v1alpha3) to this version. -func (dst *KubeadmConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) - return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(src, dst, nil) -} - -// ConvertTo converts this KubeadmConfigTemplateList to the Hub version (v1alpha3). -func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { - dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) - return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil) -} - -// ConvertFrom converts from the KubeadmConfigTemplateList Hub version (v1alpha3) to this version. -func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { - src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) - return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(src, dst, nil) -} - -// Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus converts this KubeadmConfigStatus to the Hub version (v1alpha3). -func Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Error fields to the Failure fields - out.FailureMessage = in.ErrorMessage - out.FailureReason = in.ErrorReason - - return nil -} - -// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus converts from the Hub version (v1alpha3) of the KubeadmConfigStatus to this version. -func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { - if err := autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in, out, s); err != nil { - return err - } - - // Manually convert the Failure fields to the Error fields - out.ErrorMessage = in.FailureMessage - out.ErrorReason = in.FailureReason - - return nil -} - -// Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec converts this KubeadmConfigSpec to the Hub version (v1alpha3). -func Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *KubeadmConfigSpec, out *kubeadmbootstrapv1alpha3.KubeadmConfigSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in, out, s) -} - -// Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec converts from the Hub version (v1alpha3) of the KubeadmConfigSpec to this version. -func Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in *kubeadmbootstrapv1alpha3.KubeadmConfigSpec, out *KubeadmConfigSpec, s apiconversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in, out, s) -} - -// Convert_v1alpha3_File_To_v1alpha2_File converts from the Hub version (v1alpha3) of the File to this version. -func Convert_v1alpha3_File_To_v1alpha2_File(in *kubeadmbootstrapv1alpha3.File, out *File, s apiconversion.Scope) error { - return autoConvert_v1alpha3_File_To_v1alpha2_File(in, out, s) -} diff --git a/bootstrap/kubeadm/api/v1alpha2/conversion_test.go b/bootstrap/kubeadm/api/v1alpha2/conversion_test.go deleted file mode 100644 index ac5e55c016de..000000000000 --- a/bootstrap/kubeadm/api/v1alpha2/conversion_test.go +++ /dev/null @@ -1,87 +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 v1alpha2 - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - . "github.com/onsi/gomega" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" - "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" -) - -func TestConvertKubeadmConfig(t *testing.T) { - t.Run("from hub", func(t *testing.T) { - t.Run("preserves fields from hub version", func(t *testing.T) { - g := NewWithT(t) - - src := &v1alpha3.KubeadmConfig{ - ObjectMeta: metav1.ObjectMeta{ - Name: "hub", - }, - Spec: v1alpha3.KubeadmConfigSpec{ - Files: []v1alpha3.File{ - { - Path: "/etc/another/file", - Owner: "ubuntu:ubuntu", - Encoding: v1alpha3.GzipBase64, - Permissions: "0600", - ContentFrom: &v1alpha3.FileSource{ - Secret: v1alpha3.SecretFileSource{ - Name: "foo", - Key: "bar", - }, - }, - }, - { - Path: "/etc/kubernetes/azure.json", - Owner: "root:root", - Encoding: v1alpha3.Base64, - Permissions: "0644", - Content: "baz", - }, - }, - }, - Status: v1alpha3.KubeadmConfigStatus{ - Ready: true, - DataSecretName: pointer.StringPtr("secret-data"), - }, - } - - dst := &KubeadmConfig{} - g.Expect(dst.ConvertFrom(src.DeepCopy())).To(Succeed()) - restored := &v1alpha3.KubeadmConfig{} - g.Expect(dst.ConvertTo(restored)).To(Succeed()) - - // Test field restored fields. - g.Expect(restored.Name).To(Equal(src.Name)) - g.Expect(restored.Status.Ready).To(Equal(src.Status.Ready)) - g.Expect(restored.Status.DataSecretName).To(Equal(src.Status.DataSecretName)) - - diff := cmp.Diff(src.Spec.Files, restored.Spec.Files, cmpopts.SortSlices(func(i, j v1alpha3.File) bool { - return i.Path < j.Path - })) - if diff != "" { - t.Fatalf(diff) - } - }) - }) -} diff --git a/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go deleted file mode 100644 index 7cf6fcc3587f..000000000000 --- a/bootstrap/kubeadm/api/v1alpha2/zz_generated.conversion.go +++ /dev/null @@ -1,495 +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 conversion-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - unsafe "unsafe" - - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - v1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - v1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" -) - -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((*File)(nil), (*v1alpha3.File)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_File_To_v1alpha3_File(a.(*File), b.(*v1alpha3.File), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfig)(nil), (*v1alpha3.KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(a.(*KubeadmConfig), b.(*v1alpha3.KubeadmConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfig)(nil), (*KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(a.(*v1alpha3.KubeadmConfig), b.(*KubeadmConfig), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigList)(nil), (*v1alpha3.KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(a.(*KubeadmConfigList), b.(*v1alpha3.KubeadmConfigList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigList)(nil), (*KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(a.(*v1alpha3.KubeadmConfigList), b.(*KubeadmConfigList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplate)(nil), (*v1alpha3.KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(a.(*KubeadmConfigTemplate), b.(*v1alpha3.KubeadmConfigTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplate)(nil), (*KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(a.(*v1alpha3.KubeadmConfigTemplate), b.(*KubeadmConfigTemplate), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateList)(nil), (*v1alpha3.KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(a.(*KubeadmConfigTemplateList), b.(*v1alpha3.KubeadmConfigTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateList)(nil), (*KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(a.(*v1alpha3.KubeadmConfigTemplateList), b.(*KubeadmConfigTemplateList), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateResource)(nil), (*v1alpha3.KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(a.(*KubeadmConfigTemplateResource), b.(*v1alpha3.KubeadmConfigTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateResource)(nil), (*KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(a.(*v1alpha3.KubeadmConfigTemplateResource), b.(*KubeadmConfigTemplateResource), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateSpec)(nil), (*v1alpha3.KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(a.(*KubeadmConfigTemplateSpec), b.(*v1alpha3.KubeadmConfigTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.KubeadmConfigTemplateSpec)(nil), (*KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(a.(*v1alpha3.KubeadmConfigTemplateSpec), b.(*KubeadmConfigTemplateSpec), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*NTP)(nil), (*v1alpha3.NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_NTP_To_v1alpha3_NTP(a.(*NTP), b.(*v1alpha3.NTP), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.NTP)(nil), (*NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_NTP_To_v1alpha2_NTP(a.(*v1alpha3.NTP), b.(*NTP), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*User)(nil), (*v1alpha3.User)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_User_To_v1alpha3_User(a.(*User), b.(*v1alpha3.User), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1alpha3.User)(nil), (*User)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_User_To_v1alpha2_User(a.(*v1alpha3.User), b.(*User), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*KubeadmConfigSpec)(nil), (*v1alpha3.KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(a.(*KubeadmConfigSpec), b.(*v1alpha3.KubeadmConfigSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha3.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha3.KubeadmConfigStatus), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.File)(nil), (*File)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_File_To_v1alpha2_File(a.(*v1alpha3.File), b.(*File), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.KubeadmConfigSpec)(nil), (*KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(a.(*v1alpha3.KubeadmConfigSpec), b.(*KubeadmConfigSpec), scope) - }); err != nil { - return err - } - if err := s.AddConversionFunc((*v1alpha3.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(a.(*v1alpha3.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha2_File_To_v1alpha3_File(in *File, out *v1alpha3.File, s conversion.Scope) error { - out.Path = in.Path - out.Owner = in.Owner - out.Permissions = in.Permissions - out.Encoding = v1alpha3.Encoding(in.Encoding) - out.Content = in.Content - return nil -} - -// Convert_v1alpha2_File_To_v1alpha3_File is an autogenerated conversion function. -func Convert_v1alpha2_File_To_v1alpha3_File(in *File, out *v1alpha3.File, s conversion.Scope) error { - return autoConvert_v1alpha2_File_To_v1alpha3_File(in, out, s) -} - -func autoConvert_v1alpha3_File_To_v1alpha2_File(in *v1alpha3.File, out *File, s conversion.Scope) error { - out.Path = in.Path - out.Owner = in.Owner - out.Permissions = in.Permissions - out.Encoding = Encoding(in.Encoding) - out.Content = in.Content - // WARNING: in.ContentFrom requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *KubeadmConfig, out *v1alpha3.KubeadmConfig, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *KubeadmConfig, out *v1alpha3.KubeadmConfig, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in *v1alpha3.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - if err := Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in *v1alpha3.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(in, out, s) -} - -func autoConvert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha3.KubeadmConfigList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.KubeadmConfig, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha3.KubeadmConfigList, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in *v1alpha3.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]KubeadmConfig, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in *v1alpha3.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(in, out, s) -} - -func autoConvert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1alpha3.KubeadmConfigSpec, s conversion.Scope) error { - out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) - out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) - out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) - if in.Files != nil { - in, out := &in.Files, &out.Files - *out = make([]v1alpha3.File, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_File_To_v1alpha3_File(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Files = nil - } - out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) - out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) - out.Users = *(*[]v1alpha3.User)(unsafe.Pointer(&in.Users)) - out.NTP = (*v1alpha3.NTP)(unsafe.Pointer(in.NTP)) - out.Format = v1alpha3.Format(in.Format) - return nil -} - -func autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(in *v1alpha3.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { - out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) - out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) - out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) - if in.Files != nil { - in, out := &in.Files, &out.Files - *out = make([]File, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_File_To_v1alpha2_File(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Files = nil - } - // WARNING: in.DiskSetup requires manual conversion: does not exist in peer-type - // WARNING: in.Mounts requires manual conversion: does not exist in peer-type - out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) - out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) - out.Users = *(*[]User)(unsafe.Pointer(&in.Users)) - out.NTP = (*NTP)(unsafe.Pointer(in.NTP)) - out.Format = Format(in.Format) - // WARNING: in.Verbosity requires manual conversion: does not exist in peer-type - // WARNING: in.UseExperimentalRetryJoin requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha3.KubeadmConfigStatus, s conversion.Scope) error { - out.Ready = in.Ready - out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) - // WARNING: in.ErrorReason requires manual conversion: does not exist in peer-type - // WARNING: in.ErrorMessage requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *v1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { - out.Ready = in.Ready - // WARNING: in.DataSecretName requires manual conversion: does not exist in peer-type - out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) - // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type - // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type - // WARNING: in.ObservedGeneration requires manual conversion: does not exist in peer-type - // WARNING: in.Conditions requires manual conversion: does not exist in peer-type - return nil -} - -func autoConvert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha3.KubeadmConfigTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha3.KubeadmConfigTemplate, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in *v1alpha3.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { - out.ObjectMeta = in.ObjectMeta - if err := Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in *v1alpha3.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(in, out, s) -} - -func autoConvert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha3.KubeadmConfigTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]v1alpha3.KubeadmConfigTemplate, len(*in)) - for i := range *in { - if err := Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha3.KubeadmConfigTemplateList, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in *v1alpha3.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]KubeadmConfigTemplate, len(*in)) - for i := range *in { - if err := Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(&(*in)[i], &(*out)[i], s); err != nil { - return err - } - } - } else { - out.Items = nil - } - return nil -} - -// Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in *v1alpha3.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(in, out, s) -} - -func autoConvert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha3.KubeadmConfigTemplateResource, s conversion.Scope) error { - if err := Convert_v1alpha2_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha3.KubeadmConfigTemplateResource, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in *v1alpha3.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { - if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha2_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in *v1alpha3.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(in, out, s) -} - -func autoConvert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha3.KubeadmConfigTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha2_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha3.KubeadmConfigTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha2_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in *v1alpha3.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { - if err := Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha2_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { - return err - } - return nil -} - -// Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in *v1alpha3.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha2_KubeadmConfigTemplateSpec(in, out, s) -} - -func autoConvert_v1alpha2_NTP_To_v1alpha3_NTP(in *NTP, out *v1alpha3.NTP, s conversion.Scope) error { - out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) - out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) - return nil -} - -// Convert_v1alpha2_NTP_To_v1alpha3_NTP is an autogenerated conversion function. -func Convert_v1alpha2_NTP_To_v1alpha3_NTP(in *NTP, out *v1alpha3.NTP, s conversion.Scope) error { - return autoConvert_v1alpha2_NTP_To_v1alpha3_NTP(in, out, s) -} - -func autoConvert_v1alpha3_NTP_To_v1alpha2_NTP(in *v1alpha3.NTP, out *NTP, s conversion.Scope) error { - out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) - out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) - return nil -} - -// Convert_v1alpha3_NTP_To_v1alpha2_NTP is an autogenerated conversion function. -func Convert_v1alpha3_NTP_To_v1alpha2_NTP(in *v1alpha3.NTP, out *NTP, s conversion.Scope) error { - return autoConvert_v1alpha3_NTP_To_v1alpha2_NTP(in, out, s) -} - -func autoConvert_v1alpha2_User_To_v1alpha3_User(in *User, out *v1alpha3.User, s conversion.Scope) error { - out.Name = in.Name - out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) - out.Groups = (*string)(unsafe.Pointer(in.Groups)) - out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) - out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) - out.Shell = (*string)(unsafe.Pointer(in.Shell)) - out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) - out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) - out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) - out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) - out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) - return nil -} - -// Convert_v1alpha2_User_To_v1alpha3_User is an autogenerated conversion function. -func Convert_v1alpha2_User_To_v1alpha3_User(in *User, out *v1alpha3.User, s conversion.Scope) error { - return autoConvert_v1alpha2_User_To_v1alpha3_User(in, out, s) -} - -func autoConvert_v1alpha3_User_To_v1alpha2_User(in *v1alpha3.User, out *User, s conversion.Scope) error { - out.Name = in.Name - out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) - out.Groups = (*string)(unsafe.Pointer(in.Groups)) - out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) - out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) - out.Shell = (*string)(unsafe.Pointer(in.Shell)) - out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) - out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) - out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) - out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) - out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) - return nil -} - -// Convert_v1alpha3_User_To_v1alpha2_User is an autogenerated conversion function. -func Convert_v1alpha3_User_To_v1alpha2_User(in *v1alpha3.User, out *User, s conversion.Scope) error { - return autoConvert_v1alpha3_User_To_v1alpha2_User(in, out, s) -} diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go index 13a5d47ca7d0..6e77a1d20983 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -16,7 +16,55 @@ limitations under the License. package v1alpha3 -func (*KubeadmConfig) Hub() {} -func (*KubeadmConfigList) Hub() {} -func (*KubeadmConfigTemplate) Hub() {} -func (*KubeadmConfigTemplateList) Hub() {} +import ( + kubeadmbootstrapv1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts this KubeadmConfig to the Hub version (v1alpha4). +func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfig) + return Convert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfig Hub version (v1alpha4) to this version. +func (dst *KubeadmConfig) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfig) + return Convert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigList to the Hub version (v1alpha4). +func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigList) + return Convert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigList Hub version (v1alpha4) to this version. +func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigList) + return Convert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigTemplate to the Hub version (v1alpha4). +func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplate) + return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigTemplate Hub version (v1alpha4) to this version. +func (dst *KubeadmConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplate) + return Convert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(src, dst, nil) +} + +// ConvertTo converts this KubeadmConfigTemplateList to the Hub version (v1alpha3). +func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { + dst := dstRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList) + return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(src, dst, nil) +} + +// ConvertFrom converts from the KubeadmConfigTemplateList Hub version (v1alpha3) to this version. +func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList) + return Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil) +} diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion_test.go b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go new file mode 100644 index 000000000000..589c077d17ff --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/conversion_test.go @@ -0,0 +1,37 @@ +/* +Copyright 2020 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 v1alpha3 + +import ( + "testing" + + . "github.com/onsi/gomega" + + "k8s.io/apimachinery/pkg/runtime" + "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 KubeadmConfig", utilconversion.FuzzTestFunc(scheme, &v1alpha4.KubeadmConfig{}, &KubeadmConfig{})) + t.Run("for KubeadmConfigTemplate", utilconversion.FuzzTestFunc(scheme, &v1alpha4.KubeadmConfigTemplate{}, &KubeadmConfigTemplate{})) +} diff --git a/bootstrap/kubeadm/api/v1alpha3/doc.go b/bootstrap/kubeadm/api/v1alpha3/doc.go index 999cec2ac553..521995bcde4b 100644 --- a/bootstrap/kubeadm/api/v1alpha3/doc.go +++ b/bootstrap/kubeadm/api/v1alpha3/doc.go @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4 package v1alpha3 diff --git a/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go b/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go index c16eb4210d7c..069f26d44f9a 100644 --- a/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go +++ b/bootstrap/kubeadm/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go index 31edf633a4ed..da56be0990e4 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types.go @@ -133,7 +133,6 @@ type KubeadmConfigStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigs,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // KubeadmConfig is the Schema for the kubeadmconfigs API diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go index 672673965ea1..edff946797af 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go +++ b/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_types.go @@ -32,7 +32,6 @@ type KubeadmConfigTemplateResource struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigtemplates,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API type KubeadmConfigTemplate struct { diff --git a/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..959b32538146 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,686 @@ +// +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 v1alpha3 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + 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" +) + +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((*DiskSetup)(nil), (*v1alpha4.DiskSetup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DiskSetup_To_v1alpha4_DiskSetup(a.(*DiskSetup), b.(*v1alpha4.DiskSetup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DiskSetup)(nil), (*DiskSetup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DiskSetup_To_v1alpha3_DiskSetup(a.(*v1alpha4.DiskSetup), b.(*DiskSetup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*File)(nil), (*v1alpha4.File)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_File_To_v1alpha4_File(a.(*File), b.(*v1alpha4.File), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.File)(nil), (*File)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_File_To_v1alpha3_File(a.(*v1alpha4.File), b.(*File), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*FileSource)(nil), (*v1alpha4.FileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_FileSource_To_v1alpha4_FileSource(a.(*FileSource), b.(*v1alpha4.FileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.FileSource)(nil), (*FileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_FileSource_To_v1alpha3_FileSource(a.(*v1alpha4.FileSource), b.(*FileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Filesystem)(nil), (*v1alpha4.Filesystem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Filesystem_To_v1alpha4_Filesystem(a.(*Filesystem), b.(*v1alpha4.Filesystem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Filesystem)(nil), (*Filesystem)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Filesystem_To_v1alpha3_Filesystem(a.(*v1alpha4.Filesystem), b.(*Filesystem), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfig)(nil), (*v1alpha4.KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(a.(*KubeadmConfig), b.(*v1alpha4.KubeadmConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfig)(nil), (*KubeadmConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(a.(*v1alpha4.KubeadmConfig), b.(*KubeadmConfig), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigList)(nil), (*v1alpha4.KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(a.(*KubeadmConfigList), b.(*v1alpha4.KubeadmConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigList)(nil), (*KubeadmConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(a.(*v1alpha4.KubeadmConfigList), b.(*KubeadmConfigList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigSpec)(nil), (*v1alpha4.KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(a.(*KubeadmConfigSpec), b.(*v1alpha4.KubeadmConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigSpec)(nil), (*KubeadmConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(a.(*v1alpha4.KubeadmConfigSpec), b.(*KubeadmConfigSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha4.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha4.KubeadmConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*v1alpha4.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplate)(nil), (*v1alpha4.KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate(a.(*KubeadmConfigTemplate), b.(*v1alpha4.KubeadmConfigTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigTemplate)(nil), (*KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(a.(*v1alpha4.KubeadmConfigTemplate), b.(*KubeadmConfigTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateList)(nil), (*v1alpha4.KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(a.(*KubeadmConfigTemplateList), b.(*v1alpha4.KubeadmConfigTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigTemplateList)(nil), (*KubeadmConfigTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(a.(*v1alpha4.KubeadmConfigTemplateList), b.(*KubeadmConfigTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateResource)(nil), (*v1alpha4.KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(a.(*KubeadmConfigTemplateResource), b.(*v1alpha4.KubeadmConfigTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigTemplateResource)(nil), (*KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(a.(*v1alpha4.KubeadmConfigTemplateResource), b.(*KubeadmConfigTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplateSpec)(nil), (*v1alpha4.KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec(a.(*KubeadmConfigTemplateSpec), b.(*v1alpha4.KubeadmConfigTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigTemplateSpec)(nil), (*KubeadmConfigTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(a.(*v1alpha4.KubeadmConfigTemplateSpec), b.(*KubeadmConfigTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*NTP)(nil), (*v1alpha4.NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_NTP_To_v1alpha4_NTP(a.(*NTP), b.(*v1alpha4.NTP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.NTP)(nil), (*NTP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_NTP_To_v1alpha3_NTP(a.(*v1alpha4.NTP), b.(*NTP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Partition)(nil), (*v1alpha4.Partition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Partition_To_v1alpha4_Partition(a.(*Partition), b.(*v1alpha4.Partition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Partition)(nil), (*Partition)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Partition_To_v1alpha3_Partition(a.(*v1alpha4.Partition), b.(*Partition), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*SecretFileSource)(nil), (*v1alpha4.SecretFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource(a.(*SecretFileSource), b.(*v1alpha4.SecretFileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.SecretFileSource)(nil), (*SecretFileSource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource(a.(*v1alpha4.SecretFileSource), b.(*SecretFileSource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*User)(nil), (*v1alpha4.User)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_User_To_v1alpha4_User(a.(*User), b.(*v1alpha4.User), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.User)(nil), (*User)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_User_To_v1alpha3_User(a.(*v1alpha4.User), b.(*User), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_DiskSetup_To_v1alpha4_DiskSetup(in *DiskSetup, out *v1alpha4.DiskSetup, s conversion.Scope) error { + out.Partitions = *(*[]v1alpha4.Partition)(unsafe.Pointer(&in.Partitions)) + out.Filesystems = *(*[]v1alpha4.Filesystem)(unsafe.Pointer(&in.Filesystems)) + return nil +} + +// Convert_v1alpha3_DiskSetup_To_v1alpha4_DiskSetup is an autogenerated conversion function. +func Convert_v1alpha3_DiskSetup_To_v1alpha4_DiskSetup(in *DiskSetup, out *v1alpha4.DiskSetup, s conversion.Scope) error { + return autoConvert_v1alpha3_DiskSetup_To_v1alpha4_DiskSetup(in, out, s) +} + +func autoConvert_v1alpha4_DiskSetup_To_v1alpha3_DiskSetup(in *v1alpha4.DiskSetup, out *DiskSetup, s conversion.Scope) error { + out.Partitions = *(*[]Partition)(unsafe.Pointer(&in.Partitions)) + out.Filesystems = *(*[]Filesystem)(unsafe.Pointer(&in.Filesystems)) + return nil +} + +// Convert_v1alpha4_DiskSetup_To_v1alpha3_DiskSetup is an autogenerated conversion function. +func Convert_v1alpha4_DiskSetup_To_v1alpha3_DiskSetup(in *v1alpha4.DiskSetup, out *DiskSetup, s conversion.Scope) error { + return autoConvert_v1alpha4_DiskSetup_To_v1alpha3_DiskSetup(in, out, s) +} + +func autoConvert_v1alpha3_File_To_v1alpha4_File(in *File, out *v1alpha4.File, s conversion.Scope) error { + out.Path = in.Path + out.Owner = in.Owner + out.Permissions = in.Permissions + out.Encoding = v1alpha4.Encoding(in.Encoding) + out.Content = in.Content + out.ContentFrom = (*v1alpha4.FileSource)(unsafe.Pointer(in.ContentFrom)) + return nil +} + +// Convert_v1alpha3_File_To_v1alpha4_File is an autogenerated conversion function. +func Convert_v1alpha3_File_To_v1alpha4_File(in *File, out *v1alpha4.File, s conversion.Scope) error { + return autoConvert_v1alpha3_File_To_v1alpha4_File(in, out, s) +} + +func autoConvert_v1alpha4_File_To_v1alpha3_File(in *v1alpha4.File, out *File, s conversion.Scope) error { + out.Path = in.Path + out.Owner = in.Owner + out.Permissions = in.Permissions + out.Encoding = Encoding(in.Encoding) + out.Content = in.Content + out.ContentFrom = (*FileSource)(unsafe.Pointer(in.ContentFrom)) + return nil +} + +// Convert_v1alpha4_File_To_v1alpha3_File is an autogenerated conversion function. +func Convert_v1alpha4_File_To_v1alpha3_File(in *v1alpha4.File, out *File, s conversion.Scope) error { + return autoConvert_v1alpha4_File_To_v1alpha3_File(in, out, s) +} + +func autoConvert_v1alpha3_FileSource_To_v1alpha4_FileSource(in *FileSource, out *v1alpha4.FileSource, s conversion.Scope) error { + if err := Convert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource(&in.Secret, &out.Secret, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_FileSource_To_v1alpha4_FileSource is an autogenerated conversion function. +func Convert_v1alpha3_FileSource_To_v1alpha4_FileSource(in *FileSource, out *v1alpha4.FileSource, s conversion.Scope) error { + return autoConvert_v1alpha3_FileSource_To_v1alpha4_FileSource(in, out, s) +} + +func autoConvert_v1alpha4_FileSource_To_v1alpha3_FileSource(in *v1alpha4.FileSource, out *FileSource, s conversion.Scope) error { + if err := Convert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource(&in.Secret, &out.Secret, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_FileSource_To_v1alpha3_FileSource is an autogenerated conversion function. +func Convert_v1alpha4_FileSource_To_v1alpha3_FileSource(in *v1alpha4.FileSource, out *FileSource, s conversion.Scope) error { + return autoConvert_v1alpha4_FileSource_To_v1alpha3_FileSource(in, out, s) +} + +func autoConvert_v1alpha3_Filesystem_To_v1alpha4_Filesystem(in *Filesystem, out *v1alpha4.Filesystem, s conversion.Scope) error { + out.Device = in.Device + out.Filesystem = in.Filesystem + out.Label = in.Label + out.Partition = (*string)(unsafe.Pointer(in.Partition)) + out.Overwrite = (*bool)(unsafe.Pointer(in.Overwrite)) + out.ReplaceFS = (*string)(unsafe.Pointer(in.ReplaceFS)) + out.ExtraOpts = *(*[]string)(unsafe.Pointer(&in.ExtraOpts)) + return nil +} + +// Convert_v1alpha3_Filesystem_To_v1alpha4_Filesystem is an autogenerated conversion function. +func Convert_v1alpha3_Filesystem_To_v1alpha4_Filesystem(in *Filesystem, out *v1alpha4.Filesystem, s conversion.Scope) error { + return autoConvert_v1alpha3_Filesystem_To_v1alpha4_Filesystem(in, out, s) +} + +func autoConvert_v1alpha4_Filesystem_To_v1alpha3_Filesystem(in *v1alpha4.Filesystem, out *Filesystem, s conversion.Scope) error { + out.Device = in.Device + out.Filesystem = in.Filesystem + out.Label = in.Label + out.Partition = (*string)(unsafe.Pointer(in.Partition)) + out.Overwrite = (*bool)(unsafe.Pointer(in.Overwrite)) + out.ReplaceFS = (*string)(unsafe.Pointer(in.ReplaceFS)) + out.ExtraOpts = *(*[]string)(unsafe.Pointer(&in.ExtraOpts)) + return nil +} + +// Convert_v1alpha4_Filesystem_To_v1alpha3_Filesystem is an autogenerated conversion function. +func Convert_v1alpha4_Filesystem_To_v1alpha3_Filesystem(in *v1alpha4.Filesystem, out *Filesystem, s conversion.Scope) error { + return autoConvert_v1alpha4_Filesystem_To_v1alpha3_Filesystem(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(in *KubeadmConfig, out *v1alpha4.KubeadmConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(in *KubeadmConfig, out *v1alpha4.KubeadmConfig, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *v1alpha4.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(in *v1alpha4.KubeadmConfig, out *KubeadmConfig, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha4.KubeadmConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.KubeadmConfig, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_KubeadmConfig_To_v1alpha4_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(in *KubeadmConfigList, out *v1alpha4.KubeadmConfigList, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigList_To_v1alpha4_KubeadmConfigList(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *v1alpha4.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmConfig, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_KubeadmConfig_To_v1alpha3_KubeadmConfig(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in *v1alpha4.KubeadmConfigList, out *KubeadmConfigList, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1alpha4.KubeadmConfigSpec, s conversion.Scope) error { + out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) + out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + out.Files = *(*[]v1alpha4.File)(unsafe.Pointer(&in.Files)) + out.DiskSetup = (*v1alpha4.DiskSetup)(unsafe.Pointer(in.DiskSetup)) + out.Mounts = *(*[]v1alpha4.MountPoints)(unsafe.Pointer(&in.Mounts)) + out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) + out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) + out.Users = *(*[]v1alpha4.User)(unsafe.Pointer(&in.Users)) + out.NTP = (*v1alpha4.NTP)(unsafe.Pointer(in.NTP)) + out.Format = v1alpha4.Format(in.Format) + out.Verbosity = (*int32)(unsafe.Pointer(in.Verbosity)) + out.UseExperimentalRetryJoin = in.UseExperimentalRetryJoin + return nil +} + +// Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in *KubeadmConfigSpec, out *v1alpha4.KubeadmConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *v1alpha4.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { + out.ClusterConfiguration = (*v1beta1.ClusterConfiguration)(unsafe.Pointer(in.ClusterConfiguration)) + out.InitConfiguration = (*v1beta1.InitConfiguration)(unsafe.Pointer(in.InitConfiguration)) + out.JoinConfiguration = (*v1beta1.JoinConfiguration)(unsafe.Pointer(in.JoinConfiguration)) + out.Files = *(*[]File)(unsafe.Pointer(&in.Files)) + out.DiskSetup = (*DiskSetup)(unsafe.Pointer(in.DiskSetup)) + out.Mounts = *(*[]MountPoints)(unsafe.Pointer(&in.Mounts)) + out.PreKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PreKubeadmCommands)) + out.PostKubeadmCommands = *(*[]string)(unsafe.Pointer(&in.PostKubeadmCommands)) + out.Users = *(*[]User)(unsafe.Pointer(&in.Users)) + out.NTP = (*NTP)(unsafe.Pointer(in.NTP)) + out.Format = Format(in.Format) + out.Verbosity = (*int32)(unsafe.Pointer(in.Verbosity)) + out.UseExperimentalRetryJoin = in.UseExperimentalRetryJoin + return nil +} + +// Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *v1alpha4.KubeadmConfigSpec, out *KubeadmConfigSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha4.KubeadmConfigStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) + out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) + out.FailureReason = in.FailureReason + out.FailureMessage = in.FailureMessage + out.ObservedGeneration = in.ObservedGeneration + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha4.KubeadmConfigStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *v1alpha4.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) + out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) + out.FailureReason = in.FailureReason + out.FailureMessage = in.FailureMessage + out.ObservedGeneration = in.ObservedGeneration + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha3.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *v1alpha4.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha4.KubeadmConfigTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1alpha4.KubeadmConfigTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1alpha4_KubeadmConfigTemplate(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *v1alpha4.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in *v1alpha4.KubeadmConfigTemplate, out *KubeadmConfigTemplate, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha4.KubeadmConfigTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.KubeadmConfigTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(in *KubeadmConfigTemplateList, out *v1alpha4.KubeadmConfigTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha4_KubeadmConfigTemplateList(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *v1alpha4.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]KubeadmConfigTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in *v1alpha4.KubeadmConfigTemplateList, out *KubeadmConfigTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha4.KubeadmConfigTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(in *KubeadmConfigTemplateResource, out *v1alpha4.KubeadmConfigTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *v1alpha4.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in *v1alpha4.KubeadmConfigTemplateResource, out *KubeadmConfigTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha4.KubeadmConfigTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec(in *KubeadmConfigTemplateSpec, out *v1alpha4.KubeadmConfigTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmConfigTemplateSpec_To_v1alpha4_KubeadmConfigTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *v1alpha4.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha4_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in *v1alpha4.KubeadmConfigTemplateSpec, out *KubeadmConfigTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmConfigTemplateSpec_To_v1alpha3_KubeadmConfigTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha3_NTP_To_v1alpha4_NTP(in *NTP, out *v1alpha4.NTP, s conversion.Scope) error { + out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) + out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) + return nil +} + +// Convert_v1alpha3_NTP_To_v1alpha4_NTP is an autogenerated conversion function. +func Convert_v1alpha3_NTP_To_v1alpha4_NTP(in *NTP, out *v1alpha4.NTP, s conversion.Scope) error { + return autoConvert_v1alpha3_NTP_To_v1alpha4_NTP(in, out, s) +} + +func autoConvert_v1alpha4_NTP_To_v1alpha3_NTP(in *v1alpha4.NTP, out *NTP, s conversion.Scope) error { + out.Servers = *(*[]string)(unsafe.Pointer(&in.Servers)) + out.Enabled = (*bool)(unsafe.Pointer(in.Enabled)) + return nil +} + +// Convert_v1alpha4_NTP_To_v1alpha3_NTP is an autogenerated conversion function. +func Convert_v1alpha4_NTP_To_v1alpha3_NTP(in *v1alpha4.NTP, out *NTP, s conversion.Scope) error { + return autoConvert_v1alpha4_NTP_To_v1alpha3_NTP(in, out, s) +} + +func autoConvert_v1alpha3_Partition_To_v1alpha4_Partition(in *Partition, out *v1alpha4.Partition, s conversion.Scope) error { + out.Device = in.Device + out.Layout = in.Layout + out.Overwrite = (*bool)(unsafe.Pointer(in.Overwrite)) + out.TableType = (*string)(unsafe.Pointer(in.TableType)) + return nil +} + +// Convert_v1alpha3_Partition_To_v1alpha4_Partition is an autogenerated conversion function. +func Convert_v1alpha3_Partition_To_v1alpha4_Partition(in *Partition, out *v1alpha4.Partition, s conversion.Scope) error { + return autoConvert_v1alpha3_Partition_To_v1alpha4_Partition(in, out, s) +} + +func autoConvert_v1alpha4_Partition_To_v1alpha3_Partition(in *v1alpha4.Partition, out *Partition, s conversion.Scope) error { + out.Device = in.Device + out.Layout = in.Layout + out.Overwrite = (*bool)(unsafe.Pointer(in.Overwrite)) + out.TableType = (*string)(unsafe.Pointer(in.TableType)) + return nil +} + +// Convert_v1alpha4_Partition_To_v1alpha3_Partition is an autogenerated conversion function. +func Convert_v1alpha4_Partition_To_v1alpha3_Partition(in *v1alpha4.Partition, out *Partition, s conversion.Scope) error { + return autoConvert_v1alpha4_Partition_To_v1alpha3_Partition(in, out, s) +} + +func autoConvert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource(in *SecretFileSource, out *v1alpha4.SecretFileSource, s conversion.Scope) error { + out.Name = in.Name + out.Key = in.Key + return nil +} + +// Convert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource is an autogenerated conversion function. +func Convert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource(in *SecretFileSource, out *v1alpha4.SecretFileSource, s conversion.Scope) error { + return autoConvert_v1alpha3_SecretFileSource_To_v1alpha4_SecretFileSource(in, out, s) +} + +func autoConvert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource(in *v1alpha4.SecretFileSource, out *SecretFileSource, s conversion.Scope) error { + out.Name = in.Name + out.Key = in.Key + return nil +} + +// Convert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource is an autogenerated conversion function. +func Convert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource(in *v1alpha4.SecretFileSource, out *SecretFileSource, s conversion.Scope) error { + return autoConvert_v1alpha4_SecretFileSource_To_v1alpha3_SecretFileSource(in, out, s) +} + +func autoConvert_v1alpha3_User_To_v1alpha4_User(in *User, out *v1alpha4.User, s conversion.Scope) error { + out.Name = in.Name + out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) + out.Groups = (*string)(unsafe.Pointer(in.Groups)) + out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) + out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) + out.Shell = (*string)(unsafe.Pointer(in.Shell)) + out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) + out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) + out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) + out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) + out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) + return nil +} + +// Convert_v1alpha3_User_To_v1alpha4_User is an autogenerated conversion function. +func Convert_v1alpha3_User_To_v1alpha4_User(in *User, out *v1alpha4.User, s conversion.Scope) error { + return autoConvert_v1alpha3_User_To_v1alpha4_User(in, out, s) +} + +func autoConvert_v1alpha4_User_To_v1alpha3_User(in *v1alpha4.User, out *User, s conversion.Scope) error { + out.Name = in.Name + out.Gecos = (*string)(unsafe.Pointer(in.Gecos)) + out.Groups = (*string)(unsafe.Pointer(in.Groups)) + out.HomeDir = (*string)(unsafe.Pointer(in.HomeDir)) + out.Inactive = (*bool)(unsafe.Pointer(in.Inactive)) + out.Shell = (*string)(unsafe.Pointer(in.Shell)) + out.Passwd = (*string)(unsafe.Pointer(in.Passwd)) + out.PrimaryGroup = (*string)(unsafe.Pointer(in.PrimaryGroup)) + out.LockPassword = (*bool)(unsafe.Pointer(in.LockPassword)) + out.Sudo = (*string)(unsafe.Pointer(in.Sudo)) + out.SSHAuthorizedKeys = *(*[]string)(unsafe.Pointer(&in.SSHAuthorizedKeys)) + return nil +} + +// Convert_v1alpha4_User_To_v1alpha3_User is an autogenerated conversion function. +func Convert_v1alpha4_User_To_v1alpha3_User(in *v1alpha4.User, out *User, s conversion.Scope) error { + return autoConvert_v1alpha4_User_To_v1alpha3_User(in, out, s) +} diff --git a/bootstrap/kubeadm/api/v1alpha4/condition_consts.go b/bootstrap/kubeadm/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..4743af96ee08 --- /dev/null +++ b/bootstrap/kubeadm/api/v1alpha4/condition_consts.go @@ -0,0 +1,68 @@ +/* +Copyright 2020 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 v1alpha4 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + +// Conditions and condition Reasons for the KubeadmConfig object + +const ( + // DataSecretAvailableCondition documents the status of the bootstrap secret generation process. + // + // NOTE: When the DataSecret generation starts the process completes immediately and within the + // same reconciliation, so the user will always see a transition from Wait to Generated without having + // evidence that BootstrapSecret generation is started/in progress. + DataSecretAvailableCondition clusterv1.ConditionType = "DataSecretAvailable" + + // WaitingForClusterInfrastructureReason (Severity=Info) document a bootstrap secret generation process + // waiting for the cluster infrastructure to be ready. + // + // NOTE: Having the cluster infrastructure ready is a pre-condition for starting to create machines; + // the KubeadmConfig controller ensure this pre-condition is satisfied. + WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" + + // WaitingForControlPlaneAvailableReason (Severity=Info) document a bootstrap secret generation process + // waiting for the control plane machine to be available. + // + // NOTE: Having the control plane machine available is a pre-condition for joining additional control planes + // or workers nodes. + WaitingForControlPlaneAvailableReason = "WaitingForControlPlaneAvailable" + + // DataSecretGenerationFailedReason (Severity=Warning) documents a KubeadmConfig controller detecting + // an error while generating a data secret; those kind of errors are usually due to misconfigurations + // and user intervention is required to get them fixed. + DataSecretGenerationFailedReason = "DataSecretGenerationFailed" +) + +const ( + // CertificatesAvailableCondition documents that cluster certificates are available. + // + // NOTE: Cluster certificates are generated only for the KubeadmConfig object linked to the initial control plane + // machine, if the cluster is not using a control plane ref object, if the certificates are not provided + // by the users. + // IMPORTANT: This condition won't be re-created after clusterctl move. + CertificatesAvailableCondition clusterv1.ConditionType = "CertificatesAvailable" + + // CertificatesGenerationFailedReason (Severity=Warning) documents a KubeadmConfig controller detecting + // an error while generating certificates; those kind of errors are usually temporary and the controller + // automatically recover from them. + CertificatesGenerationFailedReason = "CertificatesGenerationFailed" + + // CertificatesCorruptedReason (Severity=Error) documents a KubeadmConfig controller detecting + // an error while while retrieving certificates for a joining node. + CertificatesCorruptedReason = "CertificatesCorrupted" +) diff --git a/api/v1alpha2/machine_webhook.go b/bootstrap/kubeadm/api/v1alpha4/conversion.go similarity index 58% rename from api/v1alpha2/machine_webhook.go rename to bootstrap/kubeadm/api/v1alpha4/conversion.go index 97ad87584e02..7f52819b4f9a 100644 --- a/api/v1alpha2/machine_webhook.go +++ b/bootstrap/kubeadm/api/v1alpha4/conversion.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,18 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 -import ( - ctrl "sigs.k8s.io/controller-runtime" - logf "sigs.k8s.io/controller-runtime/pkg/log" -) - -// log is for logging in this package. -var _ = logf.Log.WithName("machine-resource") - -func (r *Machine) SetupWebhookWithManager(mgr ctrl.Manager) error { - return ctrl.NewWebhookManagedBy(mgr). - For(r). - Complete() -} +func (*KubeadmConfig) Hub() {} +func (*KubeadmConfigList) Hub() {} +func (*KubeadmConfigTemplate) Hub() {} +func (*KubeadmConfigTemplateList) Hub() {} diff --git a/bootstrap/kubeadm/api/v1alpha2/doc.go b/bootstrap/kubeadm/api/v1alpha4/doc.go similarity index 79% rename from bootstrap/kubeadm/api/v1alpha2/doc.go rename to bootstrap/kubeadm/api/v1alpha4/doc.go index 7fee63494946..b0efd4cde559 100644 --- a/bootstrap/kubeadm/api/v1alpha2/doc.go +++ b/bootstrap/kubeadm/api/v1alpha4/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,5 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:conversion-gen=sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3 -package v1alpha2 +package v1alpha4 diff --git a/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go b/bootstrap/kubeadm/api/v1alpha4/groupversion_info.go similarity index 83% rename from bootstrap/kubeadm/api/v1alpha2/groupversion_info.go rename to bootstrap/kubeadm/api/v1alpha4/groupversion_info.go index 2b042f0ed460..520a22139830 100644 --- a/bootstrap/kubeadm/api/v1alpha2/groupversion_info.go +++ b/bootstrap/kubeadm/api/v1alpha4/groupversion_info.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1alpha2 contains API Schema definitions for the kubeadm v1alpha2 API group +// Package v1alpha4 contains API Schema definitions for the kubeadm v1alpha4 API group // +kubebuilder:object:generate=true // +groupName=bootstrap.cluster.x-k8s.io -package v1alpha2 +package v1alpha4 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -26,13 +26,11 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "bootstrap.cluster.x-k8s.io", Version: "v1alpha2"} + GroupVersion = schema.GroupVersion{Group: "bootstrap.cluster.x-k8s.io", Version: "v1alpha4"} // 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/api/v1alpha2/kubeadmbootstrapconfig_types.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go similarity index 52% rename from bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go index ff8754bfcaa6..ddb6ac2c6f79 100644 --- a/bootstrap/kubeadm/api/v1alpha2/kubeadmbootstrapconfig_types.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,10 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" ) @@ -36,30 +37,64 @@ type KubeadmConfigSpec struct { // ClusterConfiguration along with InitConfiguration are the configurations necessary for the init command // +optional ClusterConfiguration *kubeadmv1beta1.ClusterConfiguration `json:"clusterConfiguration,omitempty"` + // InitConfiguration along with ClusterConfiguration are the configurations necessary for the init command // +optional InitConfiguration *kubeadmv1beta1.InitConfiguration `json:"initConfiguration,omitempty"` + // JoinConfiguration is the kubeadm configuration for the join command // +optional JoinConfiguration *kubeadmv1beta1.JoinConfiguration `json:"joinConfiguration,omitempty"` + // Files specifies extra files to be passed to user_data upon creation. // +optional Files []File `json:"files,omitempty"` + + // DiskSetup specifies options for the creation of partition tables and file systems on devices. + // +optional + DiskSetup *DiskSetup `json:"diskSetup,omitempty"` + + // Mounts specifies a list of mount points to be setup. + // +optional + Mounts []MountPoints `json:"mounts,omitempty"` + // PreKubeadmCommands specifies extra commands to run before kubeadm runs // +optional PreKubeadmCommands []string `json:"preKubeadmCommands,omitempty"` + // PostKubeadmCommands specifies extra commands to run after kubeadm runs // +optional PostKubeadmCommands []string `json:"postKubeadmCommands,omitempty"` + // Users specifies extra users to add // +optional Users []User `json:"users,omitempty"` + // NTP specifies NTP configuration // +optional NTP *NTP `json:"ntp,omitempty"` + // Format specifies the output format of the bootstrap data // +optional Format Format `json:"format,omitempty"` + + // Verbosity is the number for the kubeadm log level verbosity. + // It overrides the `--v` flag in kubeadm commands. + // +optional + Verbosity *int32 `json:"verbosity,omitempty"` + + // UseExperimentalRetryJoin replaces a basic kubeadm command with a shell + // script with retries for joins. + // + // This is meant to be an experimental temporary workaround on some environments + // where joins fail due to timing (and other issues). The long term goal is to add retries to + // kubeadm proper and use that functionality. + // + // This will add about 40KB to userdata + // + // For more information, refer to https://github.com/kubernetes-sigs/cluster-api/pull/2763#discussion_r397306055. + // +optional + UseExperimentalRetryJoin bool `json:"useExperimentalRetryJoin,omitempty"` } // KubeadmConfigStatus defines the observed state of KubeadmConfig @@ -67,21 +102,38 @@ type KubeadmConfigStatus struct { // Ready indicates the BootstrapData field is ready to be consumed Ready bool `json:"ready,omitempty"` - // BootstrapData will be a cloud-init script for now + // DataSecretName is the name of the secret that stores the bootstrap data script. + // +optional + DataSecretName *string `json:"dataSecretName,omitempty"` + + // BootstrapData will be a cloud-init script for now. + // + // Deprecated: This field has been deprecated in v1alpha3 and + // will be removed in a future version. Switch to DataSecretName. + // // +optional BootstrapData []byte `json:"bootstrapData,omitempty"` - // ErrorReason will be set on non-retryable errors + // FailureReason will be set on non-retryable errors + // +optional + FailureReason string `json:"failureReason,omitempty"` + + // FailureMessage will be set on non-retryable errors + // +optional + FailureMessage string `json:"failureMessage,omitempty"` + + // ObservedGeneration is the latest generation observed by the controller. // +optional - ErrorReason string `json:"errorReason,omitempty"` + ObservedGeneration int64 `json:"observedGeneration,omitempty"` - // ErrorMessage will be set on non-retryable errors + // Conditions defines current service state of the KubeadmConfig. // +optional - ErrorMessage string `json:"errorMessage,omitempty"` + Conditions clusterv1.Conditions `json:"conditions,omitempty"` } // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigs,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion // +kubebuilder:subresource:status // KubeadmConfig is the Schema for the kubeadmconfigs API @@ -93,6 +145,14 @@ type KubeadmConfig struct { Status KubeadmConfigStatus `json:"status,omitempty"` } +func (c *KubeadmConfig) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +func (c *KubeadmConfig) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + // +kubebuilder:object:root=true // KubeadmConfigList contains a list of KubeadmConfig @@ -137,7 +197,32 @@ type File struct { Encoding Encoding `json:"encoding,omitempty"` // Content is the actual content of the file. - Content string `json:"content"` + // +optional + Content string `json:"content,omitempty"` + + // ContentFrom is a referenced source of content to populate the file. + // +optional + ContentFrom *FileSource `json:"contentFrom,omitempty"` +} + +// FileSource is a union of all possible external source types for file data. +// Only one field may be populated in any given instance. Developers adding new +// sources of data for target systems should add them here. +type FileSource struct { + // Secret represents a secret that should populate this file. + Secret SecretFileSource `json:"secret"` +} + +// Adapts a Secret into a FileSource. +// +// The contents of the target Secret's Data field will be presented +// as files using the keys in the Data field as the file names. +type SecretFileSource struct { + // Name of the secret in the KubeadmBootstrapConfig's namespace to use. + Name string `json:"name"` + + // Key is the key in the secret's data map for this value. + Key string `json:"key"` } // User defines the input for a generated user in cloud-init. @@ -196,3 +281,57 @@ type NTP struct { // +optional Enabled *bool `json:"enabled,omitempty"` } + +// DiskSetup defines input for generated disk_setup and fs_setup in cloud-init. +type DiskSetup struct { + // Partitions specifies the list of the partitions to setup. + Partitions []Partition `json:"partitions,omitempty"` + // Filesystems specifies the list of file systems to setup. + Filesystems []Filesystem `json:"filesystems,omitempty"` +} + +// Partition defines how to create and layout a partition. +type Partition struct { + // Device is the name of the device. + Device string `json:"device"` + // Layout specifies the device layout. + // If it is true, a single partition will be created for the entire device. + // When layout is false, it means don't partition or ignore existing partitioning. + Layout bool `json:"layout"` + // Overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device. + // Use with caution. Default is 'false'. + // +optional + Overwrite *bool `json:"overwrite,omitempty"` + // TableType specifies the tupe of partition table. The following are supported: + // 'mbr': default and setups a MS-DOS partition table + // 'gpt': setups a GPT partition table + // +optional + TableType *string `json:"tableType,omitempty"` +} + +// Filesystem defines the file systems to be created. +type Filesystem struct { + // Device specifies the device name + Device string `json:"device"` + // Filesystem specifies the file system type. + Filesystem string `json:"filesystem"` + // Label specifies the file system label to be used. If set to None, no label is used. + Label string `json:"label"` + // Partition specifies the partition to use. The valid options are: "auto|any", "auto", "any", "none", and , where NUM is the actual partition number. + // +optional + Partition *string `json:"partition,omitempty"` + // Overwrite defines whether or not to overwrite any existing filesystem. + // If true, any pre-existing file system will be destroyed. Use with Caution. + // +optional + Overwrite *bool `json:"overwrite,omitempty"` + // ReplaceFS is a special directive, used for Microsoft Azure that instructs cloud-init to replace a file system of . + // NOTE: unless you define a label, this requires the use of the 'any' partition directive. + // +optional + ReplaceFS *string `json:"replaceFS,omitempty"` + // ExtraOpts defined extra options to add to the command for creating the file system. + // +optional + ExtraOpts []string `json:"extraOpts,omitempty"` +} + +// MountPoints defines input for generated mounts in cloud-init. +type MountPoints []string diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types_test.go similarity index 98% rename from bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types_test.go index 156324019d77..4de2566ce544 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go similarity index 95% rename from bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go index 061a962b849d..0725b2a5e993 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfig_webhook.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfig_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -40,7 +40,7 @@ func (c *KubeadmConfig) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-bootstrap-cluster-x-k8s-io-v1alpha3-kubeadmconfig,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=bootstrap.cluster.x-k8s.io,resources=kubeadmconfigs,versions=v1alpha3,name=validation.kubeadmconfig.bootstrap.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-bootstrap-cluster-x-k8s-io-v1alpha4-kubeadmconfig,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=bootstrap.cluster.x-k8s.io,resources=kubeadmconfigs,versions=v1alpha4,name=validation.kubeadmconfig.bootstrap.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Validator = &KubeadmConfig{} diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfiglist_webhook.go similarity index 92% rename from bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmconfiglist_webhook.go index 5d7d3850705c..23fa080f52f2 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfiglist_webhook.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfiglist_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( ctrl "sigs.k8s.io/controller-runtime" diff --git a/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_types.go similarity index 86% rename from bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_types.go index 6d3f798f6707..e83f4c04c2df 100644 --- a/bootstrap/kubeadm/api/v1alpha2/kubeadmconfigtemplate_types.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_types.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,8 +25,14 @@ type KubeadmConfigTemplateSpec struct { Template KubeadmConfigTemplateResource `json:"template"` } +// KubeadmConfigTemplateResource defines the Template structure +type KubeadmConfigTemplateResource struct { + Spec KubeadmConfigSpec `json:"spec,omitempty"` +} + // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmconfigtemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion // KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API type KubeadmConfigTemplate struct { diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_webhook.go similarity index 92% rename from bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_webhook.go index 7e7ef6bd6f79..e28cfe7b5a4d 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplate_webhook.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplate_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( ctrl "sigs.k8s.io/controller-runtime" diff --git a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplatelist_webhook.go similarity index 92% rename from bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go rename to bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplatelist_webhook.go index f1e9b8084e37..107535a7232c 100644 --- a/bootstrap/kubeadm/api/v1alpha3/kubeadmconfigtemplatelist_webhook.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmconfigtemplatelist_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( ctrl "sigs.k8s.io/controller-runtime" diff --git a/bootstrap/kubeadm/api/v1alpha2/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go similarity index 68% rename from bootstrap/kubeadm/api/v1alpha2/zz_generated.deepcopy.go rename to bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go index d9012448f52a..623a45c762b5 100644 --- a/bootstrap/kubeadm/api/v1alpha2/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go @@ -18,16 +18,51 @@ limitations under the License. // Code generated by controller-gen. DO NOT EDIT. -package v1alpha2 +package v1alpha4 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskSetup) DeepCopyInto(out *DiskSetup) { + *out = *in + if in.Partitions != nil { + in, out := &in.Partitions, &out.Partitions + *out = make([]Partition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Filesystems != nil { + in, out := &in.Filesystems, &out.Filesystems + *out = make([]Filesystem, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskSetup. +func (in *DiskSetup) DeepCopy() *DiskSetup { + if in == nil { + return nil + } + out := new(DiskSetup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *File) DeepCopyInto(out *File) { *out = *in + if in.ContentFrom != nil { + in, out := &in.ContentFrom, &out.ContentFrom + *out = new(FileSource) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new File. @@ -40,6 +75,57 @@ func (in *File) DeepCopy() *File { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FileSource) DeepCopyInto(out *FileSource) { + *out = *in + out.Secret = in.Secret +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FileSource. +func (in *FileSource) DeepCopy() *FileSource { + if in == nil { + return nil + } + out := new(FileSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Filesystem) DeepCopyInto(out *Filesystem) { + *out = *in + if in.Partition != nil { + in, out := &in.Partition, &out.Partition + *out = new(string) + **out = **in + } + if in.Overwrite != nil { + in, out := &in.Overwrite, &out.Overwrite + *out = new(bool) + **out = **in + } + if in.ReplaceFS != nil { + in, out := &in.ReplaceFS, &out.ReplaceFS + *out = new(string) + **out = **in + } + if in.ExtraOpts != nil { + in, out := &in.ExtraOpts, &out.ExtraOpts + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Filesystem. +func (in *Filesystem) DeepCopy() *Filesystem { + if in == nil { + return nil + } + out := new(Filesystem) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KubeadmConfig) DeepCopyInto(out *KubeadmConfig) { *out = *in @@ -120,7 +206,25 @@ func (in *KubeadmConfigSpec) DeepCopyInto(out *KubeadmConfigSpec) { if in.Files != nil { in, out := &in.Files, &out.Files *out = make([]File, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DiskSetup != nil { + in, out := &in.DiskSetup, &out.DiskSetup + *out = new(DiskSetup) + (*in).DeepCopyInto(*out) + } + if in.Mounts != nil { + in, out := &in.Mounts, &out.Mounts + *out = make([]MountPoints, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = make(MountPoints, len(*in)) + copy(*out, *in) + } + } } if in.PreKubeadmCommands != nil { in, out := &in.PreKubeadmCommands, &out.PreKubeadmCommands @@ -144,6 +248,11 @@ func (in *KubeadmConfigSpec) DeepCopyInto(out *KubeadmConfigSpec) { *out = new(NTP) (*in).DeepCopyInto(*out) } + if in.Verbosity != nil { + in, out := &in.Verbosity, &out.Verbosity + *out = new(int32) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigSpec. @@ -159,11 +268,23 @@ func (in *KubeadmConfigSpec) DeepCopy() *KubeadmConfigSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KubeadmConfigStatus) DeepCopyInto(out *KubeadmConfigStatus) { *out = *in + if in.DataSecretName != nil { + in, out := &in.DataSecretName, &out.DataSecretName + *out = new(string) + **out = **in + } if in.BootstrapData != nil { in, out := &in.BootstrapData, &out.BootstrapData *out = make([]byte, len(*in)) copy(*out, *in) } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigStatus. @@ -266,6 +387,25 @@ func (in *KubeadmConfigTemplateSpec) DeepCopy() *KubeadmConfigTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in MountPoints) DeepCopyInto(out *MountPoints) { + { + in := &in + *out = make(MountPoints, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MountPoints. +func (in MountPoints) DeepCopy() MountPoints { + if in == nil { + return nil + } + out := new(MountPoints) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NTP) DeepCopyInto(out *NTP) { *out = *in @@ -291,6 +431,46 @@ func (in *NTP) DeepCopy() *NTP { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Partition) DeepCopyInto(out *Partition) { + *out = *in + if in.Overwrite != nil { + in, out := &in.Overwrite, &out.Overwrite + *out = new(bool) + **out = **in + } + if in.TableType != nil { + in, out := &in.TableType, &out.TableType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Partition. +func (in *Partition) DeepCopy() *Partition { + if in == nil { + return nil + } + out := new(Partition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretFileSource) DeepCopyInto(out *SecretFileSource) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretFileSource. +func (in *SecretFileSource) DeepCopy() *SecretFileSource { + if in == nil { + return nil + } + out := new(SecretFileSource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *User) DeepCopyInto(out *User) { *out = *in 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 f4c82ba24975..991c5bab6f7e 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 @@ -18,7 +18,7 @@ spec: singular: kubeadmconfig scope: Namespaced versions: - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: KubeadmConfig is the Schema for the kubeadmconfigs API @@ -261,6 +261,66 @@ spec: description: UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images type: boolean type: object + diskSetup: + description: DiskSetup specifies options for the creation of partition tables and file systems on devices. + properties: + filesystems: + description: Filesystems specifies the list of file systems to setup. + items: + description: Filesystem defines the file systems to be created. + properties: + device: + description: Device specifies the device name + type: string + extraOpts: + description: ExtraOpts defined extra options to add to the command for creating the file system. + items: + type: string + type: array + filesystem: + description: Filesystem specifies the file system type. + type: string + label: + description: Label specifies the file system label to be used. If set to None, no label is used. + type: string + overwrite: + description: Overwrite defines whether or not to overwrite any existing filesystem. If true, any pre-existing file system will be destroyed. Use with Caution. + type: boolean + partition: + description: 'Partition specifies the partition to use. The valid options are: "auto|any", "auto", "any", "none", and , where NUM is the actual partition number.' + type: string + replaceFS: + description: 'ReplaceFS is a special directive, used for Microsoft Azure that instructs cloud-init to replace a file system of . NOTE: unless you define a label, this requires the use of the ''any'' partition directive.' + type: string + required: + - device + - filesystem + - label + type: object + type: array + partitions: + description: Partitions specifies the list of the partitions to setup. + items: + description: Partition defines how to create and layout a partition. + properties: + device: + description: Device is the name of the device. + type: string + layout: + description: Layout specifies the device layout. If it is true, a single partition will be created for the entire device. When layout is false, it means don't partition or ignore existing partitioning. + type: boolean + overwrite: + description: Overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device. Use with caution. Default is 'false'. + type: boolean + tableType: + description: 'TableType specifies the tupe of partition table. The following are supported: ''mbr'': default and setups a MS-DOS partition table ''gpt'': setups a GPT partition table' + type: string + required: + - device + - layout + type: object + type: array + type: object files: description: Files specifies extra files to be passed to user_data upon creation. items: @@ -269,6 +329,25 @@ spec: content: description: Content is the actual content of the file. type: string + contentFrom: + description: ContentFrom is a referenced source of content to populate the file. + properties: + secret: + description: Secret represents a secret that should populate this file. + properties: + key: + description: Key is the key in the secret's data map for this value. + type: string + name: + description: Name of the secret in the KubeadmBootstrapConfig's namespace to use. + type: string + required: + - key + - name + type: object + required: + - secret + type: object encoding: description: Encoding specifies the encoding of the file contents. enum: @@ -286,7 +365,6 @@ spec: description: Permissions specifies the permissions to assign to the file, e.g. "0640". type: string required: - - content - path type: object type: array @@ -498,6 +576,14 @@ spec: type: array type: object type: object + mounts: + description: Mounts specifies a list of mount points to be setup. + items: + description: MountPoints defines input for generated mounts in cloud-init. + items: + type: string + type: array + type: array ntp: description: NTP specifies NTP configuration properties: @@ -520,6 +606,9 @@ spec: items: type: string type: array + useExperimentalRetryJoin: + description: "UseExperimentalRetryJoin replaces a basic kubeadm command with a shell script with retries for joins. \n This is meant to be an experimental temporary workaround on some environments where joins fail due to timing (and other issues). The long term goal is to add retries to kubeadm proper and use that functionality. \n This will add about 40KB to userdata \n For more information, refer to https://github.com/kubernetes-sigs/cluster-api/pull/2763#discussion_r397306055." + type: boolean users: description: Users specifies extra users to add items: @@ -564,20 +653,60 @@ spec: - name type: object type: array + verbosity: + description: Verbosity is the number for the kubeadm log level verbosity. It overrides the `--v` flag in kubeadm commands. + format: int32 + type: integer type: object status: description: KubeadmConfigStatus defines the observed state of KubeadmConfig properties: bootstrapData: - description: BootstrapData will be a cloud-init script for now + description: "BootstrapData will be a cloud-init script for now. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." format: byte type: string - errorMessage: - description: ErrorMessage will be set on non-retryable errors + conditions: + description: Conditions defines current service state of the KubeadmConfig. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + dataSecretName: + description: DataSecretName is the name of the secret that stores the bootstrap data script. + type: string + failureMessage: + description: FailureMessage will be set on non-retryable errors type: string - errorReason: - description: ErrorReason will be set on non-retryable errors + failureReason: + description: FailureReason will be set on non-retryable errors type: string + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer ready: description: Ready indicates the BootstrapData field is ready to be consumed type: boolean @@ -587,7 +716,7 @@ spec: storage: false subresources: status: {} - - name: v1alpha3 + - name: v1alpha4 schema: openAPIV3Schema: description: KubeadmConfig is the Schema for the kubeadmconfigs API 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 fd381a2bbc39..70b66cff26e3 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 @@ -18,7 +18,7 @@ spec: singular: kubeadmconfigtemplate scope: Namespaced versions: - - name: v1alpha2 + - name: v1alpha3 schema: openAPIV3Schema: description: KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API @@ -267,6 +267,66 @@ spec: description: UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images type: boolean type: object + diskSetup: + description: DiskSetup specifies options for the creation of partition tables and file systems on devices. + properties: + filesystems: + description: Filesystems specifies the list of file systems to setup. + items: + description: Filesystem defines the file systems to be created. + properties: + device: + description: Device specifies the device name + type: string + extraOpts: + description: ExtraOpts defined extra options to add to the command for creating the file system. + items: + type: string + type: array + filesystem: + description: Filesystem specifies the file system type. + type: string + label: + description: Label specifies the file system label to be used. If set to None, no label is used. + type: string + overwrite: + description: Overwrite defines whether or not to overwrite any existing filesystem. If true, any pre-existing file system will be destroyed. Use with Caution. + type: boolean + partition: + description: 'Partition specifies the partition to use. The valid options are: "auto|any", "auto", "any", "none", and , where NUM is the actual partition number.' + type: string + replaceFS: + description: 'ReplaceFS is a special directive, used for Microsoft Azure that instructs cloud-init to replace a file system of . NOTE: unless you define a label, this requires the use of the ''any'' partition directive.' + type: string + required: + - device + - filesystem + - label + type: object + type: array + partitions: + description: Partitions specifies the list of the partitions to setup. + items: + description: Partition defines how to create and layout a partition. + properties: + device: + description: Device is the name of the device. + type: string + layout: + description: Layout specifies the device layout. If it is true, a single partition will be created for the entire device. When layout is false, it means don't partition or ignore existing partitioning. + type: boolean + overwrite: + description: Overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device. Use with caution. Default is 'false'. + type: boolean + tableType: + description: 'TableType specifies the tupe of partition table. The following are supported: ''mbr'': default and setups a MS-DOS partition table ''gpt'': setups a GPT partition table' + type: string + required: + - device + - layout + type: object + type: array + type: object files: description: Files specifies extra files to be passed to user_data upon creation. items: @@ -275,6 +335,25 @@ spec: content: description: Content is the actual content of the file. type: string + contentFrom: + description: ContentFrom is a referenced source of content to populate the file. + properties: + secret: + description: Secret represents a secret that should populate this file. + properties: + key: + description: Key is the key in the secret's data map for this value. + type: string + name: + description: Name of the secret in the KubeadmBootstrapConfig's namespace to use. + type: string + required: + - key + - name + type: object + required: + - secret + type: object encoding: description: Encoding specifies the encoding of the file contents. enum: @@ -292,7 +371,6 @@ spec: description: Permissions specifies the permissions to assign to the file, e.g. "0640". type: string required: - - content - path type: object type: array @@ -504,6 +582,14 @@ spec: type: array type: object type: object + mounts: + description: Mounts specifies a list of mount points to be setup. + items: + description: MountPoints defines input for generated mounts in cloud-init. + items: + type: string + type: array + type: array ntp: description: NTP specifies NTP configuration properties: @@ -526,6 +612,9 @@ spec: items: type: string type: array + useExperimentalRetryJoin: + description: "UseExperimentalRetryJoin replaces a basic kubeadm command with a shell script with retries for joins. \n This is meant to be an experimental temporary workaround on some environments where joins fail due to timing (and other issues). The long term goal is to add retries to kubeadm proper and use that functionality. \n This will add about 40KB to userdata \n For more information, refer to https://github.com/kubernetes-sigs/cluster-api/pull/2763#discussion_r397306055." + type: boolean users: description: Users specifies extra users to add items: @@ -570,6 +659,10 @@ spec: - name type: object type: array + verbosity: + description: Verbosity is the number for the kubeadm log level verbosity. It overrides the `--v` flag in kubeadm commands. + format: int32 + type: integer type: object type: object required: @@ -578,7 +671,7 @@ spec: type: object served: true storage: false - - name: v1alpha3 + - name: v1alpha4 schema: openAPIV3Schema: description: KubeadmConfigTemplate is the Schema for the kubeadmconfigtemplates API diff --git a/bootstrap/kubeadm/config/crd/kustomization.yaml b/bootstrap/kubeadm/config/crd/kustomization.yaml index 5c7432e6364f..351dce0e6770 100644 --- a/bootstrap/kubeadm/config/crd/kustomization.yaml +++ b/bootstrap/kubeadm/config/crd/kustomization.yaml @@ -1,6 +1,6 @@ commonLabels: - cluster.x-k8s.io/v1alpha2: v1alpha2 cluster.x-k8s.io/v1alpha3: v1alpha3 + cluster.x-k8s.io/v1alpha4: v1alpha4 # This kustomization.yaml is not intended to be run by itself, # since it depends on service name and namespace that are out of this kustomize package. diff --git a/bootstrap/kubeadm/config/webhook/manifests.yaml b/bootstrap/kubeadm/config/webhook/manifests.yaml index c3ac3083a3f7..e4c06eb1493f 100644 --- a/bootstrap/kubeadm/config/webhook/manifests.yaml +++ b/bootstrap/kubeadm/config/webhook/manifests.yaml @@ -13,7 +13,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-bootstrap-cluster-x-k8s-io-v1alpha3-kubeadmconfig + path: /validate-bootstrap-cluster-x-k8s-io-v1alpha4-kubeadmconfig failurePolicy: Fail matchPolicy: Equivalent name: validation.kubeadmconfig.bootstrap.cluster.x-k8s.io @@ -21,7 +21,7 @@ webhooks: - apiGroups: - bootstrap.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go index 9b3cc87cfe70..9bdbee1a9aeb 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go @@ -31,14 +31,14 @@ import ( "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/cloudinit" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/locking" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" bsutil "sigs.k8s.io/cluster-api/bootstrap/util" "sigs.k8s.io/cluster-api/controllers/remote" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go index 011ec0997f2b..98f3303e3d34 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_reconciler_test.go @@ -23,7 +23,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" ) var _ = Describe("KubeadmConfigReconciler", func() { diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go index 214912f7e9c1..793150f30a48 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go @@ -31,11 +31,11 @@ import ( "k8s.io/apimachinery/pkg/types" bootstrapapi "k8s.io/cluster-bootstrap/token/api" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" fakeremote "sigs.k8s.io/cluster-api/controllers/remote/fake" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/test/helpers" "sigs.k8s.io/cluster-api/util" diff --git a/bootstrap/kubeadm/internal/cloudinit/cloudinit.go b/bootstrap/kubeadm/internal/cloudinit/cloudinit.go index 1d31b2f056fb..dae81bee6eb3 100644 --- a/bootstrap/kubeadm/internal/cloudinit/cloudinit.go +++ b/bootstrap/kubeadm/internal/cloudinit/cloudinit.go @@ -22,7 +22,7 @@ import ( "text/template" "github.com/pkg/errors" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" ) const ( diff --git a/bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go b/bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go index 931dd6466a94..2c52415b81cb 100644 --- a/bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go +++ b/bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go @@ -22,8 +22,8 @@ import ( . "github.com/onsi/gomega" "k8s.io/utils/pointer" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/cluster-api/util/secret" ) diff --git a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go index 54c9f60bda66..8b91eeb12c89 100644 --- a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go +++ b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex.go @@ -26,7 +26,7 @@ import ( apicorev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go index 13c0f3f10a76..5fdc0dd13cb9 100644 --- a/bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go +++ b/bootstrap/kubeadm/internal/locking/control_plane_init_mutex_test.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" diff --git a/bootstrap/kubeadm/main.go b/bootstrap/kubeadm/main.go index 4843b4b8707a..8248c93ce055 100644 --- a/bootstrap/kubeadm/main.go +++ b/bootstrap/kubeadm/main.go @@ -30,12 +30,11 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/klog" "k8s.io/klog/klogr" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - kubeadmbootstrapv1alpha2 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha2" - kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + kubeadmbootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmbootstrapcontrollers "sigs.k8s.io/cluster-api/bootstrap/kubeadm/controllers" "sigs.k8s.io/cluster-api/cmd/version" - expv1alpha3 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" @@ -52,10 +51,9 @@ func init() { klog.InitFlags(nil) _ = clientgoscheme.AddToScheme(scheme) - _ = clusterv1alpha3.AddToScheme(scheme) - _ = expv1alpha3.AddToScheme(scheme) - _ = kubeadmbootstrapv1alpha2.AddToScheme(scheme) - _ = kubeadmbootstrapv1alpha3.AddToScheme(scheme) + _ = clusterv1.AddToScheme(scheme) + _ = expv1.AddToScheme(scheme) + _ = kubeadmbootstrapv1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -175,19 +173,19 @@ func setupWebhooks(mgr ctrl.Manager) { return } - if err := (&kubeadmbootstrapv1alpha3.KubeadmConfig{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&kubeadmbootstrapv1.KubeadmConfig{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfig") os.Exit(1) } - if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigList{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&kubeadmbootstrapv1.KubeadmConfigList{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigList") os.Exit(1) } - if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplate{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&kubeadmbootstrapv1.KubeadmConfigTemplate{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplate") os.Exit(1) } - if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&kubeadmbootstrapv1.KubeadmConfigTemplateList{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplateList") os.Exit(1) } diff --git a/bootstrap/util/configowner.go b/bootstrap/util/configowner.go index 5b696c5066fa..22764a958a6c 100644 --- a/bootstrap/util/configowner.go +++ b/bootstrap/util/configowner.go @@ -24,9 +24,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/bootstrap/util/configowner_test.go b/bootstrap/util/configowner_test.go index 5132dcea4cca..b7ddaf9f7110 100644 --- a/bootstrap/util/configowner_test.go +++ b/bootstrap/util/configowner_test.go @@ -24,9 +24,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client/fake" diff --git a/cmd/example-provider/main.go b/cmd/example-provider/main.go index 019aa2c89b09..ae886d8ceed8 100644 --- a/cmd/example-provider/main.go +++ b/cmd/example-provider/main.go @@ -24,7 +24,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/klog" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/controller" diff --git a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesetbindings.yaml b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesetbindings.yaml index 9d71d3ee38c4..19004e94d93c 100644 --- a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesetbindings.yaml +++ b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesetbindings.yaml @@ -19,6 +19,71 @@ spec: scope: Namespaced versions: - name: v1alpha3 + schema: + openAPIV3Schema: + description: ClusterResourceSetBinding lists all matching ClusterResourceSets with the cluster it belongs to. + 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' + 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' + type: string + metadata: + type: object + spec: + description: ClusterResourceSetBindingSpec defines the desired state of ClusterResourceSetBinding + properties: + bindings: + description: Bindings is a list of ClusterResourceSets and their resources. + items: + description: ResourceSetBinding keeps info on all of the resources in a ClusterResourceSet. + properties: + clusterResourceSetName: + description: ClusterResourceSetName is the name of the ClusterResourceSet that is applied to the owner cluster of the binding. + type: string + resources: + description: Resources is a list of resources that the ClusterResourceSet has. + items: + description: ResourceBinding shows the status of a resource that belongs to a ClusterResourceSet matched by the owner cluster of the ClusterResourceSetBinding object. + properties: + applied: + description: Applied is to track if a resource is applied to the cluster or not. + type: boolean + hash: + description: Hash is the hash of a resource's data. This can be used to decide if a resource is changed. For "ApplyOnce" ClusterResourceSet.spec.strategy, this is no-op as that strategy does not act on change. + type: string + kind: + description: 'Kind of the resource. Supported kinds are: Secrets and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + lastAppliedTime: + description: LastAppliedTime identifies when this resource was last applied to the cluster. + format: date-time + type: string + name: + description: Name of the resource that is in the same namespace with ClusterResourceSet object. + minLength: 1 + type: string + required: + - applied + - kind + - name + type: object + type: array + required: + - clusterResourceSetName + type: object + type: array + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha4 schema: openAPIV3Schema: description: ClusterResourceSetBinding lists all matching ClusterResourceSets with the cluster it belongs to. diff --git a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml index f4db0c27e69e..276813606e0b 100644 --- a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml +++ b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml @@ -131,6 +131,122 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1alpha4 + schema: + openAPIV3Schema: + description: ClusterResourceSet is the Schema for the clusterresourcesets API + 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' + 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' + type: string + metadata: + type: object + spec: + description: ClusterResourceSetSpec defines the desired state of ClusterResourceSet + properties: + clusterSelector: + description: Label selector for Clusters. The Clusters that are selected by this will be the ones affected by this ClusterResourceSet. It must match the Cluster labels. This field is immutable. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + resources: + description: Resources is a list of Secrets/ConfigMaps where each contains 1 or more resources to be applied to remote clusters. + items: + description: ResourceRef specifies a resource. + properties: + kind: + description: 'Kind of the resource. Supported kinds are: Secrets and ConfigMaps.' + enum: + - Secret + - ConfigMap + type: string + name: + description: Name of the resource that is in the same namespace with ClusterResourceSet object. + minLength: 1 + type: string + required: + - kind + - name + type: object + type: array + strategy: + description: Strategy is the strategy to be used during applying resources. Defaults to ApplyOnce. This field is immutable. + enum: + - ApplyOnce + type: string + required: + - clusterSelector + type: object + status: + description: ClusterResourceSetStatus defines the observed state of ClusterResourceSet + properties: + conditions: + description: Conditions defines current state of the ClusterResourceSet. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: ObservedGeneration reflects the generation of the most recently observed ClusterResourceSet. + format: int64 + type: integer + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index 79f6238949eb..12aae4ef9357 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -25,7 +25,7 @@ spec: jsonPath: .status.phase name: Phase type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: Cluster is the Schema for the clusters API @@ -42,7 +42,7 @@ spec: description: ClusterSpec defines the desired state of Cluster properties: clusterNetwork: - description: Cluster network configuration + description: Cluster network configuration. properties: apiServerPort: description: APIServerPort specifies the port the API Server should bind to. Defaults to 6443. @@ -72,6 +72,45 @@ spec: - cidrBlocks type: object type: object + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + controlPlaneRef: + description: ControlPlaneRef is an optional reference to a provider-specific resource that holds the details for provisioning the Control Plane for a Cluster. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object infrastructureRef: description: InfrastructureRef is a reference to a provider-specific resource that holds the details for provisioning infrastructure for a cluster in said provider. properties: @@ -97,38 +136,76 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + paused: + description: Paused can be used to prevent controllers from processing the Cluster and all its associated objects. + type: boolean type: object status: description: ClusterStatus defines the observed state of Cluster properties: - apiEndpoints: - description: APIEndpoints represents the endpoints to communicate with the control plane. + conditions: + description: Conditions defines current service state of the cluster. items: - description: APIEndpoint represents a reachable Kubernetes API endpoint. + description: Condition defines an observation of a Cluster API resource operational state. properties: - host: - description: The hostname on which the API server is serving. + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. type: string - port: - description: The port on which the API server is serving. - type: integer required: - - host - - port + - status + - type type: object type: array controlPlaneInitialized: description: ControlPlaneInitialized defines if the control plane has been initialized. type: boolean - errorMessage: - description: ErrorMessage indicates that there is a problem reconciling the state, and will be set to a descriptive error message. + controlPlaneReady: + description: ControlPlaneReady defines if the control plane is ready. + type: boolean + failureDomains: + additionalProperties: + description: FailureDomainSpec is the Schema for Cluster API failure domains. It allows controllers to understand how many failure domains a cluster can optionally span across. + properties: + attributes: + additionalProperties: + type: string + description: Attributes is a free form map of attributes an infrastructure provider might use or require. + type: object + controlPlane: + description: ControlPlane determines if this failure domain is suitable for use by control plane machines. + type: boolean + type: object + description: FailureDomains is a slice of failure domain objects synced from the infrastructure provider. + type: object + failureMessage: + description: FailureMessage indicates that there is a fatal problem reconciling the state, and will be set to a descriptive error message. type: string - errorReason: - description: ErrorReason indicates that there is a problem reconciling the state, and will be set to a token value suitable for programmatic interpretation. + failureReason: + description: FailureReason indicates that there is a fatal problem reconciling the state, and will be set to a token value suitable for programmatic interpretation. type: string infrastructureReady: description: InfrastructureReady is the state of the infrastructure provider. type: boolean + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer phase: description: Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. type: string @@ -143,7 +220,7 @@ spec: jsonPath: .status.phase name: Phase type: string - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: description: Cluster is the Schema for the clusters API diff --git a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml index 99b6df7c16ca..c28488a54d7e 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml @@ -20,7 +20,28 @@ spec: singular: machinedeployment scope: Namespaced versions: - - name: v1alpha2 + - additionalPrinterColumns: + - description: MachineDeployment status such as ScalingUp/ScalingDown/Running/Failed/Unknown + jsonPath: .status.phase + name: Phase + type: string + - description: Total number of non-terminated machines targeted by this MachineDeployment + jsonPath: .status.replicas + name: Replicas + type: integer + - description: Total number of ready machines targeted by this MachineDeployment + jsonPath: .status.readyReplicas + name: Ready + type: integer + - description: Total number of non-terminated machines targeted by this deployment that have the desired template spec + jsonPath: .status.updatedReplicas + name: Updated + type: integer + - description: Total number of unavailable machines targeted by this MachineDeployment + jsonPath: .status.unavailableReplicas + name: Unavailable + type: integer + name: v1alpha3 schema: openAPIV3Schema: description: MachineDeployment is the Schema for the machinedeployments API @@ -36,6 +57,10 @@ spec: spec: description: MachineDeploymentSpec defines the desired state of MachineDeployment properties: + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string minReadySeconds: description: Minimum number of seconds for which a newly created machine should be ready. Defaults to 0 (machine will be considered available as soon as it is ready) format: int32 @@ -196,9 +221,19 @@ spec: type: string type: object data: - description: Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + type: string + dataSecretName: + description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string type: object + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + failureDomain: + description: FailureDomain is the failure domain the machine will be created in. Must match a key in the FailureDomains map stored on the cluster object. + type: string infrastructureRef: description: InfrastructureRef is a required reference to a custom resource offered by an infrastructure provider. properties: @@ -224,59 +259,9 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - metadata: - description: 'DEPRECATED: ObjectMeta has no function and isn''t used anywhere.' - properties: - annotations: - additionalProperties: - type: string - description: 'Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations' - type: object - generateName: - description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. \n If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header). \n Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency" - type: string - labels: - additionalProperties: - type: string - description: 'Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels' - type: object - name: - description: 'Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - namespace: - description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. \n Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces" - type: string - ownerReferences: - description: List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. - items: - description: OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. - properties: - apiVersion: - description: API version of the referent. - type: string - blockOwnerDeletion: - description: If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. - type: boolean - controller: - description: If true, this reference points to the managing controller. - type: boolean - kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - name: - description: 'Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - uid: - description: 'UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids' - type: string - required: - - apiVersion - - kind - - name - - uid - type: object - type: array - type: object + nodeDrainTimeout: + description: 'NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' + type: string providerID: description: ProviderID is the identification ID of the machine provided by the provider. This field must match the provider ID as seen on the node object corresponding to this machine. This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a generic out-of-tree provider for autoscaler, this field is required by autoscaler to be able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver and then a comparison is done to find out unregistered machines and are marked for delete. This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string @@ -285,10 +270,12 @@ spec: type: string required: - bootstrap + - clusterName - infrastructureRef type: object type: object required: + - clusterName - selector - template type: object @@ -303,6 +290,9 @@ spec: description: The generation observed by the deployment controller. format: int64 type: integer + phase: + description: Phase represents the current phase of a MachineDeployment (ScalingUp, ScalingDown, Running, Failed, or Unknown). + type: string readyReplicas: description: Total number of ready machines targeted by this deployment. format: int32 @@ -353,7 +343,7 @@ spec: jsonPath: .status.unavailableReplicas name: Unavailable type: integer - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: description: MachineDeployment is the Schema for the machinedeployments API @@ -533,7 +523,7 @@ spec: type: string type: object data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. diff --git a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml index 616e6db31a56..01bdc5c59d07 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml @@ -143,6 +143,131 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: Maximum number of unhealthy machines allowed + jsonPath: .spec.maxUnhealthy + name: MaxUnhealthy + type: string + - description: Number of machines currently monitored + jsonPath: .status.expectedMachines + name: ExpectedMachines + type: integer + - description: Current observed healthy machines + jsonPath: .status.currentHealthy + name: CurrentHealthy + type: integer + name: v1alpha4 + schema: + openAPIV3Schema: + description: MachineHealthCheck is the Schema for the machinehealthchecks API + 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' + 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' + type: string + metadata: + type: object + spec: + description: Specification of machine health check policy + properties: + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + maxUnhealthy: + anyOf: + - type: integer + - type: string + description: Any further remediation is only allowed if at most "MaxUnhealthy" machines selected by "selector" are not healthy. + x-kubernetes-int-or-string: true + nodeStartupTimeout: + description: Machines older than this duration without a node will be considered to have failed and will be remediated. + type: string + selector: + description: Label selector to match machines whose health will be exercised + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. + properties: + key: + description: key is the label key that the selector applies to. + type: string + operator: + description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + unhealthyConditions: + description: UnhealthyConditions contains a list of the conditions that determine whether a node is considered unhealthy. The conditions are combined in a logical OR, i.e. if any of the conditions is met, the node is unhealthy. + items: + description: UnhealthyCondition represents a Node condition type and value with a timeout specified as a duration. When the named condition has been in the given status for at least the timeout value, a node is considered unhealthy. + properties: + status: + minLength: 1 + type: string + timeout: + type: string + type: + minLength: 1 + type: string + required: + - status + - timeout + - type + type: object + minItems: 1 + type: array + required: + - clusterName + - selector + - unhealthyConditions + type: object + status: + description: Most recently observed status of MachineHealthCheck resource + properties: + currentHealthy: + description: total number of healthy machines counted by this machine health check + format: int32 + minimum: 0 + type: integer + expectedMachines: + description: total number of machines counted by this machine health check + format: int32 + minimum: 0 + type: integer + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer + targets: + description: Targets shows the current list of machines the machine health check is watching + items: + type: string + type: array + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/crd/bases/cluster.x-k8s.io_machines.yaml b/config/crd/bases/cluster.x-k8s.io_machines.yaml index c392a945b0ba..5b425d15db8a 100644 --- a/config/crd/bases/cluster.x-k8s.io_machines.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machines.yaml @@ -29,12 +29,16 @@ spec: jsonPath: .status.phase name: Phase type: string + - description: Kubernetes version associated with this Machine + jsonPath: .spec.version + name: Version + type: string - description: Node name associated with this machine jsonPath: .status.nodeRef.name name: NodeName priority: 1 type: string - name: v1alpha2 + name: v1alpha3 schema: openAPIV3Schema: description: Machine is the Schema for the machines API @@ -79,9 +83,19 @@ spec: type: string type: object data: - description: Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + type: string + dataSecretName: + description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string type: object + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + failureDomain: + description: FailureDomain is the failure domain the machine will be created in. Must match a key in the FailureDomains map stored on the cluster object. + type: string infrastructureRef: description: InfrastructureRef is a required reference to a custom resource offered by an infrastructure provider. properties: @@ -107,59 +121,9 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - metadata: - description: 'DEPRECATED: ObjectMeta has no function and isn''t used anywhere.' - properties: - annotations: - additionalProperties: - type: string - description: 'Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations' - type: object - generateName: - description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. \n If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header). \n Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency" - type: string - labels: - additionalProperties: - type: string - description: 'Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels' - type: object - name: - description: 'Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - namespace: - description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. \n Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces" - type: string - ownerReferences: - description: List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. - items: - description: OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. - properties: - apiVersion: - description: API version of the referent. - type: string - blockOwnerDeletion: - description: If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. - type: boolean - controller: - description: If true, this reference points to the managing controller. - type: boolean - kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - name: - description: 'Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - uid: - description: 'UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids' - type: string - required: - - apiVersion - - kind - - name - - uid - type: object - type: array - type: object + nodeDrainTimeout: + description: 'NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' + type: string providerID: description: ProviderID is the identification ID of the machine provided by the provider. This field must match the provider ID as seen on the node object corresponding to this machine. This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a generic out-of-tree provider for autoscaler, this field is required by autoscaler to be able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver and then a comparison is done to find out unregistered machines and are marked for delete. This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string @@ -168,6 +132,7 @@ spec: type: string required: - bootstrap + - clusterName - infrastructureRef type: object status: @@ -192,17 +157,46 @@ spec: bootstrapReady: description: BootstrapReady is the state of the bootstrap provider. type: boolean - errorMessage: - description: "ErrorMessage will be set in the event that there is a terminal problem reconciling the Machine and will contain a more verbose string suitable for logging and human consumption. \n This field should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the Machine's spec or the configuration of the controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the controller, or the responsible controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the Machine object and/or logged in the controller's output." + conditions: + description: Conditions defines current service state of the Machine. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + failureMessage: + description: "FailureMessage will be set in the event that there is a terminal problem reconciling the Machine and will contain a more verbose string suitable for logging and human consumption. \n This field should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the Machine's spec or the configuration of the controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the controller, or the responsible controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the Machine object and/or logged in the controller's output." type: string - errorReason: - description: "ErrorReason will be set in the event that there is a terminal problem reconciling the Machine and will contain a succinct value suitable for machine interpretation. \n This field should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the Machine's spec or the configuration of the controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the controller, or the responsible controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the Machine object and/or logged in the controller's output." + failureReason: + description: "FailureReason will be set in the event that there is a terminal problem reconciling the Machine and will contain a succinct value suitable for machine interpretation. \n This field should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the Machine's spec or the configuration of the controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the controller, or the responsible controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the Machine object and/or logged in the controller's output." type: string infrastructureReady: description: InfrastructureReady is the state of the infrastructure provider. type: boolean lastUpdated: - description: LastUpdated identifies when this status was last observed. + description: LastUpdated identifies when the phase of the Machine last transitioned. format: date-time type: string nodeRef: @@ -230,6 +224,10 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer phase: description: Phase represents the current phase of machine actuation. E.g. Pending, Running, Terminating, Failed etc. type: string @@ -260,7 +258,7 @@ spec: name: NodeName priority: 1 type: string - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: description: Machine is the Schema for the machines API @@ -305,7 +303,7 @@ spec: type: string type: object data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. diff --git a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml index c013e4e4d72c..57d0c176515e 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml @@ -20,7 +20,20 @@ spec: singular: machineset scope: Namespaced versions: - - name: v1alpha2 + - additionalPrinterColumns: + - description: Total number of non-terminated machines targeted by this machineset + jsonPath: .status.replicas + name: Replicas + type: integer + - description: Total number of available machines (ready for at least minReadySeconds) + jsonPath: .status.availableReplicas + name: Available + type: integer + - description: Total number of ready machines targeted by this machineset. + jsonPath: .status.readyReplicas + name: Ready + type: integer + name: v1alpha3 schema: openAPIV3Schema: description: MachineSet is the Schema for the machinesets API @@ -36,6 +49,10 @@ spec: spec: description: MachineSetSpec defines the desired state of MachineSet properties: + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string deletePolicy: description: DeletePolicy defines the policy used to identify nodes to delete when downscaling. Defaults to "Random". Valid values are "Random, "Newest", "Oldest" enum: @@ -169,9 +186,19 @@ spec: type: string type: object data: - description: Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + type: string + dataSecretName: + description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string type: object + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + failureDomain: + description: FailureDomain is the failure domain the machine will be created in. Must match a key in the FailureDomains map stored on the cluster object. + type: string infrastructureRef: description: InfrastructureRef is a required reference to a custom resource offered by an infrastructure provider. properties: @@ -197,59 +224,9 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - metadata: - description: 'DEPRECATED: ObjectMeta has no function and isn''t used anywhere.' - properties: - annotations: - additionalProperties: - type: string - description: 'Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations' - type: object - generateName: - description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. \n If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header). \n Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency" - type: string - labels: - additionalProperties: - type: string - description: 'Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels' - type: object - name: - description: 'Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - namespace: - description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. \n Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces" - type: string - ownerReferences: - description: List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. - items: - description: OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. - properties: - apiVersion: - description: API version of the referent. - type: string - blockOwnerDeletion: - description: If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. - type: boolean - controller: - description: If true, this reference points to the managing controller. - type: boolean - kind: - description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - name: - description: 'Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names' - type: string - uid: - description: 'UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids' - type: string - required: - - apiVersion - - kind - - name - - uid - type: object - type: array - type: object + nodeDrainTimeout: + description: 'NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' + type: string providerID: description: ProviderID is the identification ID of the machine provided by the provider. This field must match the provider ID as seen on the node object corresponding to this machine. This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a generic out-of-tree provider for autoscaler, this field is required by autoscaler to be able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver and then a comparison is done to find out unregistered machines and are marked for delete. This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string @@ -258,10 +235,12 @@ spec: type: string required: - bootstrap + - clusterName - infrastructureRef type: object type: object required: + - clusterName - selector type: object status: @@ -271,10 +250,10 @@ spec: description: The number of available replicas (ready for at least minReadySeconds) for this MachineSet. format: int32 type: integer - errorMessage: + failureMessage: type: string - errorReason: - description: "In the event that there is a terminal problem reconciling the replicas, both ErrorReason and ErrorMessage will be set. ErrorReason will be populated with a succinct value suitable for machine interpretation, while ErrorMessage will contain a more verbose string suitable for logging and human consumption. \n These fields should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the MachineTemplate's spec or the configuration of the machine controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the machine controller, or the responsible machine controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the MachineSet object and/or logged in the controller's output." + failureReason: + description: "In the event that there is a terminal problem reconciling the replicas, both FailureReason and FailureMessage will be set. FailureReason will be populated with a succinct value suitable for machine interpretation, while FailureMessage will contain a more verbose string suitable for logging and human consumption. \n These fields should not be set for transitive errors that a controller faces that are expected to be fixed automatically over time (like service outages), but instead indicate that something is fundamentally wrong with the MachineTemplate's spec or the configuration of the machine controller, and that manual intervention is required. Examples of terminal errors would be invalid combinations of settings in the spec, values that are unsupported by the machine controller, or the responsible machine controller itself being critically misconfigured. \n Any transient errors that occur during the reconciliation of Machines can be added as events to the MachineSet object and/or logged in the controller's output." type: string fullyLabeledReplicas: description: The number of replicas that have labels matching the labels of the machine template of the MachineSet. @@ -295,8 +274,6 @@ spec: selector: description: 'Selector is the same as the label selector but in the string format to avoid introspection by clients. The string will be in the same format as the query-param syntax. More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors' type: string - required: - - replicas type: object type: object served: true @@ -320,7 +297,7 @@ spec: jsonPath: .status.readyReplicas name: Ready type: integer - name: v1alpha3 + name: v1alpha4 schema: openAPIV3Schema: description: MachineSet is the Schema for the machinesets API @@ -473,7 +450,7 @@ spec: type: string type: object data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. diff --git a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml index c59bed225725..8e6ec82ec6a2 100644 --- a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml +++ b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml @@ -337,6 +337,329 @@ spec: type: object type: object served: true + storage: false + subresources: + scale: + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + - additionalPrinterColumns: + - description: MachinePool replicas count + jsonPath: .status.replicas + name: Replicas + type: string + - description: MachinePool status such as Terminating/Pending/Provisioning/Running/Failed etc + jsonPath: .status.phase + name: Phase + type: string + - description: Kubernetes version associated with this MachinePool + jsonPath: .spec.template.spec.version + name: Version + type: string + name: v1alpha4 + schema: + openAPIV3Schema: + description: MachinePool is the Schema for the machinepools API + 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' + 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' + type: string + metadata: + type: object + spec: + description: MachinePoolSpec defines the desired state of MachinePool + properties: + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + failureDomains: + description: FailureDomains is the list of failure domains this MachinePool should be attached to. + items: + type: string + type: array + minReadySeconds: + description: Minimum number of seconds for which a newly created machine instances should be ready. Defaults to 0 (machine instance will be considered available as soon as it is ready) + format: int32 + type: integer + providerIDList: + description: ProviderIDList are the identification IDs of machine instances provided by the provider. This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. + items: + type: string + type: array + replicas: + description: Number of desired machines. Defaults to 1. This is a pointer to distinguish between explicit zero and not specified. + format: int32 + type: integer + strategy: + description: The deployment strategy to use to replace existing machine instances with new ones. + properties: + rollingUpdate: + description: Rolling update config params. Present only if MachineDeploymentStrategyType = RollingUpdate. + properties: + maxSurge: + anyOf: + - type: integer + - type: string + description: 'The maximum number of machines that can be scheduled above the desired number of machines. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 1. Example: when this is set to 30%, the new MachineSet can be scaled up immediately when the rolling update starts, such that the total number of old and new machines do not exceed 130% of desired machines. Once old machines have been killed, new MachineSet can be scaled up further, ensuring that total number of machines running at any time during the update is at most 130% of desired machines.' + x-kubernetes-int-or-string: true + maxUnavailable: + anyOf: + - type: integer + - type: string + description: 'The maximum number of machines that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 0. Example: when this is set to 30%, the old MachineSet can be scaled down to 70% of desired machines immediately when the rolling update starts. Once new machines are ready, old MachineSet can be scaled down further, followed by scaling up the new MachineSet, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines.' + x-kubernetes-int-or-string: true + type: object + type: + description: Type of deployment. Currently the only supported strategy is "RollingUpdate". Default is RollingUpdate. + type: string + type: object + template: + description: Template describes the machines that will be created. + properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations' + type: object + generateName: + description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. \n If this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header). \n Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency" + type: string + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels' + type: object + name: + description: 'Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + namespace: + description: "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. \n Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces" + type: string + ownerReferences: + description: List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + items: + description: OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. + properties: + apiVersion: + description: API version of the referent. + type: string + blockOwnerDeletion: + description: If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + type: boolean + controller: + description: If true, this reference points to the managing controller. + type: boolean + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names' + type: string + uid: + description: 'UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids' + type: string + required: + - apiVersion + - kind + - name + - uid + type: object + type: array + type: object + spec: + description: 'Specification of the desired behavior of the machine. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status' + properties: + bootstrap: + description: Bootstrap is a reference to a local struct which encapsulates fields to configure the Machine’s bootstrapping mechanism. + properties: + configRef: + description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.Data without the need of a controller. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + data: + description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." + type: string + dataSecretName: + description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. + type: string + type: object + clusterName: + description: ClusterName is the name of the Cluster this object belongs to. + minLength: 1 + type: string + failureDomain: + description: FailureDomain is the failure domain the machine will be created in. Must match a key in the FailureDomains map stored on the cluster object. + type: string + infrastructureRef: + description: InfrastructureRef is a required reference to a custom resource offered by an infrastructure provider. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + nodeDrainTimeout: + description: 'NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' + type: string + providerID: + description: ProviderID is the identification ID of the machine provided by the provider. This field must match the provider ID as seen on the node object corresponding to this machine. This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler with cluster-api as provider. Clean-up logic in the autoscaler compares machines to nodes to find out machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a generic out-of-tree provider for autoscaler, this field is required by autoscaler to be able to have a provider view of the list of machines. Another list of nodes is queried from the k8s apiserver and then a comparison is done to find out unregistered machines and are marked for delete. This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. + type: string + version: + description: Version defines the desired Kubernetes version. This field is meant to be optionally used by bootstrap providers. + type: string + required: + - bootstrap + - clusterName + - infrastructureRef + type: object + type: object + required: + - clusterName + - template + type: object + status: + description: MachinePoolStatus defines the observed state of MachinePool + properties: + availableReplicas: + description: The number of available replicas (ready for at least minReadySeconds) for this MachinePool. + format: int32 + type: integer + bootstrapReady: + description: BootstrapReady is the state of the bootstrap provider. + type: boolean + conditions: + description: Conditions define the current service state of the MachinePool. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + failureMessage: + description: FailureMessage indicates that there is a problem reconciling the state, and will be set to a descriptive error message. + type: string + failureReason: + description: FailureReason indicates that there is a problem reconciling the state, and will be set to a token value suitable for programmatic interpretation. + type: string + infrastructureReady: + description: InfrastructureReady is the state of the infrastructure provider. + type: boolean + nodeRefs: + description: NodeRefs will point to the corresponding Nodes if it they exist. + items: + description: 'ObjectReference contains enough information to let you inspect or modify the referred object. --- New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. 1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage. 2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". Those cannot be well described when embedded. 3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. 4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple and the version of the actual struct is irrelevant. 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type will affect numerous schemas. Don''t make new APIs embed an underspecified API type they do not control. Instead of using this type, create a locally provided and used type that is well-focused on your reference. For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .' + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + type: array + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer + phase: + description: Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. + type: string + readyReplicas: + description: The number of ready replicas for this MachinePool. A machine is considered ready when the node has been created and is "Ready". + format: int32 + type: integer + replicas: + description: Replicas is the most recently observed number of replicas. + format: int32 + type: integer + unavailableReplicas: + description: Total number of unavailable machine instances targeted by this machine pool. This is the total number of machine instances that are still required for the machine pool to have 100% available capacity. They may either be machine instances that are running but not yet available or machine instances that still have not been created. + format: int32 + type: integer + type: object + type: object + served: true storage: true subresources: scale: diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index daaaad690a27..1fd23cb2f30b 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -13,7 +13,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-cluster-x-k8s-io-v1alpha3-cluster + path: /mutate-cluster-x-k8s-io-v1alpha4-cluster failurePolicy: Fail matchPolicy: Equivalent name: default.cluster.cluster.x-k8s.io @@ -21,7 +21,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -35,7 +35,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-cluster-x-k8s-io-v1alpha3-machine + path: /mutate-cluster-x-k8s-io-v1alpha4-machine failurePolicy: Fail matchPolicy: Equivalent name: default.machine.cluster.x-k8s.io @@ -43,7 +43,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -57,7 +57,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-cluster-x-k8s-io-v1alpha3-machinedeployment + path: /mutate-cluster-x-k8s-io-v1alpha4-machinedeployment failurePolicy: Fail matchPolicy: Equivalent name: default.machinedeployment.cluster.x-k8s.io @@ -65,7 +65,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -79,7 +79,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-cluster-x-k8s-io-v1alpha3-machinehealthcheck + path: /mutate-cluster-x-k8s-io-v1alpha4-machinehealthcheck failurePolicy: Fail matchPolicy: Equivalent name: default.machinehealthcheck.cluster.x-k8s.io @@ -87,7 +87,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -101,7 +101,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-cluster-x-k8s-io-v1alpha3-machineset + path: /mutate-cluster-x-k8s-io-v1alpha4-machineset failurePolicy: Fail matchPolicy: Equivalent name: default.machineset.cluster.x-k8s.io @@ -109,7 +109,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -123,7 +123,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-exp-cluster-x-k8s-io-v1alpha3-machinepool + path: /mutate-exp-cluster-x-k8s-io-v1alpha4-machinepool failurePolicy: Fail matchPolicy: Equivalent name: default.exp.machinepool.cluster.x-k8s.io @@ -131,7 +131,7 @@ webhooks: - apiGroups: - exp.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -145,7 +145,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-addons-cluster-x-k8s-io-v1alpha3-clusterresourceset + path: /mutate-addons-cluster-x-k8s-io-v1alpha4-clusterresourceset failurePolicy: Fail matchPolicy: Equivalent name: default.clusterresourceset.addons.cluster.x-k8s.io @@ -153,7 +153,7 @@ webhooks: - apiGroups: - addons.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -175,7 +175,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-cluster-x-k8s-io-v1alpha3-cluster + path: /validate-cluster-x-k8s-io-v1alpha4-cluster failurePolicy: Fail matchPolicy: Equivalent name: validation.cluster.cluster.x-k8s.io @@ -183,7 +183,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -197,7 +197,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-cluster-x-k8s-io-v1alpha3-machine + path: /validate-cluster-x-k8s-io-v1alpha4-machine failurePolicy: Fail matchPolicy: Equivalent name: validation.machine.cluster.x-k8s.io @@ -205,7 +205,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -219,7 +219,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-cluster-x-k8s-io-v1alpha3-machinedeployment + path: /validate-cluster-x-k8s-io-v1alpha4-machinedeployment failurePolicy: Fail matchPolicy: Equivalent name: validation.machinedeployment.cluster.x-k8s.io @@ -227,7 +227,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -241,7 +241,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-cluster-x-k8s-io-v1alpha3-machinehealthcheck + path: /validate-cluster-x-k8s-io-v1alpha4-machinehealthcheck failurePolicy: Fail matchPolicy: Equivalent name: validation.machinehealthcheck.cluster.x-k8s.io @@ -249,7 +249,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -263,7 +263,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-cluster-x-k8s-io-v1alpha3-machineset + path: /validate-cluster-x-k8s-io-v1alpha4-machineset failurePolicy: Fail matchPolicy: Equivalent name: validation.machineset.cluster.x-k8s.io @@ -271,7 +271,7 @@ webhooks: - apiGroups: - cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -285,7 +285,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-exp-cluster-x-k8s-io-v1alpha3-machinepool + path: /validate-exp-cluster-x-k8s-io-v1alpha4-machinepool failurePolicy: Fail matchPolicy: Equivalent name: validation.exp.machinepool.cluster.x-k8s.io @@ -293,7 +293,7 @@ webhooks: - apiGroups: - exp.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -307,7 +307,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-addons-cluster-x-k8s-io-v1alpha3-clusterresourceset + path: /validate-addons-cluster-x-k8s-io-v1alpha4-clusterresourceset failurePolicy: Fail matchPolicy: Equivalent name: validation.clusterresourceset.addons.cluster.x-k8s.io @@ -315,7 +315,7 @@ webhooks: - apiGroups: - addons.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE diff --git a/controllers/cluster_controller.go b/controllers/cluster_controller.go index 26a1da7a4b30..ac5402f2d2c9 100644 --- a/controllers/cluster_controller.go +++ b/controllers/cluster_controller.go @@ -30,9 +30,9 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" - expv1alpha3 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" @@ -317,7 +317,7 @@ type clusterDescendants struct { machineSets clusterv1.MachineSetList controlPlaneMachines clusterv1.MachineList workerMachines clusterv1.MachineList - machinePools expv1alpha3.MachinePoolList + machinePools expv1.MachinePoolList } // length returns the number of descendants diff --git a/controllers/cluster_controller_phases.go b/controllers/cluster_controller_phases.go index f8bdcf1deaa4..0167b5425909 100644 --- a/controllers/cluster_controller_phases.go +++ b/controllers/cluster_controller_phases.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" diff --git a/controllers/cluster_controller_phases_test.go b/controllers/cluster_controller_phases_test.go index b1a83a0552cb..41c0f030e6c8 100644 --- a/controllers/cluster_controller_phases_test.go +++ b/controllers/cluster_controller_phases_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/kubernetes/scheme" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" capierrors "sigs.k8s.io/cluster-api/errors" ctrl "sigs.k8s.io/controller-runtime" @@ -51,7 +51,7 @@ func TestClusterReconcilePhases(t *testing.T) { Port: 8443, }, InfrastructureRef: &corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "test", }, @@ -81,7 +81,7 @@ func TestClusterReconcilePhases(t *testing.T) { cluster: cluster, infraRef: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "test", "namespace": "test-namespace", @@ -95,7 +95,7 @@ func TestClusterReconcilePhases(t *testing.T) { cluster: cluster, infraRef: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "test", "namespace": "test-namespace", @@ -109,7 +109,7 @@ func TestClusterReconcilePhases(t *testing.T) { cluster: cluster, infraRef: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "test", "namespace": "test-namespace", diff --git a/controllers/cluster_controller_test.go b/controllers/cluster_controller_test.go index babd467705df..dda9bc670a1f 100644 --- a/controllers/cluster_controller_test.go +++ b/controllers/cluster_controller_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/patch" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controllers/external/testing.go b/controllers/external/testing.go index 7ee5c579dbea..ffa4b2e8ec6e 100644 --- a/controllers/external/testing.go +++ b/controllers/external/testing.go @@ -20,7 +20,7 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) var ( @@ -32,7 +32,7 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "bootstrapmachines.bootstrap.cluster.x-k8s.io", Labels: map[string]string{ - clusterv1.GroupVersion.String(): "v1alpha3", + clusterv1.GroupVersion.String(): "v1alpha4", }, }, Spec: apiextensionsv1.CustomResourceDefinitionSpec{ @@ -44,7 +44,7 @@ var ( }, Versions: []apiextensionsv1.CustomResourceDefinitionVersion{ { - Name: "v1alpha3", + Name: "v1alpha4", Served: true, Storage: true, Subresources: &apiextensionsv1.CustomResourceSubresources{ @@ -78,7 +78,7 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "bootstrapmachinetemplates.bootstrap.cluster.x-k8s.io", Labels: map[string]string{ - clusterv1.GroupVersion.String(): "v1alpha3", + clusterv1.GroupVersion.String(): "v1alpha4", }, }, Spec: apiextensionsv1.CustomResourceDefinitionSpec{ @@ -90,7 +90,7 @@ var ( }, Versions: []apiextensionsv1.CustomResourceDefinitionVersion{ { - Name: "v1alpha3", + Name: "v1alpha4", Served: true, Storage: true, Subresources: &apiextensionsv1.CustomResourceSubresources{ @@ -124,7 +124,7 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "infrastructuremachines.infrastructure.cluster.x-k8s.io", Labels: map[string]string{ - clusterv1.GroupVersion.String(): "v1alpha3", + clusterv1.GroupVersion.String(): "v1alpha4", }, }, Spec: apiextensionsv1.CustomResourceDefinitionSpec{ @@ -136,7 +136,7 @@ var ( }, Versions: []apiextensionsv1.CustomResourceDefinitionVersion{ { - Name: "v1alpha3", + Name: "v1alpha4", Served: true, Storage: true, Subresources: &apiextensionsv1.CustomResourceSubresources{ @@ -170,7 +170,7 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: "infrastructuremachinetemplates.infrastructure.cluster.x-k8s.io", Labels: map[string]string{ - clusterv1.GroupVersion.String(): "v1alpha3", + clusterv1.GroupVersion.String(): "v1alpha4", }, }, Spec: apiextensionsv1.CustomResourceDefinitionSpec{ @@ -182,7 +182,7 @@ var ( }, Versions: []apiextensionsv1.CustomResourceDefinitionVersion{ { - Name: "v1alpha3", + Name: "v1alpha4", Served: true, Storage: true, Subresources: &apiextensionsv1.CustomResourceSubresources{ diff --git a/controllers/external/util.go b/controllers/external/util.go index bcb4fb8245a1..299c8fe5bbb4 100644 --- a/controllers/external/util.go +++ b/controllers/external/util.go @@ -27,7 +27,7 @@ import ( "k8s.io/apiserver/pkg/storage/names" "sigs.k8s.io/controller-runtime/pkg/client" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) const ( diff --git a/controllers/external/util_test.go b/controllers/external/util_test.go index e4a09d3b9073..af2540a4d862 100644 --- a/controllers/external/util_test.go +++ b/controllers/external/util_test.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" diff --git a/controllers/machine_controller.go b/controllers/machine_controller.go index 4531ba17be87..37904e7e4197 100644 --- a/controllers/machine_controller.go +++ b/controllers/machine_controller.go @@ -32,7 +32,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" "k8s.io/klog" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/controllers/noderefutil" "sigs.k8s.io/cluster-api/controllers/remote" diff --git a/controllers/machine_controller_noderef.go b/controllers/machine_controller_noderef.go index 6d087f447237..dbbd6ce7ca46 100644 --- a/controllers/machine_controller_noderef.go +++ b/controllers/machine_controller_noderef.go @@ -23,7 +23,7 @@ import ( "github.com/pkg/errors" apicorev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/noderefutil" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controllers/machine_controller_noderef_test.go b/controllers/machine_controller_noderef_test.go index d0bedc6221e7..29d03cb9c831 100644 --- a/controllers/machine_controller_noderef_test.go +++ b/controllers/machine_controller_noderef_test.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/noderefutil" ) diff --git a/controllers/machine_controller_phases.go b/controllers/machine_controller_phases.go index e6ceb20f862d..017d90d49e26 100644 --- a/controllers/machine_controller_phases.go +++ b/controllers/machine_controller_phases.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" diff --git a/controllers/machine_controller_phases_test.go b/controllers/machine_controller_phases_test.go index 51df25f43192..3854f7453194 100644 --- a/controllers/machine_controller_phases_test.go +++ b/controllers/machine_controller_phases_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/util/kubeconfig" ctrl "sigs.k8s.io/controller-runtime" @@ -64,13 +64,13 @@ var _ = Describe("Reconcile Machine Phases", func() { ClusterName: defaultCluster.Name, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -80,7 +80,7 @@ var _ = Describe("Reconcile Machine Phases", func() { defaultBootstrap := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -93,7 +93,7 @@ var _ = Describe("Reconcile Machine Phases", func() { defaultInfra := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -510,7 +510,7 @@ func TestReconcileBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, @@ -537,7 +537,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "new machine, bootstrap config ready with data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -559,7 +559,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "new machine, bootstrap config ready with no data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -579,7 +579,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "new machine, bootstrap config not ready", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -597,7 +597,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "new machine, bootstrap config is not found", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "wrong-namespace", @@ -614,7 +614,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "new machine, no bootstrap config or data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "wrong-namespace", @@ -628,7 +628,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "existing machine, bootstrap data should not change", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -647,7 +647,7 @@ func TestReconcileBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, @@ -669,7 +669,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "existing machine, bootstrap provider is not ready, and ownerref updated", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -696,7 +696,7 @@ func TestReconcileBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, @@ -716,7 +716,7 @@ func TestReconcileBootstrap(t *testing.T) { name: "existing machine, machineset owner and version v1alpha2, and ownerref updated", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -810,13 +810,13 @@ func TestReconcileInfrastructure(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -844,7 +844,7 @@ func TestReconcileInfrastructure(t *testing.T) { name: "new machine, infrastructure config ready", infraConfig: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -892,13 +892,13 @@ func TestReconcileInfrastructure(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -911,7 +911,7 @@ func TestReconcileInfrastructure(t *testing.T) { }, bootstrapConfig: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -924,7 +924,7 @@ func TestReconcileInfrastructure(t *testing.T) { }, infraConfig: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, }, expectError: true, @@ -940,7 +940,7 @@ func TestReconcileInfrastructure(t *testing.T) { name: "infrastructure ref is paused", infraConfig: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", diff --git a/controllers/machine_controller_test.go b/controllers/machine_controller_test.go index be42f342e835..80d01a431aef 100644 --- a/controllers/machine_controller_test.go +++ b/controllers/machine_controller_test.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/test/helpers" "sigs.k8s.io/cluster-api/util" @@ -46,7 +46,7 @@ func TestWatches(t *testing.T) { infraMachine := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": ns.Name, @@ -69,7 +69,7 @@ func TestWatches(t *testing.T) { defaultBootstrap := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config-machinereconcile", "namespace": ns.Name, @@ -133,13 +133,13 @@ func TestWatches(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: testCluster.Name, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config-machinereconcile", }, @@ -471,7 +471,7 @@ func TestReconcileRequest(t *testing.T) { infraConfig := unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -518,7 +518,7 @@ func TestReconcileRequest(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -546,7 +546,7 @@ func TestReconcileRequest(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -578,7 +578,7 @@ func TestReconcileRequest(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -625,7 +625,7 @@ func TestMachineConditions(t *testing.T) { return &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -656,7 +656,7 @@ func TestMachineConditions(t *testing.T) { return &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -685,13 +685,13 @@ func TestMachineConditions(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachine", Name: "bootstrap-config1", }, @@ -863,7 +863,7 @@ func TestReconcileDeleteExternal(t *testing.T) { bootstrapConfig := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "delete-bootstrap", "namespace": "default", @@ -880,7 +880,7 @@ func TestReconcileDeleteExternal(t *testing.T) { ClusterName: "test-cluster", Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "delete-bootstrap", }, @@ -899,7 +899,7 @@ func TestReconcileDeleteExternal(t *testing.T) { bootstrapExists: true, expected: &unstructured.Unstructured{ Object: map[string]interface{}{ - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "kind": "BootstrapConfig", "metadata": map[string]interface{}{ "name": "delete-bootstrap", @@ -962,7 +962,7 @@ func TestRemoveMachineFinalizerAfterDeleteReconcile(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", }, @@ -1304,7 +1304,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { cluster: &clusterv1.Cluster{ Spec: clusterv1.ClusterSpec{ ControlPlaneRef: &corev1.ObjectReference{ - APIVersion: "controlplane.cluster.x-k8s.io/v1alpha3", + APIVersion: "controlplane.cluster.x-k8s.io/v1alpha4", Kind: "AWSManagedControlPlane", Name: "test-cluster", Namespace: "test-cluster", @@ -1392,7 +1392,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { }, }, } - emp.SetAPIVersion("controlplane.cluster.x-k8s.io/v1alpha3") + emp.SetAPIVersion("controlplane.cluster.x-k8s.io/v1alpha4") emp.SetKind("AWSManagedControlPlane") emp.SetName("test-cluster") emp.SetNamespace("test-cluster") diff --git a/controllers/machine_helpers.go b/controllers/machine_helpers.go index 4e70abc82158..a842fb1ec579 100644 --- a/controllers/machine_helpers.go +++ b/controllers/machine_helpers.go @@ -22,7 +22,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/controllers/machine_helpers_test.go b/controllers/machine_helpers_test.go index d6a3940c3429..0f820ce467ff 100644 --- a/controllers/machine_helpers_test.go +++ b/controllers/machine_helpers_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/client/fake" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func Test_getActiveMachinesInCluster(t *testing.T) { diff --git a/controllers/machinedeployment_controller.go b/controllers/machinedeployment_controller.go index 5a9e0056ac46..eaaaf3e67f0f 100644 --- a/controllers/machinedeployment_controller.go +++ b/controllers/machinedeployment_controller.go @@ -28,7 +28,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/patch" diff --git a/controllers/machinedeployment_controller_test.go b/controllers/machinedeployment_controller_test.go index c1a62de606a1..15e4a3e09e6d 100644 --- a/controllers/machinedeployment_controller_test.go +++ b/controllers/machinedeployment_controller_test.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/util" ) @@ -98,7 +98,7 @@ var _ = Describe("MachineDeployment Reconciler", func() { ClusterName: testCluster.Name, Version: &version, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachineTemplate", Name: "md-template", }, @@ -117,7 +117,7 @@ var _ = Describe("MachineDeployment Reconciler", func() { // Create infrastructure template resource. infraResource := map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, "spec": map[string]interface{}{ "size": "3xlarge", @@ -131,7 +131,7 @@ var _ = Describe("MachineDeployment Reconciler", func() { }, } infraTmpl.SetKind("InfrastructureMachineTemplate") - infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha3") + infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha4") infraTmpl.SetName("md-template") infraTmpl.SetNamespace(namespace.Name) By("Creating the infrastructure template") diff --git a/controllers/machinedeployment_rolling.go b/controllers/machinedeployment_rolling.go index a6b4c06b4b77..dc96d383d4f6 100644 --- a/controllers/machinedeployment_rolling.go +++ b/controllers/machinedeployment_rolling.go @@ -22,7 +22,7 @@ import ( "github.com/pkg/errors" "k8s.io/utils/integer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/mdutil" ctrl "sigs.k8s.io/controller-runtime" ) diff --git a/controllers/machinedeployment_sync.go b/controllers/machinedeployment_sync.go index 83e3bbc823e4..8a63e9740739 100644 --- a/controllers/machinedeployment_sync.go +++ b/controllers/machinedeployment_sync.go @@ -29,7 +29,7 @@ import ( apirand "k8s.io/apimachinery/pkg/util/rand" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/util/retry" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/mdutil" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/patch" diff --git a/controllers/machinedeployment_sync_test.go b/controllers/machinedeployment_sync_test.go index 79974c130d49..8c9c4af59cb9 100644 --- a/controllers/machinedeployment_sync_test.go +++ b/controllers/machinedeployment_sync_test.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" capierrors "sigs.k8s.io/cluster-api/errors" ) diff --git a/controllers/machinehealthcheck_controller.go b/controllers/machinehealthcheck_controller.go index 6c9740e9311b..9e79aaf15ee0 100644 --- a/controllers/machinehealthcheck_controller.go +++ b/controllers/machinehealthcheck_controller.go @@ -30,7 +30,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/remote" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" diff --git a/controllers/machinehealthcheck_controller_test.go b/controllers/machinehealthcheck_controller_test.go index 045302414e5e..61b4c2b290f0 100644 --- a/controllers/machinehealthcheck_controller_test.go +++ b/controllers/machinehealthcheck_controller_test.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" @@ -710,7 +710,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { // Create infrastructure template resource. infraResource := map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, "spec": map[string]interface{}{ "size": "3xlarge", @@ -724,7 +724,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { }, } infraTmpl.SetKind("InfrastructureMachineTemplate") - infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha3") + infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha4") infraTmpl.SetGenerateName("mhc-ms-template-") infraTmpl.SetNamespace(mhc.Namespace) @@ -749,7 +749,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { DataSecretName: pointer.StringPtr("test-data-secret-name"), }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachineTemplate", Name: infraTmpl.GetName(), }, @@ -1411,7 +1411,7 @@ func newInfraMachine(machine *clusterv1.Machine) (*unstructured.Unstructured, st providerID := fmt.Sprintf("test:////%v", uuid.NewUUID()) return &unstructured.Unstructured{ Object: map[string]interface{}{ - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "kind": "InfrastructureMachine", "metadata": map[string]interface{}{ "generateName": "test-mhc-machine-infra-", diff --git a/controllers/machinehealthcheck_status_matcher.go b/controllers/machinehealthcheck_status_matcher.go index 2956818410e5..42be55c8e7d9 100644 --- a/controllers/machinehealthcheck_status_matcher.go +++ b/controllers/machinehealthcheck_status_matcher.go @@ -21,7 +21,7 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // MatchMachineHealthCheckStatus returns a custom matcher to check equality of clusterv1.MachineHealthCheckStatus diff --git a/controllers/machinehealthcheck_targets.go b/controllers/machinehealthcheck_targets.go index 0cce3a8b4070..3de56dbed53b 100644 --- a/controllers/machinehealthcheck_targets.go +++ b/controllers/machinehealthcheck_targets.go @@ -27,7 +27,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/machinehealthcheck_targets_test.go b/controllers/machinehealthcheck_targets_test.go index 9a06937149d6..d2023054e135 100644 --- a/controllers/machinehealthcheck_targets_test.go +++ b/controllers/machinehealthcheck_targets_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util/patch" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/machineset_controller.go b/controllers/machineset_controller.go index eaafa9048615..7655bc777844 100644 --- a/controllers/machineset_controller.go +++ b/controllers/machineset_controller.go @@ -31,7 +31,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/controllers/noderefutil" "sigs.k8s.io/cluster-api/controllers/remote" diff --git a/controllers/machineset_controller_test.go b/controllers/machineset_controller_test.go index 1bfa06b982dd..d7977a797caf 100644 --- a/controllers/machineset_controller_test.go +++ b/controllers/machineset_controller_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/record" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/client" @@ -90,13 +90,13 @@ var _ = Describe("MachineSet Reconciler", func() { Version: &version, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapMachineTemplate", Name: "ms-template", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachineTemplate", Name: "ms-template", }, @@ -108,7 +108,7 @@ var _ = Describe("MachineSet Reconciler", func() { // Create bootstrap template resource. bootstrapResource := map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, } bootstrapTmpl := &unstructured.Unstructured{ @@ -119,7 +119,7 @@ var _ = Describe("MachineSet Reconciler", func() { }, } bootstrapTmpl.SetKind("BootstrapMachineTemplate") - bootstrapTmpl.SetAPIVersion("bootstrap.cluster.x-k8s.io/v1alpha3") + bootstrapTmpl.SetAPIVersion("bootstrap.cluster.x-k8s.io/v1alpha4") bootstrapTmpl.SetName("ms-template") bootstrapTmpl.SetNamespace(namespace.Name) Expect(testEnv.Create(ctx, bootstrapTmpl)).To(Succeed()) @@ -127,7 +127,7 @@ var _ = Describe("MachineSet Reconciler", func() { // Create infrastructure template resource. infraResource := map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, "spec": map[string]interface{}{ "size": "3xlarge", @@ -141,7 +141,7 @@ var _ = Describe("MachineSet Reconciler", func() { }, } infraTmpl.SetKind("InfrastructureMachineTemplate") - infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha3") + infraTmpl.SetAPIVersion("infrastructure.cluster.x-k8s.io/v1alpha4") infraTmpl.SetName("ms-template") infraTmpl.SetNamespace(namespace.Name) Expect(testEnv.Create(ctx, infraTmpl)).To(Succeed()) diff --git a/controllers/machineset_delete_policy.go b/controllers/machineset_delete_policy.go index de9ec999bf65..a9d5aa155c04 100644 --- a/controllers/machineset_delete_policy.go +++ b/controllers/machineset_delete_policy.go @@ -22,7 +22,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) type ( diff --git a/controllers/machineset_delete_policy_test.go b/controllers/machineset_delete_policy_test.go index 0a09b05a162e..b516c55eef1b 100644 --- a/controllers/machineset_delete_policy_test.go +++ b/controllers/machineset_delete_policy_test.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" capierrors "sigs.k8s.io/cluster-api/errors" ) diff --git a/controllers/mdutil/util.go b/controllers/mdutil/util.go index 7fb5b94acac1..c99fadff8781 100644 --- a/controllers/mdutil/util.go +++ b/controllers/mdutil/util.go @@ -33,7 +33,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" intstrutil "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/integer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util/conversion" ) diff --git a/controllers/mdutil/util_test.go b/controllers/mdutil/util_test.go index ffc765117a25..5f44982a17c9 100644 --- a/controllers/mdutil/util_test.go +++ b/controllers/mdutil/util_test.go @@ -31,7 +31,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apiserver/pkg/storage/names" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func newDControllerRef(d *clusterv1.MachineDeployment) *metav1.OwnerReference { @@ -197,12 +197,12 @@ func TestEqualMachineTemplate(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "MachineBootstrap", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "MachineInfrastructure", }, }, @@ -235,12 +235,12 @@ func TestEqualMachineTemplate(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "MachineBootstrap2", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "MachineInfrastructure", }, }, diff --git a/controllers/remote/cluster_cache.go b/controllers/remote/cluster_cache.go index 60764e1f1f1f..ea1d63077e08 100644 --- a/controllers/remote/cluster_cache.go +++ b/controllers/remote/cluster_cache.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/remote/cluster_cache_healthcheck_test.go b/controllers/remote/cluster_cache_healthcheck_test.go index bed81bdb94fb..305878303e3e 100644 --- a/controllers/remote/cluster_cache_healthcheck_test.go +++ b/controllers/remote/cluster_cache_healthcheck_test.go @@ -29,7 +29,7 @@ import ( "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/manager" diff --git a/controllers/remote/cluster_cache_reconciler.go b/controllers/remote/cluster_cache_reconciler.go index 8687866f90bb..5af2c6687ea7 100644 --- a/controllers/remote/cluster_cache_reconciler.go +++ b/controllers/remote/cluster_cache_reconciler.go @@ -22,7 +22,7 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" kerrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" diff --git a/controllers/remote/cluster_cache_reconciler_test.go b/controllers/remote/cluster_cache_reconciler_test.go index d27e03f9f4f7..b57f3f799c66 100644 --- a/controllers/remote/cluster_cache_reconciler_test.go +++ b/controllers/remote/cluster_cache_reconciler_test.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" diff --git a/controllers/remote/cluster_cache_tracker_test.go b/controllers/remote/cluster_cache_tracker_test.go index 977b0c1d5cc8..4dcf15884b1c 100644 --- a/controllers/remote/cluster_cache_tracker_test.go +++ b/controllers/remote/cluster_cache_tracker_test.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/suite_test.go b/controllers/suite_test.go index a679d927b777..6ccea6980731 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -28,7 +28,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/remote" "sigs.k8s.io/cluster-api/test/helpers" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controllers/suite_util_test.go b/controllers/suite_util_test.go index 26aa75ed1dc9..11c0b673446c 100644 --- a/controllers/suite_util_test.go +++ b/controllers/suite_util_test.go @@ -29,7 +29,7 @@ import ( "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/client" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func intOrStrPtr(i int32) *intstr.IntOrString { diff --git a/controlplane/kubeadm/PROJECT b/controlplane/kubeadm/PROJECT index 2f53c56a3347..370545ce4de5 100644 --- a/controlplane/kubeadm/PROJECT +++ b/controlplane/kubeadm/PROJECT @@ -5,3 +5,6 @@ resources: - group: controlplane version: v1alpha3 kind: KubeadmControlPlane +- group: controlplane + version: v1alpha4 + kind: KubeadmControlPlane diff --git a/controlplane/kubeadm/api/v1alpha3/conversion.go b/controlplane/kubeadm/api/v1alpha3/conversion.go new file mode 100644 index 000000000000..f19a979f855e --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha3/conversion.go @@ -0,0 +1,42 @@ +/* +Copyright 2020 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 v1alpha3 + +import ( + "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +func (src *KubeadmControlPlane) ConvertTo(destRaw conversion.Hub) error { + dest := destRaw.(*v1alpha4.KubeadmControlPlane) + return Convert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(src, dest, nil) +} + +func (dest *KubeadmControlPlane) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.KubeadmControlPlane) + return Convert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(src, dest, nil) +} + +func (src *KubeadmControlPlaneList) ConvertTo(destRaw conversion.Hub) error { + dest := destRaw.(*v1alpha4.KubeadmControlPlaneList) + return Convert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList(src, dest, nil) +} + +func (dest *KubeadmControlPlaneList) ConvertFrom(srcRaw conversion.Hub) error { + src := srcRaw.(*v1alpha4.KubeadmControlPlaneList) + return Convert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList(src, dest, nil) +} diff --git a/controlplane/kubeadm/api/v1alpha3/conversion_test.go b/controlplane/kubeadm/api/v1alpha3/conversion_test.go new file mode 100644 index 000000000000..2169ab16ba6a --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha3/conversion_test.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 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 v1alpha3 + +import ( + "testing" + + . "github.com/onsi/gomega" + + "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/cluster-api/controlplane/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 KubeadmControlPLane", utilconversion.FuzzTestFunc(scheme, &v1alpha4.KubeadmControlPlane{}, &KubeadmControlPlane{})) +} diff --git a/controlplane/kubeadm/api/v1alpha3/doc.go b/controlplane/kubeadm/api/v1alpha3/doc.go index 999cec2ac553..d24536248ab9 100644 --- a/controlplane/kubeadm/api/v1alpha3/doc.go +++ b/controlplane/kubeadm/api/v1alpha3/doc.go @@ -14,4 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4 package v1alpha3 diff --git a/controlplane/kubeadm/api/v1alpha3/groupversion_info.go b/controlplane/kubeadm/api/v1alpha3/groupversion_info.go index 33df22fb8e03..0cf3a790e538 100644 --- a/controlplane/kubeadm/api/v1alpha3/groupversion_info.go +++ b/controlplane/kubeadm/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_types.go b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_types.go index 48f374d20533..9021c978eac2 100644 --- a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_types.go +++ b/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_types.go @@ -138,7 +138,6 @@ type KubeadmControlPlaneStatus struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=kubeadmcontrolplanes,shortName=kcp,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector // +kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=".status.initialized",description="This denotes whether or not the control plane has the uploaded kubeadm-config configmap" diff --git a/controlplane/kubeadm/api/v1alpha3/zz_generated.conversion.go b/controlplane/kubeadm/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..a38ad3c9effb --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,252 @@ +// +build !ignore_autogenerated_kubeadm_controlplane_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 v1alpha3 + +import ( + unsafe "unsafe" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + clusterapiapiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + apiv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + v1alpha4 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" + errors "sigs.k8s.io/cluster-api/errors" +) + +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((*KubeadmControlPlane)(nil), (*v1alpha4.KubeadmControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(a.(*KubeadmControlPlane), b.(*v1alpha4.KubeadmControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmControlPlane)(nil), (*KubeadmControlPlane)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(a.(*v1alpha4.KubeadmControlPlane), b.(*KubeadmControlPlane), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmControlPlaneList)(nil), (*v1alpha4.KubeadmControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList(a.(*KubeadmControlPlaneList), b.(*v1alpha4.KubeadmControlPlaneList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmControlPlaneList)(nil), (*KubeadmControlPlaneList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList(a.(*v1alpha4.KubeadmControlPlaneList), b.(*KubeadmControlPlaneList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmControlPlaneSpec)(nil), (*v1alpha4.KubeadmControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec(a.(*KubeadmControlPlaneSpec), b.(*v1alpha4.KubeadmControlPlaneSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmControlPlaneSpec)(nil), (*KubeadmControlPlaneSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec(a.(*v1alpha4.KubeadmControlPlaneSpec), b.(*KubeadmControlPlaneSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*KubeadmControlPlaneStatus)(nil), (*v1alpha4.KubeadmControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(a.(*KubeadmControlPlaneStatus), b.(*v1alpha4.KubeadmControlPlaneStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmControlPlaneStatus)(nil), (*KubeadmControlPlaneStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(a.(*v1alpha4.KubeadmControlPlaneStatus), b.(*KubeadmControlPlaneStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(in *KubeadmControlPlane, out *v1alpha4.KubeadmControlPlane, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(in *KubeadmControlPlane, out *v1alpha4.KubeadmControlPlane, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(in *v1alpha4.KubeadmControlPlane, out *KubeadmControlPlane, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(in *v1alpha4.KubeadmControlPlane, out *KubeadmControlPlane, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList(in *KubeadmControlPlaneList, out *v1alpha4.KubeadmControlPlaneList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.KubeadmControlPlane, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_KubeadmControlPlane_To_v1alpha4_KubeadmControlPlane(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList(in *KubeadmControlPlaneList, out *v1alpha4.KubeadmControlPlaneList, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmControlPlaneList_To_v1alpha4_KubeadmControlPlaneList(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList(in *v1alpha4.KubeadmControlPlaneList, out *KubeadmControlPlaneList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmControlPlane, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_KubeadmControlPlane_To_v1alpha3_KubeadmControlPlane(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList(in *v1alpha4.KubeadmControlPlaneList, out *KubeadmControlPlaneList, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmControlPlaneList_To_v1alpha3_KubeadmControlPlaneList(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec(in *KubeadmControlPlaneSpec, out *v1alpha4.KubeadmControlPlaneSpec, s conversion.Scope) error { + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Version = in.Version + out.InfrastructureTemplate = in.InfrastructureTemplate + if err := apiv1alpha3.Convert_v1alpha3_KubeadmConfigSpec_To_v1alpha4_KubeadmConfigSpec(&in.KubeadmConfigSpec, &out.KubeadmConfigSpec, s); err != nil { + return err + } + out.UpgradeAfter = (*v1.Time)(unsafe.Pointer(in.UpgradeAfter)) + out.NodeDrainTimeout = (*v1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) + return nil +} + +// Convert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec(in *KubeadmControlPlaneSpec, out *v1alpha4.KubeadmControlPlaneSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec(in *v1alpha4.KubeadmControlPlaneSpec, out *KubeadmControlPlaneSpec, s conversion.Scope) error { + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + out.Version = in.Version + out.InfrastructureTemplate = in.InfrastructureTemplate + if err := apiv1alpha3.Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(&in.KubeadmConfigSpec, &out.KubeadmConfigSpec, s); err != nil { + return err + } + out.UpgradeAfter = (*v1.Time)(unsafe.Pointer(in.UpgradeAfter)) + out.NodeDrainTimeout = (*v1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) + return nil +} + +// Convert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec(in *v1alpha4.KubeadmControlPlaneSpec, out *KubeadmControlPlaneSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec(in, out, s) +} + +func autoConvert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(in *KubeadmControlPlaneStatus, out *v1alpha4.KubeadmControlPlaneStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Initialized = in.Initialized + out.Ready = in.Ready + out.FailureReason = errors.KubeadmControlPlaneStatusError(in.FailureReason) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.ObservedGeneration = in.ObservedGeneration + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + if err := clusterapiapiv1alpha3.Convert_v1alpha3_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(in *KubeadmControlPlaneStatus, out *v1alpha4.KubeadmControlPlaneStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(in, out, s) +} + +func autoConvert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(in *v1alpha4.KubeadmControlPlaneStatus, out *KubeadmControlPlaneStatus, s conversion.Scope) error { + out.Selector = in.Selector + out.Replicas = in.Replicas + out.UpdatedReplicas = in.UpdatedReplicas + out.ReadyReplicas = in.ReadyReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.Initialized = in.Initialized + out.Ready = in.Ready + out.FailureReason = errors.KubeadmControlPlaneStatusError(in.FailureReason) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.ObservedGeneration = in.ObservedGeneration + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(clusterapiapiv1alpha3.Conditions, len(*in)) + for i := range *in { + if err := clusterapiapiv1alpha3.Convert_v1alpha4_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus is an autogenerated conversion function. +func Convert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(in *v1alpha4.KubeadmControlPlaneStatus, out *KubeadmControlPlaneStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(in, out, s) +} diff --git a/controlplane/kubeadm/api/v1alpha4/condition_consts.go b/controlplane/kubeadm/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..8deebe8284f6 --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha4/condition_consts.go @@ -0,0 +1,68 @@ +/* +Copyright 2020 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 v1alpha4 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + +// Conditions and condition Reasons for the KubeadmControlPlane object + +const ( + // MachinesReady reports an aggregate of current status of the machines controlled by the KubeadmControlPlane. + MachinesReadyCondition clusterv1.ConditionType = "MachinesReady" +) + +const ( + // CertificatesAvailableCondition documents that cluster certificates were generated as part of the + // processing of a a KubeadmControlPlane object. + CertificatesAvailableCondition clusterv1.ConditionType = "CertificatesAvailable" + + // CertificatesGenerationFailedReason (Severity=Warning) documents a KubeadmControlPlane controller detecting + // an error while generating certificates; those kind of errors are usually temporary and the controller + // automatically recover from them. + CertificatesGenerationFailedReason = "CertificatesGenerationFailed" +) + +const ( + // AvailableCondition documents that the first control plane instance has completed the kubeadm init operation + // and so the control plane is available and an API server instance is ready for processing requests. + AvailableCondition clusterv1.ConditionType = "Available" + + // WaitingForKubeadmInitReason (Severity=Info) documents a KubeadmControlPlane object waiting for the first + // control plane instance to complete the kubeadm init operation. + WaitingForKubeadmInitReason = "WaitingForKubeadmInit" +) + +const ( + // MachinesSpecUpToDateCondition documents that the spec of the machines controlled by the KubeadmControlPlane + // is up to date. Whe this condition is false, the KubeadmControlPlane is executing a rolling upgrade. + MachinesSpecUpToDateCondition clusterv1.ConditionType = "MachinesSpecUpToDate" + + // RollingUpdateInProgressReason (Severity=Warning) documents a KubeadmControlPlane object executing a + // rolling upgrade for aligning the machines spec to the desired state. + RollingUpdateInProgressReason = "RollingUpdateInProgress" +) + +const ( + // ResizedCondition documents a KubeadmControlPlane that is resizing the set of controlled machines. + ResizedCondition clusterv1.ConditionType = "Resized" + + // ScalingUpReason (Severity=Info) documents a KubeadmControlPlane that is increasing the number of replicas. + ScalingUpReason = "ScalingUp" + + // ScalingDownReason (Severity=Info) documents a KubeadmControlPlane that is decreasing the number of replicas. + ScalingDownReason = "ScalingDown" +) diff --git a/bootstrap/kubeadm/api/v1alpha2/types.go b/controlplane/kubeadm/api/v1alpha4/conversion.go similarity index 71% rename from bootstrap/kubeadm/api/v1alpha2/types.go rename to controlplane/kubeadm/api/v1alpha4/conversion.go index a3607d4d1dd7..543e42e5218a 100644 --- a/bootstrap/kubeadm/api/v1alpha2/types.go +++ b/controlplane/kubeadm/api/v1alpha4/conversion.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,9 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha2 +package v1alpha4 -// KubeadmConfigTemplateResource defines the Template structure -type KubeadmConfigTemplateResource struct { - Spec KubeadmConfigSpec `json:"spec,omitempty"` -} +func (*KubeadmControlPlane) Hub() {} +func (*KubeadmControlPlaneList) Hub() {} diff --git a/controlplane/kubeadm/api/v1alpha4/doc.go b/controlplane/kubeadm/api/v1alpha4/doc.go new file mode 100644 index 000000000000..b0efd4cde559 --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha4/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2020 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 v1alpha4 diff --git a/controlplane/kubeadm/api/v1alpha4/groupversion_info.go b/controlplane/kubeadm/api/v1alpha4/groupversion_info.go new file mode 100644 index 000000000000..696d0bd27c08 --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha4/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 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 v1alpha4 contains API Schema definitions for the kubeadm v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=controlplane.cluster.x-k8s.io +package v1alpha4 + +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: "controlplane.cluster.x-k8s.io", Version: "v1alpha4"} + + // 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 +) diff --git a/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_types.go b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_types.go new file mode 100644 index 000000000000..e14c1d5d05ff --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_types.go @@ -0,0 +1,177 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + "sigs.k8s.io/cluster-api/errors" +) + +const ( + KubeadmControlPlaneFinalizer = "kubeadm.controlplane.cluster.x-k8s.io" + + // SkipCoreDNSAnnotation annotation explicitly skips reconciling CoreDNS if set + SkipCoreDNSAnnotation = "controlplane.cluster.x-k8s.io/skip-coredns" + + // SkipKubeProxyAnnotation annotation explicitly skips reconciling kube-proxy if set + SkipKubeProxyAnnotation = "controlplane.cluster.x-k8s.io/skip-kube-proxy" + + // KubeadmClusterConfigurationAnnotation is a machine annotation that stores the json-marshalled string of KCP ClusterConfiguration. + // This annotation is used to detect any changes in ClusterConfiguration and trigger machine rollout in KCP. + KubeadmClusterConfigurationAnnotation = "controlplane.cluster.x-k8s.io/kubeadm-cluster-configuration" +) + +// KubeadmControlPlaneSpec defines the desired state of KubeadmControlPlane. +type KubeadmControlPlaneSpec struct { + // Number of desired machines. Defaults to 1. When stacked etcd is used only + // odd numbers are permitted, as per [etcd best practice](https://etcd.io/docs/v3.3.12/faq/#why-an-odd-number-of-cluster-members). + // This is a pointer to distinguish between explicit zero and not specified. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // Version defines the desired Kubernetes version. + Version string `json:"version"` + + // InfrastructureTemplate is a required reference to a custom resource + // offered by an infrastructure provider. + InfrastructureTemplate corev1.ObjectReference `json:"infrastructureTemplate"` + + // KubeadmConfigSpec is a KubeadmConfigSpec + // to use for initializing and joining machines to the control plane. + KubeadmConfigSpec cabpkv1.KubeadmConfigSpec `json:"kubeadmConfigSpec"` + + // UpgradeAfter is a field to indicate an upgrade should be performed + // after the specified time even if no changes have been made to the + // KubeadmControlPlane + // +optional + UpgradeAfter *metav1.Time `json:"upgradeAfter,omitempty"` + + // NodeDrainTimeout is the total amount of time that the controller will spend on draining a controlplane node + // The default value is 0, meaning that the node can be drained without any time limitations. + // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` + // +optional + NodeDrainTimeout *metav1.Duration `json:"nodeDrainTimeout,omitempty"` +} + +// KubeadmControlPlaneStatus defines the observed state of KubeadmControlPlane. +type KubeadmControlPlaneStatus struct { + // Selector is the label selector in string format to avoid introspection + // by clients, and is used to provide the CRD-based integration for the + // scale subresource and additional integrations for things like kubectl + // describe.. The string will be in the same format as the query-param syntax. + // More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors + // +optional + Selector string `json:"selector,omitempty"` + + // Total number of non-terminated machines targeted by this control plane + // (their labels match the selector). + // +optional + Replicas int32 `json:"replicas,omitempty"` + + // Total number of non-terminated machines targeted by this control plane + // that have the desired template spec. + // +optional + UpdatedReplicas int32 `json:"updatedReplicas,omitempty"` + + // Total number of fully running and ready control plane machines. + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // Total number of unavailable machines targeted by this control plane. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet ready or machines + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"` + + // Initialized denotes whether or not the control plane has the + // uploaded kubeadm-config configmap. + // +optional + Initialized bool `json:"initialized"` + + // Ready denotes that the KubeadmControlPlane API Server is ready to + // receive requests. + // +optional + Ready bool `json:"ready"` + + // FailureReason indicates that there is a terminal problem reconciling the + // state, and will be set to a token value suitable for + // programmatic interpretation. + // +optional + FailureReason errors.KubeadmControlPlaneStatusError `json:"failureReason,omitempty"` + + // ErrorMessage indicates that there is a terminal problem reconciling the + // state, and will be set to a descriptive error message. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // ObservedGeneration is the latest generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Conditions defines current service state of the KubeadmControlPlane. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=kubeadmcontrolplanes,shortName=kcp,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector +// +kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=".status.initialized",description="This denotes whether or not the control plane has the uploaded kubeadm-config configmap" +// +kubebuilder:printcolumn:name="API Server Available",type=boolean,JSONPath=".status.ready",description="KubeadmControlPlane API Server is ready to receive requests" +// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=".spec.version",description="Kubernetes version associated with this control plane" +// +kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=".status.replicas",description="Total number of non-terminated machines targeted by this control plane" +// +kubebuilder:printcolumn:name="Ready",type=integer,JSONPath=".status.readyReplicas",description="Total number of fully running and ready control plane machines" +// +kubebuilder:printcolumn:name="Updated",type=integer,JSONPath=".status.updatedReplicas",description="Total number of non-terminated machines targeted by this control plane that have the desired template spec" +// +kubebuilder:printcolumn:name="Unavailable",type=integer,JSONPath=".status.unavailableReplicas",description="Total number of unavailable machines targeted by this control plane" + +// KubeadmControlPlane is the Schema for the KubeadmControlPlane API. +type KubeadmControlPlane struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec KubeadmControlPlaneSpec `json:"spec,omitempty"` + Status KubeadmControlPlaneStatus `json:"status,omitempty"` +} + +func (in *KubeadmControlPlane) GetConditions() clusterv1.Conditions { + return in.Status.Conditions +} + +func (in *KubeadmControlPlane) SetConditions(conditions clusterv1.Conditions) { + in.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// KubeadmControlPlaneList contains a list of KubeadmControlPlane. +type KubeadmControlPlaneList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []KubeadmControlPlane `json:"items"` +} + +func init() { + SchemeBuilder.Register(&KubeadmControlPlane{}, &KubeadmControlPlaneList{}) +} diff --git a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook.go similarity index 97% rename from controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go rename to controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook.go index 9a140ed9853e..0a0f7b3422bf 100644 --- a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook.go +++ b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "encoding/json" @@ -42,8 +42,8 @@ func (in *KubeadmControlPlane) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/mutate-controlplane-cluster-x-k8s-io-v1alpha3-kubeadmcontrolplane,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=controlplane.cluster.x-k8s.io,resources=kubeadmcontrolplanes,versions=v1alpha3,name=default.kubeadmcontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/validate-controlplane-cluster-x-k8s-io-v1alpha3-kubeadmcontrolplane,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=controlplane.cluster.x-k8s.io,resources=kubeadmcontrolplanes,versions=v1alpha3,name=validation.kubeadmcontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-controlplane-cluster-x-k8s-io-v1alpha4-kubeadmcontrolplane,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=controlplane.cluster.x-k8s.io,resources=kubeadmcontrolplanes,versions=v1alpha4,name=default.kubeadmcontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-controlplane-cluster-x-k8s-io-v1alpha4-kubeadmcontrolplane,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=controlplane.cluster.x-k8s.io,resources=kubeadmcontrolplanes,versions=v1alpha4,name=validation.kubeadmcontrolplane.controlplane.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &KubeadmControlPlane{} var _ webhook.Validator = &KubeadmControlPlane{} diff --git a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go similarity index 99% rename from controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go rename to controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go index cc608ba58501..fdc5c0ff7cb4 100644 --- a/controlplane/kubeadm/api/v1alpha3/kubeadm_control_plane_webhook_test.go +++ b/controlplane/kubeadm/api/v1alpha4/kubeadm_control_plane_webhook_test.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" ) diff --git a/controlplane/kubeadm/api/v1alpha4/zz_generated.deepcopy.go b/controlplane/kubeadm/api/v1alpha4/zz_generated.deepcopy.go new file mode 100644 index 000000000000..ee557c94cd9d --- /dev/null +++ b/controlplane/kubeadm/api/v1alpha4/zz_generated.deepcopy.go @@ -0,0 +1,144 @@ +// +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 v1alpha4 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmControlPlane) DeepCopyInto(out *KubeadmControlPlane) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlane. +func (in *KubeadmControlPlane) DeepCopy() *KubeadmControlPlane { + if in == nil { + return nil + } + out := new(KubeadmControlPlane) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmControlPlane) 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 *KubeadmControlPlaneList) DeepCopyInto(out *KubeadmControlPlaneList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KubeadmControlPlane, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlaneList. +func (in *KubeadmControlPlaneList) DeepCopy() *KubeadmControlPlaneList { + if in == nil { + return nil + } + out := new(KubeadmControlPlaneList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeadmControlPlaneList) 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 *KubeadmControlPlaneSpec) DeepCopyInto(out *KubeadmControlPlaneSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + out.InfrastructureTemplate = in.InfrastructureTemplate + in.KubeadmConfigSpec.DeepCopyInto(&out.KubeadmConfigSpec) + if in.UpgradeAfter != nil { + in, out := &in.UpgradeAfter, &out.UpgradeAfter + *out = (*in).DeepCopy() + } + if in.NodeDrainTimeout != nil { + in, out := &in.NodeDrainTimeout, &out.NodeDrainTimeout + *out = new(v1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlaneSpec. +func (in *KubeadmControlPlaneSpec) DeepCopy() *KubeadmControlPlaneSpec { + if in == nil { + return nil + } + out := new(KubeadmControlPlaneSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmControlPlaneStatus) DeepCopyInto(out *KubeadmControlPlaneStatus) { + *out = *in + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlaneStatus. +func (in *KubeadmControlPlaneStatus) DeepCopy() *KubeadmControlPlaneStatus { + if in == nil { + return nil + } + out := new(KubeadmControlPlaneStatus) + in.DeepCopyInto(out) + return out +} 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 ca1d21ca5468..a35a72f43e5d 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 @@ -806,6 +806,799 @@ spec: type: object type: object served: true + storage: false + subresources: + scale: + labelSelectorPath: .status.selector + specReplicasPath: .spec.replicas + statusReplicasPath: .status.replicas + status: {} + - additionalPrinterColumns: + - description: This denotes whether or not the control plane has the uploaded kubeadm-config configmap + jsonPath: .status.initialized + name: Initialized + type: boolean + - description: KubeadmControlPlane API Server is ready to receive requests + jsonPath: .status.ready + name: API Server Available + type: boolean + - description: Kubernetes version associated with this control plane + jsonPath: .spec.version + name: Version + type: string + - description: Total number of non-terminated machines targeted by this control plane + jsonPath: .status.replicas + name: Replicas + type: integer + - description: Total number of fully running and ready control plane machines + jsonPath: .status.readyReplicas + name: Ready + type: integer + - description: Total number of non-terminated machines targeted by this control plane that have the desired template spec + jsonPath: .status.updatedReplicas + name: Updated + type: integer + - description: Total number of unavailable machines targeted by this control plane + jsonPath: .status.unavailableReplicas + name: Unavailable + type: integer + name: v1alpha4 + schema: + openAPIV3Schema: + description: KubeadmControlPlane is the Schema for the KubeadmControlPlane API. + 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' + 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' + type: string + metadata: + type: object + spec: + description: KubeadmControlPlaneSpec defines the desired state of KubeadmControlPlane. + properties: + infrastructureTemplate: + description: InfrastructureTemplate is a required reference to a custom resource offered by an infrastructure provider. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + kubeadmConfigSpec: + description: KubeadmConfigSpec is a KubeadmConfigSpec to use for initializing and joining machines to the control plane. + properties: + clusterConfiguration: + description: ClusterConfiguration along with InitConfiguration are the configurations necessary for the init command + properties: + apiServer: + description: APIServer contains extra settings for the API server control plane component + properties: + certSANs: + description: CertSANs sets extra Subject Alternative Names for the API Server signing cert. + items: + type: string + type: array + extraArgs: + additionalProperties: + type: string + description: '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.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, mounted to the control plane component. + items: + description: HostPathMount contains elements describing volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + timeoutForControlPlane: + description: TimeoutForControlPlane controls the timeout that we use for API server to appear + type: string + type: object + 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' + type: string + certificatesDir: + description: 'CertificatesDir specifies where to store or look for all required certificates. NB: if not provided, this will default to `/etc/kubernetes/pki`' + type: string + clusterName: + description: The cluster name + type: string + controlPlaneEndpoint: + description: '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.' + type: string + controllerManager: + description: ControllerManager contains extra settings for the controller manager control plane component + properties: + extraArgs: + additionalProperties: + type: string + description: '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.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, mounted to the control plane component. + items: + description: HostPathMount contains elements describing volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + type: object + dns: + description: DNS defines the options for the DNS add-on installed in the cluster. + properties: + imageRepository: + description: ImageRepository sets the container registry to pull images from. if not set, the ImageRepository defined in ClusterConfiguration will be used instead. + type: string + imageTag: + description: 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. + type: string + type: + description: Type defines the DNS add-on to be used + type: string + type: object + etcd: + description: 'Etcd holds configuration for etcd. NB: This value defaults to a Local (stacked) etcd' + properties: + external: + description: External describes how to connect to an external etcd cluster Local and External are mutually exclusive + properties: + caFile: + description: CAFile is an SSL Certificate Authority file used to secure etcd communication. Required if using a TLS connection. + type: string + certFile: + description: CertFile is an SSL certification file used to secure etcd communication. Required if using a TLS connection. + type: string + endpoints: + description: Endpoints of etcd members. Required for ExternalEtcd. + items: + type: string + type: array + keyFile: + description: KeyFile is an SSL key file used to secure etcd communication. Required if using a TLS connection. + type: string + required: + - caFile + - certFile + - endpoints + - keyFile + type: object + local: + description: Local provides configuration knobs for configuring the local etcd instance Local and External are mutually exclusive + properties: + dataDir: + description: DataDir is the directory etcd will place its data. Defaults to "/var/lib/etcd". + type: string + extraArgs: + additionalProperties: + type: string + description: ExtraArgs are extra arguments provided to the etcd binary when run inside a static pod. + type: object + imageRepository: + description: ImageRepository sets the container registry to pull images from. if not set, the ImageRepository defined in ClusterConfiguration will be used instead. + type: string + imageTag: + description: 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. + type: string + peerCertSANs: + description: PeerCertSANs sets extra Subject Alternative Names for the etcd peer signing cert. + items: + type: string + type: array + serverCertSANs: + description: ServerCertSANs sets extra Subject Alternative Names for the etcd server signing cert. + items: + type: string + type: array + type: object + type: object + featureGates: + additionalProperties: + type: boolean + description: FeatureGates enabled by the user. + type: object + imageRepository: + description: 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/kubernetes-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. + 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' + type: string + kubernetesVersion: + description: 'KubernetesVersion is the target version of the control plane. NB: This value defaults to the Machine object spec.version' + type: string + networking: + description: 'Networking holds configuration for the networking topology of the cluster. NB: This value defaults to the Cluster object spec.clusterNetwork.' + properties: + dnsDomain: + description: DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local". + type: string + podSubnet: + description: 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 + type: string + serviceSubnet: + description: 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. + type: string + type: object + scheduler: + description: Scheduler contains extra settings for the scheduler control plane component + properties: + extraArgs: + additionalProperties: + type: string + description: '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.' + type: object + extraVolumes: + description: ExtraVolumes is an extra set of host volumes, mounted to the control plane component. + items: + description: HostPathMount contains elements describing volumes that are mounted from the host. + properties: + hostPath: + description: HostPath is the path in the host that will be mounted inside the pod. + type: string + mountPath: + description: MountPath is the path inside the pod where hostPath will be mounted. + type: string + name: + description: Name of the volume inside the pod template. + type: string + pathType: + description: PathType is the type of the HostPath. + type: string + readOnly: + description: ReadOnly controls write access to the volume + type: boolean + required: + - hostPath + - mountPath + - name + type: object + type: array + type: object + useHyperKubeImage: + description: UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images + type: boolean + type: object + diskSetup: + description: DiskSetup specifies options for the creation of partition tables and file systems on devices. + properties: + filesystems: + description: Filesystems specifies the list of file systems to setup. + items: + description: Filesystem defines the file systems to be created. + properties: + device: + description: Device specifies the device name + type: string + extraOpts: + description: ExtraOpts defined extra options to add to the command for creating the file system. + items: + type: string + type: array + filesystem: + description: Filesystem specifies the file system type. + type: string + label: + description: Label specifies the file system label to be used. If set to None, no label is used. + type: string + overwrite: + description: Overwrite defines whether or not to overwrite any existing filesystem. If true, any pre-existing file system will be destroyed. Use with Caution. + type: boolean + partition: + description: 'Partition specifies the partition to use. The valid options are: "auto|any", "auto", "any", "none", and , where NUM is the actual partition number.' + type: string + replaceFS: + description: 'ReplaceFS is a special directive, used for Microsoft Azure that instructs cloud-init to replace a file system of . NOTE: unless you define a label, this requires the use of the ''any'' partition directive.' + type: string + required: + - device + - filesystem + - label + type: object + type: array + partitions: + description: Partitions specifies the list of the partitions to setup. + items: + description: Partition defines how to create and layout a partition. + properties: + device: + description: Device is the name of the device. + type: string + layout: + description: Layout specifies the device layout. If it is true, a single partition will be created for the entire device. When layout is false, it means don't partition or ignore existing partitioning. + type: boolean + overwrite: + description: Overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device. Use with caution. Default is 'false'. + type: boolean + tableType: + description: 'TableType specifies the tupe of partition table. The following are supported: ''mbr'': default and setups a MS-DOS partition table ''gpt'': setups a GPT partition table' + type: string + required: + - device + - layout + type: object + type: array + type: object + files: + description: Files specifies extra files to be passed to user_data upon creation. + items: + description: File defines the input for generating write_files in cloud-init. + properties: + content: + description: Content is the actual content of the file. + type: string + contentFrom: + description: ContentFrom is a referenced source of content to populate the file. + properties: + secret: + description: Secret represents a secret that should populate this file. + properties: + key: + description: Key is the key in the secret's data map for this value. + type: string + name: + description: Name of the secret in the KubeadmBootstrapConfig's namespace to use. + type: string + required: + - key + - name + type: object + required: + - secret + type: object + encoding: + description: Encoding specifies the encoding of the file contents. + enum: + - base64 + - gzip + - gzip+base64 + type: string + owner: + description: Owner specifies the ownership of the file, e.g. "root:root". + type: string + path: + description: Path specifies the full path on disk where to store the file. + type: string + permissions: + description: Permissions specifies the permissions to assign to the file, e.g. "0640". + type: string + required: + - path + type: object + type: array + format: + description: Format specifies the output format of the bootstrap data + enum: + - cloud-config + type: string + initConfiguration: + description: InitConfiguration along with ClusterConfiguration are the configurations necessary for the init command + 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' + type: string + bootstrapTokens: + description: 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 + items: + description: BootstrapToken describes one bootstrap token, stored as a Secret in the cluster + properties: + description: + description: Description sets a human-friendly message why this token exists and what it's used for, so other administrators can know its purpose. + type: string + expires: + description: 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. + format: date-time + type: string + groups: + description: Groups specifies the extra groups that this token will authenticate as when/if used for authentication + items: + type: string + type: array + token: + description: Token is used for establishing bidirectional trust between nodes and control-planes. Used for joining nodes in the cluster. + type: string + ttl: + description: TTL defines the time to live for this token. Defaults to 24h. Expires and TTL are mutually exclusive. + type: string + usages: + description: 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. + items: + type: string + type: array + required: + - token + type: object + type: array + 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' + type: string + localAPIEndpoint: + description: 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. + properties: + advertiseAddress: + description: AdvertiseAddress sets the IP address for the API server to advertise. + type: string + bindPort: + description: BindPort sets the secure port for the API Server to bind to. Defaults to 6443. + format: int32 + type: integer + required: + - advertiseAddress + - bindPort + type: object + nodeRegistration: + description: 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 + properties: + criSocket: + description: CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: + type: string + description: 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. + type: object + name: + description: 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. + type: string + taints: + 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.' + items: + description: The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to a node. + type: string + timeAdded: + description: TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints. + format: date-time + type: string + value: + description: The taint value corresponding to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + type: object + joinConfiguration: + description: JoinConfiguration is the kubeadm configuration for the join command + 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' + type: string + caCertPath: + 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: + localAPIEndpoint: + description: LocalAPIEndpoint represents the endpoint of the API server instance to be deployed on this node. + properties: + advertiseAddress: + description: AdvertiseAddress sets the IP address for the API server to advertise. + type: string + bindPort: + description: BindPort sets the secure port for 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' + properties: + bootstrapToken: + description: BootstrapToken is used to set the options for bootstrap token based discovery BootstrapToken and File are mutually exclusive + properties: + apiServerEndpoint: + description: APIServerEndpoint is an IP or domain name to the API server from which info will be fetched. + type: string + caCertHashes: + description: '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' + items: + type: string + type: array + token: + description: Token is a token used to validate cluster information fetched from the control-plane. + type: string + unsafeSkipCAVerification: + description: 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. + type: boolean + required: + - token + - unsafeSkipCAVerification + type: object + file: + description: 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 + properties: + kubeConfigPath: + description: KubeConfigPath is used to specify the actual file path or URL to the kubeconfig file from which to load cluster information + type: string + required: + - kubeConfigPath + type: object + timeout: + description: Timeout modifies the discovery timeout + type: string + tlsBootstrapToken: + 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' + type: string + type: object + 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' + type: string + nodeRegistration: + description: 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 + properties: + criSocket: + description: CRISocket is used to retrieve container runtime info. This information will be annotated to the Node API object, for later re-use + type: string + kubeletExtraArgs: + additionalProperties: + type: string + description: 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. + type: object + name: + description: 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. + type: string + taints: + 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.' + items: + description: The node this Taint is attached to has the "effect" on any pod that does not tolerate the Taint. + properties: + effect: + description: Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: Required. The taint key to be applied to a node. + type: string + timeAdded: + description: TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints. + format: date-time + type: string + value: + description: The taint value corresponding to the taint key. + type: string + required: + - effect + - key + type: object + type: array + type: object + type: object + mounts: + description: Mounts specifies a list of mount points to be setup. + items: + description: MountPoints defines input for generated mounts in cloud-init. + items: + type: string + type: array + type: array + ntp: + description: NTP specifies NTP configuration + properties: + enabled: + description: Enabled specifies whether NTP should be enabled + type: boolean + servers: + description: Servers specifies which NTP servers to use + items: + type: string + type: array + type: object + postKubeadmCommands: + description: PostKubeadmCommands specifies extra commands to run after kubeadm runs + items: + type: string + type: array + preKubeadmCommands: + description: PreKubeadmCommands specifies extra commands to run before kubeadm runs + items: + type: string + type: array + useExperimentalRetryJoin: + description: "UseExperimentalRetryJoin replaces a basic kubeadm command with a shell script with retries for joins. \n This is meant to be an experimental temporary workaround on some environments where joins fail due to timing (and other issues). The long term goal is to add retries to kubeadm proper and use that functionality. \n This will add about 40KB to userdata \n For more information, refer to https://github.com/kubernetes-sigs/cluster-api/pull/2763#discussion_r397306055." + type: boolean + users: + description: Users specifies extra users to add + items: + description: User defines the input for a generated user in cloud-init. + properties: + gecos: + description: Gecos specifies the gecos to use for the user + type: string + groups: + description: Groups specifies the additional groups for the user + type: string + homeDir: + description: HomeDir specifies the home directory to use for the user + type: string + inactive: + description: Inactive specifies whether to mark the user as inactive + type: boolean + lockPassword: + description: LockPassword specifies if password login should be disabled + type: boolean + name: + description: Name specifies the user name + type: string + passwd: + description: Passwd specifies a hashed password for the user + type: string + primaryGroup: + description: PrimaryGroup specifies the primary group for the user + type: string + shell: + description: Shell specifies the user's shell + type: string + sshAuthorizedKeys: + description: SSHAuthorizedKeys specifies a list of ssh authorized keys for the user + items: + type: string + type: array + sudo: + description: Sudo specifies a sudo role for the user + type: string + required: + - name + type: object + type: array + verbosity: + description: Verbosity is the number for the kubeadm log level verbosity. It overrides the `--v` flag in kubeadm commands. + format: int32 + type: integer + type: object + nodeDrainTimeout: + description: 'NodeDrainTimeout is the total amount of time that the controller will spend on draining a controlplane node The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`' + type: string + replicas: + description: Number of desired machines. Defaults to 1. When stacked etcd is used only odd numbers are permitted, as per [etcd best practice](https://etcd.io/docs/v3.3.12/faq/#why-an-odd-number-of-cluster-members). This is a pointer to distinguish between explicit zero and not specified. + format: int32 + type: integer + upgradeAfter: + description: UpgradeAfter is a field to indicate an upgrade should be performed after the specified time even if no changes have been made to the KubeadmControlPlane + format: date-time + type: string + version: + description: Version defines the desired Kubernetes version. + type: string + required: + - infrastructureTemplate + - kubeadmConfigSpec + - version + type: object + status: + description: KubeadmControlPlaneStatus defines the observed state of KubeadmControlPlane. + properties: + conditions: + description: Conditions defines current service state of the KubeadmControlPlane. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + failureMessage: + description: ErrorMessage indicates that there is a terminal problem reconciling the state, and will be set to a descriptive error message. + type: string + failureReason: + description: FailureReason indicates that there is a terminal problem reconciling the state, and will be set to a token value suitable for programmatic interpretation. + type: string + initialized: + description: Initialized denotes whether or not the control plane has the uploaded kubeadm-config configmap. + type: boolean + observedGeneration: + description: ObservedGeneration is the latest generation observed by the controller. + format: int64 + type: integer + ready: + description: Ready denotes that the KubeadmControlPlane API Server is ready to receive requests. + type: boolean + readyReplicas: + description: Total number of fully running and ready control plane machines. + format: int32 + type: integer + replicas: + description: Total number of non-terminated machines targeted by this control plane (their labels match the selector). + format: int32 + type: integer + selector: + description: 'Selector is the label selector in string format to avoid introspection by clients, and is used to provide the CRD-based integration for the scale subresource and additional integrations for things like kubectl describe.. The string will be in the same format as the query-param syntax. More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors' + type: string + unavailableReplicas: + description: Total number of unavailable machines targeted by this control plane. This is the total number of machines that are still required for the deployment to have 100% available capacity. They may either be machines that are running but not yet ready or machines that still have not been created. + format: int32 + type: integer + updatedReplicas: + description: Total number of non-terminated machines targeted by this control plane that have the desired template spec. + format: int32 + type: integer + type: object + type: object + served: true storage: true subresources: scale: diff --git a/controlplane/kubeadm/config/crd/kustomization.yaml b/controlplane/kubeadm/config/crd/kustomization.yaml index 61134db8c94f..03f909f770fd 100644 --- a/controlplane/kubeadm/config/crd/kustomization.yaml +++ b/controlplane/kubeadm/config/crd/kustomization.yaml @@ -1,5 +1,6 @@ commonLabels: cluster.x-k8s.io/v1alpha3: v1alpha3 + cluster.x-k8s.io/v1alpha4: v1alpha4 # This kustomization.yaml is not intended to be run by itself, # since it depends on service name and namespace that are out of this kustomize package. diff --git a/controlplane/kubeadm/config/webhook/manifests.yaml b/controlplane/kubeadm/config/webhook/manifests.yaml index 58da416aea04..9fa2f9375f86 100644 --- a/controlplane/kubeadm/config/webhook/manifests.yaml +++ b/controlplane/kubeadm/config/webhook/manifests.yaml @@ -13,7 +13,7 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-controlplane-cluster-x-k8s-io-v1alpha3-kubeadmcontrolplane + path: /mutate-controlplane-cluster-x-k8s-io-v1alpha4-kubeadmcontrolplane failurePolicy: Fail matchPolicy: Equivalent name: default.kubeadmcontrolplane.controlplane.cluster.x-k8s.io @@ -21,7 +21,7 @@ webhooks: - apiGroups: - controlplane.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE @@ -43,7 +43,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-controlplane-cluster-x-k8s-io-v1alpha3-kubeadmcontrolplane + path: /validate-controlplane-cluster-x-k8s-io-v1alpha4-kubeadmcontrolplane failurePolicy: Fail matchPolicy: Equivalent name: validation.kubeadmcontrolplane.controlplane.cluster.x-k8s.io @@ -51,7 +51,7 @@ webhooks: - apiGroups: - controlplane.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE diff --git a/controlplane/kubeadm/controllers/controller.go b/controlplane/kubeadm/controllers/controller.go index f646ec6bfe04..1163cd6bf4c3 100644 --- a/controlplane/kubeadm/controllers/controller.go +++ b/controlplane/kubeadm/controllers/controller.go @@ -36,10 +36,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/source" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" capierrors "sigs.k8s.io/cluster-api/errors" diff --git a/controlplane/kubeadm/controllers/controller_test.go b/controlplane/kubeadm/controllers/controller_test.go index 1d10182bbae4..694554d1166b 100644 --- a/controlplane/kubeadm/controllers/controller_test.go +++ b/controlplane/kubeadm/controllers/controller_test.go @@ -35,11 +35,11 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/klog/klogr" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/controllers/external" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/test/helpers" "sigs.k8s.io/cluster-api/util" diff --git a/controlplane/kubeadm/controllers/fakes_test.go b/controlplane/kubeadm/controllers/fakes_test.go index 934b3455d6a2..26dc5cbb412b 100644 --- a/controlplane/kubeadm/controllers/fakes_test.go +++ b/controlplane/kubeadm/controllers/fakes_test.go @@ -21,7 +21,7 @@ import ( "errors" "github.com/blang/semver" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/controllers/helpers.go b/controlplane/kubeadm/controllers/helpers.go index ed8e8be1a49e..f8d72400436d 100644 --- a/controlplane/kubeadm/controllers/helpers.go +++ b/controlplane/kubeadm/controllers/helpers.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apiserver/pkg/storage/names" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" diff --git a/controlplane/kubeadm/controllers/helpers_test.go b/controlplane/kubeadm/controllers/helpers_test.go index 4f22a4e4fa58..8c2bb5ca34ad 100644 --- a/controlplane/kubeadm/controllers/helpers_test.go +++ b/controlplane/kubeadm/controllers/helpers_test.go @@ -26,11 +26,11 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/tools/record" utilpointer "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/controllers/external" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/kubeconfig" @@ -300,13 +300,13 @@ func TestKubeadmControlPlaneReconciler_generateMachine(t *testing.T) { infraRef := &corev1.ObjectReference{ Kind: "InfraKind", - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Name: "infra", Namespace: cluster.Namespace, } bootstrapRef := &corev1.ObjectReference{ Kind: "BootstrapKind", - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Name: "bootstrap", Namespace: cluster.Namespace, } diff --git a/controlplane/kubeadm/controllers/scale.go b/controlplane/kubeadm/controllers/scale.go index a89d5b8e5322..46f55190b8ee 100644 --- a/controlplane/kubeadm/controllers/scale.go +++ b/controlplane/kubeadm/controllers/scale.go @@ -22,8 +22,8 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" capierrors "sigs.k8s.io/cluster-api/errors" diff --git a/controlplane/kubeadm/controllers/scale_test.go b/controlplane/kubeadm/controllers/scale_test.go index cdc32d924f2f..82535eae95f2 100644 --- a/controlplane/kubeadm/controllers/scale_test.go +++ b/controlplane/kubeadm/controllers/scale_test.go @@ -26,9 +26,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/controllers/status.go b/controlplane/kubeadm/controllers/status.go index 44041dc1af91..ad24cad447ec 100644 --- a/controlplane/kubeadm/controllers/status.go +++ b/controlplane/kubeadm/controllers/status.go @@ -20,8 +20,8 @@ import ( "context" "github.com/pkg/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/cluster-api/util" diff --git a/controlplane/kubeadm/controllers/status_test.go b/controlplane/kubeadm/controllers/status_test.go index 5b13ac99e6fe..596d3650ece2 100644 --- a/controlplane/kubeadm/controllers/status_test.go +++ b/controlplane/kubeadm/controllers/status_test.go @@ -26,8 +26,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/controllers/upgrade.go b/controlplane/kubeadm/controllers/upgrade.go index ae2eb5a66762..82211f9ae77b 100644 --- a/controlplane/kubeadm/controllers/upgrade.go +++ b/controlplane/kubeadm/controllers/upgrade.go @@ -21,8 +21,8 @@ import ( "github.com/blang/semver" "github.com/pkg/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controlplane/kubeadm/controllers/upgrade_test.go b/controlplane/kubeadm/controllers/upgrade_test.go index cdcf014afb11..efc71446d87f 100644 --- a/controlplane/kubeadm/controllers/upgrade_test.go +++ b/controlplane/kubeadm/controllers/upgrade_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/internal/cluster.go b/controlplane/kubeadm/internal/cluster.go index f4b0b7fac16e..969ad005111e 100644 --- a/controlplane/kubeadm/internal/cluster.go +++ b/controlplane/kubeadm/internal/cluster.go @@ -30,7 +30,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/remote" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/cluster-api/util/secret" diff --git a/controlplane/kubeadm/internal/cluster_labels.go b/controlplane/kubeadm/internal/cluster_labels.go index 826a5e5da675..f67b7c3825db 100644 --- a/controlplane/kubeadm/internal/cluster_labels.go +++ b/controlplane/kubeadm/internal/cluster_labels.go @@ -17,7 +17,7 @@ limitations under the License. package internal import ( - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // ControlPlaneLabelsForCluster returns a set of labels to add to a control plane machine for this specific cluster. diff --git a/controlplane/kubeadm/internal/cluster_test.go b/controlplane/kubeadm/internal/cluster_test.go index b36b18faa714..398a04879367 100644 --- a/controlplane/kubeadm/internal/cluster_test.go +++ b/controlplane/kubeadm/internal/cluster_test.go @@ -36,7 +36,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/cluster-api/util/kubeconfig" diff --git a/controlplane/kubeadm/internal/control_plane.go b/controlplane/kubeadm/internal/control_plane.go index 0c2c02dffd56..2534d93aae61 100644 --- a/controlplane/kubeadm/internal/control_plane.go +++ b/controlplane/kubeadm/internal/control_plane.go @@ -26,10 +26,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apiserver/pkg/storage/names" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/controlplane/kubeadm/internal/control_plane_test.go b/controlplane/kubeadm/internal/control_plane_test.go index 26056e4abc63..5ed1e898e152 100644 --- a/controlplane/kubeadm/internal/control_plane_test.go +++ b/controlplane/kubeadm/internal/control_plane_test.go @@ -25,9 +25,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" ) func TestControlPlane(t *testing.T) { diff --git a/controlplane/kubeadm/internal/failure_domain.go b/controlplane/kubeadm/internal/failure_domain.go index efc55efafd5e..0a745981de25 100644 --- a/controlplane/kubeadm/internal/failure_domain.go +++ b/controlplane/kubeadm/internal/failure_domain.go @@ -22,7 +22,7 @@ import ( "k8s.io/klog/klogr" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // Log is the global logger for the internal package. diff --git a/controlplane/kubeadm/internal/failure_domain_test.go b/controlplane/kubeadm/internal/failure_domain_test.go index 497b3a011adf..3fe4aba896ce 100644 --- a/controlplane/kubeadm/internal/failure_domain_test.go +++ b/controlplane/kubeadm/internal/failure_domain_test.go @@ -23,7 +23,7 @@ import ( "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestNewFailureDomainPicker(t *testing.T) { diff --git a/controlplane/kubeadm/internal/hash/hash.go b/controlplane/kubeadm/internal/hash/hash.go index c29df58f7419..a4bec2f03261 100644 --- a/controlplane/kubeadm/internal/hash/hash.go +++ b/controlplane/kubeadm/internal/hash/hash.go @@ -22,9 +22,9 @@ import ( corev1 "k8s.io/api/core/v1" - cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/mdutil" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" ) type fieldsToHash struct { diff --git a/controlplane/kubeadm/internal/machine_collection.go b/controlplane/kubeadm/internal/machine_collection.go index 425cea20344a..8984ffa4d437 100644 --- a/controlplane/kubeadm/internal/machine_collection.go +++ b/controlplane/kubeadm/internal/machine_collection.go @@ -30,7 +30,7 @@ package internal import ( "sort" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/controlplane/kubeadm/internal/machine_collection_test.go b/controlplane/kubeadm/internal/machine_collection_test.go index c5fca54bf705..375938e0dc60 100644 --- a/controlplane/kubeadm/internal/machine_collection_test.go +++ b/controlplane/kubeadm/internal/machine_collection_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestMachineCollection(t *testing.T) { diff --git a/controlplane/kubeadm/internal/machinefilters/machine_filters.go b/controlplane/kubeadm/internal/machinefilters/machine_filters.go index 3820c6968e71..7ceed43f2708 100644 --- a/controlplane/kubeadm/internal/machinefilters/machine_filters.go +++ b/controlplane/kubeadm/internal/machinefilters/machine_filters.go @@ -24,10 +24,10 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/internal/machinefilters/machine_filters_test.go b/controlplane/kubeadm/internal/machinefilters/machine_filters_test.go index 09a22784bb54..af9b4b2966c9 100644 --- a/controlplane/kubeadm/internal/machinefilters/machine_filters_test.go +++ b/controlplane/kubeadm/internal/machinefilters/machine_filters_test.go @@ -26,9 +26,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/machinefilters" ) @@ -279,7 +279,7 @@ func TestMatchesTemplateClonedFrom_WithClonedFromAnnotations(t *testing.T) { machine := &clusterv1.Machine{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureMachine", Name: "infra-config1", Namespace: "default", @@ -329,7 +329,7 @@ func TestMatchesTemplateClonedFrom_WithClonedFromAnnotations(t *testing.T) { machine.Name: { Object: map[string]interface{}{ "kind": "InfrastructureMachine", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", diff --git a/controlplane/kubeadm/internal/machinefilters/util_test.go b/controlplane/kubeadm/internal/machinefilters/util_test.go index d7ee34a0491a..a5f63c8a8416 100644 --- a/controlplane/kubeadm/internal/machinefilters/util_test.go +++ b/controlplane/kubeadm/internal/machinefilters/util_test.go @@ -22,10 +22,10 @@ import ( "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" ) func TestMatchClusterConfiguration(t *testing.T) { diff --git a/controlplane/kubeadm/internal/workload_cluster.go b/controlplane/kubeadm/internal/workload_cluster.go index d0db1fe684a9..f5d8f29bf704 100644 --- a/controlplane/kubeadm/internal/workload_cluster.go +++ b/controlplane/kubeadm/internal/workload_cluster.go @@ -34,8 +34,8 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/certs" containerutil "sigs.k8s.io/cluster-api/util/container" diff --git a/controlplane/kubeadm/internal/workload_cluster_coredns.go b/controlplane/kubeadm/internal/workload_cluster_coredns.go index c83872fdbdc7..5df278b431b2 100644 --- a/controlplane/kubeadm/internal/workload_cluster_coredns.go +++ b/controlplane/kubeadm/internal/workload_cluster_coredns.go @@ -27,7 +27,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/util" containerutil "sigs.k8s.io/cluster-api/util/container" "sigs.k8s.io/cluster-api/util/patch" diff --git a/controlplane/kubeadm/internal/workload_cluster_coredns_test.go b/controlplane/kubeadm/internal/workload_cluster_coredns_test.go index e2b5fa7adb0e..3c7a27c8ebd8 100644 --- a/controlplane/kubeadm/internal/workload_cluster_coredns_test.go +++ b/controlplane/kubeadm/internal/workload_cluster_coredns_test.go @@ -28,9 +28,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" - cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" diff --git a/controlplane/kubeadm/internal/workload_cluster_etcd.go b/controlplane/kubeadm/internal/workload_cluster_etcd.go index 78261db27911..bc11bdc5ce3c 100644 --- a/controlplane/kubeadm/internal/workload_cluster_etcd.go +++ b/controlplane/kubeadm/internal/workload_cluster_etcd.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kerrors "k8s.io/apimachinery/pkg/util/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd" etcdutil "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd/util" ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/internal/workload_cluster_etcd_test.go b/controlplane/kubeadm/internal/workload_cluster_etcd_test.go index 90c049761ee1..663197fa4e77 100644 --- a/controlplane/kubeadm/internal/workload_cluster_etcd_test.go +++ b/controlplane/kubeadm/internal/workload_cluster_etcd_test.go @@ -28,7 +28,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd" fake2 "sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd/fake" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controlplane/kubeadm/internal/workload_cluster_test.go b/controlplane/kubeadm/internal/workload_cluster_test.go index a75dff02c7c2..96c65a835fc5 100644 --- a/controlplane/kubeadm/internal/workload_cluster_test.go +++ b/controlplane/kubeadm/internal/workload_cluster_test.go @@ -29,10 +29,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) @@ -50,42 +50,42 @@ func TestUpdateKubeProxyImageInfo(t *testing.T) { expectImage string clientGet map[string]interface{} patchErr error - KCP *v1alpha3.KubeadmControlPlane + KCP *v1alpha4.KubeadmControlPlane }{ { name: "succeeds if patch correctly", ds: newKubeProxyDS(), expectErr: false, expectImage: "k8s.gcr.io/kube-proxy:v1.16.3", - KCP: &v1alpha3.KubeadmControlPlane{Spec: v1alpha3.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, + KCP: &v1alpha4.KubeadmControlPlane{Spec: v1alpha4.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, }, { name: "returns error if image in kube-proxy ds was in digest format", ds: newKubeProxyDSWithImage("k8s.gcr.io/kube-proxy@sha256:47bfd"), expectErr: true, expectImage: "k8s.gcr.io/kube-proxy@sha256:47bfd", - KCP: &v1alpha3.KubeadmControlPlane{Spec: v1alpha3.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, + KCP: &v1alpha4.KubeadmControlPlane{Spec: v1alpha4.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, }, { name: "expects OCI compatible format of tag", ds: newKubeProxyDS(), expectErr: false, expectImage: "k8s.gcr.io/kube-proxy:v1.16.3_build1", - KCP: &v1alpha3.KubeadmControlPlane{Spec: v1alpha3.KubeadmControlPlaneSpec{Version: "v1.16.3+build1"}}, + KCP: &v1alpha4.KubeadmControlPlane{Spec: v1alpha4.KubeadmControlPlaneSpec{Version: "v1.16.3+build1"}}, }, { name: "returns error if image in kube-proxy ds was in wrong format", ds: newKubeProxyDSWithImage(""), expectErr: true, - KCP: &v1alpha3.KubeadmControlPlane{Spec: v1alpha3.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, + KCP: &v1alpha4.KubeadmControlPlane{Spec: v1alpha4.KubeadmControlPlaneSpec{Version: "v1.16.3"}}, }, { name: "updates image repository if one has been set on the control plane", ds: newKubeProxyDS(), expectErr: false, expectImage: "foo.bar.example/baz/qux/kube-proxy:v1.16.3", - KCP: &v1alpha3.KubeadmControlPlane{ - Spec: v1alpha3.KubeadmControlPlaneSpec{ + KCP: &v1alpha4.KubeadmControlPlane{ + Spec: v1alpha4.KubeadmControlPlaneSpec{ Version: "v1.16.3", KubeadmConfigSpec: cabpkv1.KubeadmConfigSpec{ ClusterConfiguration: &kubeadmv1beta1.ClusterConfiguration{ @@ -99,8 +99,8 @@ func TestUpdateKubeProxyImageInfo(t *testing.T) { ds: newKubeProxyDS(), expectErr: false, expectImage: "k8s.gcr.io/kube-proxy:v1.16.3", - KCP: &v1alpha3.KubeadmControlPlane{ - Spec: v1alpha3.KubeadmControlPlaneSpec{ + KCP: &v1alpha4.KubeadmControlPlane{ + Spec: v1alpha4.KubeadmControlPlaneSpec{ Version: "v1.16.3", KubeadmConfigSpec: cabpkv1.KubeadmConfigSpec{ ClusterConfiguration: &kubeadmv1beta1.ClusterConfiguration{ @@ -113,8 +113,8 @@ func TestUpdateKubeProxyImageInfo(t *testing.T) { name: "returns error if image repository is invalid", ds: newKubeProxyDS(), expectErr: true, - KCP: &v1alpha3.KubeadmControlPlane{ - Spec: v1alpha3.KubeadmControlPlaneSpec{ + KCP: &v1alpha4.KubeadmControlPlane{ + Spec: v1alpha4.KubeadmControlPlaneSpec{ Version: "v1.16.3", KubeadmConfigSpec: cabpkv1.KubeadmConfigSpec{ ClusterConfiguration: &kubeadmv1beta1.ClusterConfiguration{ @@ -128,13 +128,13 @@ func TestUpdateKubeProxyImageInfo(t *testing.T) { ds: newKubeProxyDSWithImage(""), // Using the same image name that would otherwise lead to an error expectErr: false, expectImage: "", - KCP: &v1alpha3.KubeadmControlPlane{ + KCP: &v1alpha4.KubeadmControlPlane{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ - v1alpha3.SkipKubeProxyAnnotation: "", + v1alpha4.SkipKubeProxyAnnotation: "", }, }, - Spec: v1alpha3.KubeadmControlPlaneSpec{ + Spec: v1alpha4.KubeadmControlPlaneSpec{ Version: "v1.16.3", }}, }, diff --git a/controlplane/kubeadm/main.go b/controlplane/kubeadm/main.go index 70dfcbdfef34..bc0dbe5a1c71 100644 --- a/controlplane/kubeadm/main.go +++ b/controlplane/kubeadm/main.go @@ -30,10 +30,10 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/klog" "k8s.io/klog/klogr" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" - kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + kubeadmbootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/cmd/version" - kubeadmcontrolplanev1alpha3 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + kcpv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" kubeadmcontrolplanecontrollers "sigs.k8s.io/cluster-api/controlplane/kubeadm/controllers" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" @@ -50,9 +50,9 @@ func init() { klog.InitFlags(nil) _ = clientgoscheme.AddToScheme(scheme) - _ = clusterv1alpha3.AddToScheme(scheme) - _ = kubeadmcontrolplanev1alpha3.AddToScheme(scheme) - _ = kubeadmbootstrapv1alpha3.AddToScheme(scheme) + _ = clusterv1.AddToScheme(scheme) + _ = kcpv1.AddToScheme(scheme) + _ = kubeadmbootstrapv1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -167,7 +167,7 @@ func setupWebhooks(mgr ctrl.Manager) { return } - if err := (&kubeadmcontrolplanev1alpha3.KubeadmControlPlane{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&kcpv1.KubeadmControlPlane{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmControlPlane") os.Exit(1) } diff --git a/exp/PROJECT b/exp/PROJECT index 8f70fdaaaf57..278b96b52dc1 100644 --- a/exp/PROJECT +++ b/exp/PROJECT @@ -5,3 +5,6 @@ resources: - group: exp kind: MachinePool version: v1alpha3 +- group: exp + kind: MachinePool + version: v1alpha4 diff --git a/exp/addons/PROJECT b/exp/addons/PROJECT index 811ef07d5a90..e461cf47d148 100644 --- a/exp/addons/PROJECT +++ b/exp/addons/PROJECT @@ -5,4 +5,7 @@ resources: - group: addons kind: ClusterResourceSet version: v1alpha3 +- group: addons + kind: ClusterResourceSet + version: v1alpha4 diff --git a/exp/addons/api/v1alpha3/clusterresourceset_types.go b/exp/addons/api/v1alpha3/clusterresourceset_types.go index 976941b5dc17..96fddcc6fe8d 100644 --- a/exp/addons/api/v1alpha3/clusterresourceset_types.go +++ b/exp/addons/api/v1alpha3/clusterresourceset_types.go @@ -109,7 +109,6 @@ func (m *ClusterResourceSet) SetConditions(conditions clusterv1.Conditions) { // +kubebuilder:object:root=true // +kubebuilder:resource:path=clusterresourcesets,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // ClusterResourceSet is the Schema for the clusterresourcesets API type ClusterResourceSet struct { diff --git a/exp/addons/api/v1alpha3/clusterresourcesetbinding_types.go b/exp/addons/api/v1alpha3/clusterresourcesetbinding_types.go index bb1d7f0809fa..27fc79bfd69a 100644 --- a/exp/addons/api/v1alpha3/clusterresourcesetbinding_types.go +++ b/exp/addons/api/v1alpha3/clusterresourcesetbinding_types.go @@ -103,7 +103,6 @@ func (c *ClusterResourceSetBinding) DeleteBinding(clusterResourceSet *ClusterRes // +kubebuilder:object:root=true // +kubebuilder:resource:path=clusterresourcesetbindings,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // ClusterResourceSetBinding lists all matching ClusterResourceSets with the cluster it belongs to. type ClusterResourceSetBinding struct { diff --git a/exp/addons/api/v1alpha3/doc.go b/exp/addons/api/v1alpha3/doc.go new file mode 100644 index 000000000000..abc6b654b9d6 --- /dev/null +++ b/exp/addons/api/v1alpha3/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 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. +*/ + +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4 +package v1alpha3 diff --git a/exp/addons/api/v1alpha3/groupversion_info.go b/exp/addons/api/v1alpha3/groupversion_info.go index 41c094089133..105c7de0afb8 100644 --- a/exp/addons/api/v1alpha3/groupversion_info.go +++ b/exp/addons/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/exp/addons/api/v1alpha3/zz_generated.conversion.go b/exp/addons/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..b565e4cac501 --- /dev/null +++ b/exp/addons/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,384 @@ +// +build !ignore_autogenerated_core_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 v1alpha3 + +import ( + unsafe "unsafe" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + v1alpha4 "sigs.k8s.io/cluster-api/exp/addons/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((*ClusterResourceSet)(nil), (*v1alpha4.ClusterResourceSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(a.(*ClusterResourceSet), b.(*v1alpha4.ClusterResourceSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSet)(nil), (*ClusterResourceSet)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(a.(*v1alpha4.ClusterResourceSet), b.(*ClusterResourceSet), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetBinding)(nil), (*v1alpha4.ClusterResourceSetBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetBinding_To_v1alpha4_ClusterResourceSetBinding(a.(*ClusterResourceSetBinding), b.(*v1alpha4.ClusterResourceSetBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetBinding)(nil), (*ClusterResourceSetBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetBinding_To_v1alpha3_ClusterResourceSetBinding(a.(*v1alpha4.ClusterResourceSetBinding), b.(*ClusterResourceSetBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetBindingList)(nil), (*v1alpha4.ClusterResourceSetBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetBindingList_To_v1alpha4_ClusterResourceSetBindingList(a.(*ClusterResourceSetBindingList), b.(*v1alpha4.ClusterResourceSetBindingList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetBindingList)(nil), (*ClusterResourceSetBindingList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetBindingList_To_v1alpha3_ClusterResourceSetBindingList(a.(*v1alpha4.ClusterResourceSetBindingList), b.(*ClusterResourceSetBindingList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetBindingSpec)(nil), (*v1alpha4.ClusterResourceSetBindingSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(a.(*ClusterResourceSetBindingSpec), b.(*v1alpha4.ClusterResourceSetBindingSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetBindingSpec)(nil), (*ClusterResourceSetBindingSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(a.(*v1alpha4.ClusterResourceSetBindingSpec), b.(*ClusterResourceSetBindingSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetList)(nil), (*v1alpha4.ClusterResourceSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList(a.(*ClusterResourceSetList), b.(*v1alpha4.ClusterResourceSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetList)(nil), (*ClusterResourceSetList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList(a.(*v1alpha4.ClusterResourceSetList), b.(*ClusterResourceSetList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetSpec)(nil), (*v1alpha4.ClusterResourceSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec(a.(*ClusterResourceSetSpec), b.(*v1alpha4.ClusterResourceSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetSpec)(nil), (*ClusterResourceSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec(a.(*v1alpha4.ClusterResourceSetSpec), b.(*ClusterResourceSetSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ClusterResourceSetStatus)(nil), (*v1alpha4.ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(a.(*ClusterResourceSetStatus), b.(*v1alpha4.ClusterResourceSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ClusterResourceSetStatus)(nil), (*ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(a.(*v1alpha4.ClusterResourceSetStatus), b.(*ClusterResourceSetStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ResourceBinding)(nil), (*v1alpha4.ResourceBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ResourceBinding_To_v1alpha4_ResourceBinding(a.(*ResourceBinding), b.(*v1alpha4.ResourceBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ResourceBinding)(nil), (*ResourceBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ResourceBinding_To_v1alpha3_ResourceBinding(a.(*v1alpha4.ResourceBinding), b.(*ResourceBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ResourceRef)(nil), (*v1alpha4.ResourceRef)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef(a.(*ResourceRef), b.(*v1alpha4.ResourceRef), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ResourceRef)(nil), (*ResourceRef)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef(a.(*v1alpha4.ResourceRef), b.(*ResourceRef), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ResourceSetBinding)(nil), (*v1alpha4.ResourceSetBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_ResourceSetBinding_To_v1alpha4_ResourceSetBinding(a.(*ResourceSetBinding), b.(*v1alpha4.ResourceSetBinding), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.ResourceSetBinding)(nil), (*ResourceSetBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_ResourceSetBinding_To_v1alpha3_ResourceSetBinding(a.(*v1alpha4.ResourceSetBinding), b.(*ResourceSetBinding), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(in *ClusterResourceSet, out *v1alpha4.ClusterResourceSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ClusterResourceSet_To_v1alpha4_ClusterResourceSet is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(in *ClusterResourceSet, out *v1alpha4.ClusterResourceSet, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(in *v1alpha4.ClusterResourceSet, out *ClusterResourceSet, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_ClusterResourceSet_To_v1alpha3_ClusterResourceSet is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(in *v1alpha4.ClusterResourceSet, out *ClusterResourceSet, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetBinding_To_v1alpha4_ClusterResourceSetBinding(in *ClusterResourceSetBinding, out *v1alpha4.ClusterResourceSetBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_ClusterResourceSetBinding_To_v1alpha4_ClusterResourceSetBinding is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetBinding_To_v1alpha4_ClusterResourceSetBinding(in *ClusterResourceSetBinding, out *v1alpha4.ClusterResourceSetBinding, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetBinding_To_v1alpha4_ClusterResourceSetBinding(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetBinding_To_v1alpha3_ClusterResourceSetBinding(in *v1alpha4.ClusterResourceSetBinding, out *ClusterResourceSetBinding, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_ClusterResourceSetBinding_To_v1alpha3_ClusterResourceSetBinding is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetBinding_To_v1alpha3_ClusterResourceSetBinding(in *v1alpha4.ClusterResourceSetBinding, out *ClusterResourceSetBinding, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetBinding_To_v1alpha3_ClusterResourceSetBinding(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetBindingList_To_v1alpha4_ClusterResourceSetBindingList(in *ClusterResourceSetBindingList, out *v1alpha4.ClusterResourceSetBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.ClusterResourceSetBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_ClusterResourceSetBindingList_To_v1alpha4_ClusterResourceSetBindingList is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetBindingList_To_v1alpha4_ClusterResourceSetBindingList(in *ClusterResourceSetBindingList, out *v1alpha4.ClusterResourceSetBindingList, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetBindingList_To_v1alpha4_ClusterResourceSetBindingList(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetBindingList_To_v1alpha3_ClusterResourceSetBindingList(in *v1alpha4.ClusterResourceSetBindingList, out *ClusterResourceSetBindingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ClusterResourceSetBinding)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_ClusterResourceSetBindingList_To_v1alpha3_ClusterResourceSetBindingList is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetBindingList_To_v1alpha3_ClusterResourceSetBindingList(in *v1alpha4.ClusterResourceSetBindingList, out *ClusterResourceSetBindingList, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetBindingList_To_v1alpha3_ClusterResourceSetBindingList(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(in *ClusterResourceSetBindingSpec, out *v1alpha4.ClusterResourceSetBindingSpec, s conversion.Scope) error { + out.Bindings = *(*[]*v1alpha4.ResourceSetBinding)(unsafe.Pointer(&in.Bindings)) + return nil +} + +// Convert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(in *ClusterResourceSetBindingSpec, out *v1alpha4.ClusterResourceSetBindingSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(in *v1alpha4.ClusterResourceSetBindingSpec, out *ClusterResourceSetBindingSpec, s conversion.Scope) error { + out.Bindings = *(*[]*ResourceSetBinding)(unsafe.Pointer(&in.Bindings)) + return nil +} + +// Convert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(in *v1alpha4.ClusterResourceSetBindingSpec, out *ClusterResourceSetBindingSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList(in *ClusterResourceSetList, out *v1alpha4.ClusterResourceSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.ClusterResourceSet)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList(in *ClusterResourceSetList, out *v1alpha4.ClusterResourceSetList, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList(in *v1alpha4.ClusterResourceSetList, out *ClusterResourceSetList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]ClusterResourceSet)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList(in *v1alpha4.ClusterResourceSetList, out *ClusterResourceSetList, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec(in *ClusterResourceSetSpec, out *v1alpha4.ClusterResourceSetSpec, s conversion.Scope) error { + out.ClusterSelector = in.ClusterSelector + out.Resources = *(*[]v1alpha4.ResourceRef)(unsafe.Pointer(&in.Resources)) + out.Strategy = in.Strategy + return nil +} + +// Convert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec(in *ClusterResourceSetSpec, out *v1alpha4.ClusterResourceSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetSpec_To_v1alpha4_ClusterResourceSetSpec(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec(in *v1alpha4.ClusterResourceSetSpec, out *ClusterResourceSetSpec, s conversion.Scope) error { + out.ClusterSelector = in.ClusterSelector + out.Resources = *(*[]ResourceRef)(unsafe.Pointer(&in.Resources)) + out.Strategy = in.Strategy + return nil +} + +// Convert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec(in *v1alpha4.ClusterResourceSetSpec, out *ClusterResourceSetSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetSpec_To_v1alpha3_ClusterResourceSetSpec(in, out, s) +} + +func autoConvert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in *ClusterResourceSetStatus, out *v1alpha4.ClusterResourceSetStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*apiv1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus is an autogenerated conversion function. +func Convert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in *ClusterResourceSetStatus, out *v1alpha4.ClusterResourceSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in, out, s) +} + +func autoConvert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in *v1alpha4.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*apiv1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus is an autogenerated conversion function. +func Convert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in *v1alpha4.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in, out, s) +} + +func autoConvert_v1alpha3_ResourceBinding_To_v1alpha4_ResourceBinding(in *ResourceBinding, out *v1alpha4.ResourceBinding, s conversion.Scope) error { + if err := Convert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef(&in.ResourceRef, &out.ResourceRef, s); err != nil { + return err + } + out.Hash = in.Hash + out.LastAppliedTime = (*v1.Time)(unsafe.Pointer(in.LastAppliedTime)) + out.Applied = in.Applied + return nil +} + +// Convert_v1alpha3_ResourceBinding_To_v1alpha4_ResourceBinding is an autogenerated conversion function. +func Convert_v1alpha3_ResourceBinding_To_v1alpha4_ResourceBinding(in *ResourceBinding, out *v1alpha4.ResourceBinding, s conversion.Scope) error { + return autoConvert_v1alpha3_ResourceBinding_To_v1alpha4_ResourceBinding(in, out, s) +} + +func autoConvert_v1alpha4_ResourceBinding_To_v1alpha3_ResourceBinding(in *v1alpha4.ResourceBinding, out *ResourceBinding, s conversion.Scope) error { + if err := Convert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef(&in.ResourceRef, &out.ResourceRef, s); err != nil { + return err + } + out.Hash = in.Hash + out.LastAppliedTime = (*v1.Time)(unsafe.Pointer(in.LastAppliedTime)) + out.Applied = in.Applied + return nil +} + +// Convert_v1alpha4_ResourceBinding_To_v1alpha3_ResourceBinding is an autogenerated conversion function. +func Convert_v1alpha4_ResourceBinding_To_v1alpha3_ResourceBinding(in *v1alpha4.ResourceBinding, out *ResourceBinding, s conversion.Scope) error { + return autoConvert_v1alpha4_ResourceBinding_To_v1alpha3_ResourceBinding(in, out, s) +} + +func autoConvert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef(in *ResourceRef, out *v1alpha4.ResourceRef, s conversion.Scope) error { + out.Name = in.Name + out.Kind = in.Kind + return nil +} + +// Convert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef is an autogenerated conversion function. +func Convert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef(in *ResourceRef, out *v1alpha4.ResourceRef, s conversion.Scope) error { + return autoConvert_v1alpha3_ResourceRef_To_v1alpha4_ResourceRef(in, out, s) +} + +func autoConvert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef(in *v1alpha4.ResourceRef, out *ResourceRef, s conversion.Scope) error { + out.Name = in.Name + out.Kind = in.Kind + return nil +} + +// Convert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef is an autogenerated conversion function. +func Convert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef(in *v1alpha4.ResourceRef, out *ResourceRef, s conversion.Scope) error { + return autoConvert_v1alpha4_ResourceRef_To_v1alpha3_ResourceRef(in, out, s) +} + +func autoConvert_v1alpha3_ResourceSetBinding_To_v1alpha4_ResourceSetBinding(in *ResourceSetBinding, out *v1alpha4.ResourceSetBinding, s conversion.Scope) error { + out.ClusterResourceSetName = in.ClusterResourceSetName + out.Resources = *(*[]v1alpha4.ResourceBinding)(unsafe.Pointer(&in.Resources)) + return nil +} + +// Convert_v1alpha3_ResourceSetBinding_To_v1alpha4_ResourceSetBinding is an autogenerated conversion function. +func Convert_v1alpha3_ResourceSetBinding_To_v1alpha4_ResourceSetBinding(in *ResourceSetBinding, out *v1alpha4.ResourceSetBinding, s conversion.Scope) error { + return autoConvert_v1alpha3_ResourceSetBinding_To_v1alpha4_ResourceSetBinding(in, out, s) +} + +func autoConvert_v1alpha4_ResourceSetBinding_To_v1alpha3_ResourceSetBinding(in *v1alpha4.ResourceSetBinding, out *ResourceSetBinding, s conversion.Scope) error { + out.ClusterResourceSetName = in.ClusterResourceSetName + out.Resources = *(*[]ResourceBinding)(unsafe.Pointer(&in.Resources)) + return nil +} + +// Convert_v1alpha4_ResourceSetBinding_To_v1alpha3_ResourceSetBinding is an autogenerated conversion function. +func Convert_v1alpha4_ResourceSetBinding_To_v1alpha3_ResourceSetBinding(in *v1alpha4.ResourceSetBinding, out *ResourceSetBinding, s conversion.Scope) error { + return autoConvert_v1alpha4_ResourceSetBinding_To_v1alpha3_ResourceSetBinding(in, out, s) +} diff --git a/exp/addons/api/v1alpha4/clusterresourceset_types.go b/exp/addons/api/v1alpha4/clusterresourceset_types.go new file mode 100644 index 000000000000..739585be9930 --- /dev/null +++ b/exp/addons/api/v1alpha4/clusterresourceset_types.go @@ -0,0 +1,134 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +const ( + // ClusterResourceSetSecretType is the only accepted type of secret in resources + ClusterResourceSetSecretType corev1.SecretType = "addons.cluster.x-k8s.io/resource-set" //nolint:gosec + + // ClusterResourceSetFinalizer is added to the ClusterResourceSet object for additional cleanup logic on deletion. + ClusterResourceSetFinalizer = "addons.cluster.x-k8s.io" +) + +// ANCHOR: ClusterResourceSetSpec + +// ClusterResourceSetSpec defines the desired state of ClusterResourceSet +type ClusterResourceSetSpec struct { + // Label selector for Clusters. The Clusters that are + // selected by this will be the ones affected by this ClusterResourceSet. + // It must match the Cluster labels. This field is immutable. + ClusterSelector metav1.LabelSelector `json:"clusterSelector"` + + // Resources is a list of Secrets/ConfigMaps where each contains 1 or more resources to be applied to remote clusters. + Resources []ResourceRef `json:"resources,omitempty"` + + // Strategy is the strategy to be used during applying resources. Defaults to ApplyOnce. This field is immutable. + // +kubebuilder:validation:Enum=ApplyOnce + // +optional + Strategy string `json:"strategy,omitempty"` +} + +// ANCHOR_END: ClusterResourceSetSpec + +// ClusterResourceSetResourceKind is a string representation of a ClusterResourceSet resource kind. +type ClusterResourceSetResourceKind string + +const ( + SecretClusterResourceSetResourceKind ClusterResourceSetResourceKind = "Secret" + ConfigMapClusterResourceSetResourceKind ClusterResourceSetResourceKind = "ConfigMap" +) + +// ResourceRef specifies a resource. +type ResourceRef struct { + // Name of the resource that is in the same namespace with ClusterResourceSet object. + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Kind of the resource. Supported kinds are: Secrets and ConfigMaps. + // +kubebuilder:validation:Enum=Secret;ConfigMap + Kind string `json:"kind"` +} + +// ClusterResourceSetStrategy is a string representation of a ClusterResourceSet Strategy. +type ClusterResourceSetStrategy string + +const ( + // ClusterResourceSetStrategyApplyOnce is the default strategy a ClusterResourceSet strategy is assigned by + // ClusterResourceSet controller after being created if not specified by user. + ClusterResourceSetStrategyApplyOnce ClusterResourceSetStrategy = "ApplyOnce" +) + +// SetTypedStrategy sets the Strategy field to the string representation of ClusterResourceSetStrategy. +func (c *ClusterResourceSetSpec) SetTypedStrategy(p ClusterResourceSetStrategy) { + c.Strategy = string(p) +} + +// ANCHOR: ClusterResourceSetStatus + +// ClusterResourceSetStatus defines the observed state of ClusterResourceSet +type ClusterResourceSetStatus struct { + // ObservedGeneration reflects the generation of the most recently observed ClusterResourceSet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Conditions defines current state of the ClusterResourceSet. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// ANCHOR_END: ClusterResourceSetStatus + +func (m *ClusterResourceSet) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +func (m *ClusterResourceSet) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=clusterresourcesets,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// ClusterResourceSet is the Schema for the clusterresourcesets API +type ClusterResourceSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClusterResourceSetSpec `json:"spec,omitempty"` + Status ClusterResourceSetStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ClusterResourceSetList contains a list of ClusterResourceSet +type ClusterResourceSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterResourceSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClusterResourceSet{}, &ClusterResourceSetList{}) +} diff --git a/exp/addons/api/v1alpha3/clusterresourceset_webhook.go b/exp/addons/api/v1alpha4/clusterresourceset_webhook.go similarity index 93% rename from exp/addons/api/v1alpha3/clusterresourceset_webhook.go rename to exp/addons/api/v1alpha4/clusterresourceset_webhook.go index 6e2e4acc48e7..7c34bd4fb4bc 100644 --- a/exp/addons/api/v1alpha3/clusterresourceset_webhook.go +++ b/exp/addons/api/v1alpha4/clusterresourceset_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -34,8 +34,8 @@ func (m *ClusterResourceSet) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-addons-cluster-x-k8s-io-v1alpha3-clusterresourceset,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=addons.cluster.x-k8s.io,resources=clusterresourcesets,versions=v1alpha3,name=validation.clusterresourceset.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-addons-cluster-x-k8s-io-v1alpha3-clusterresourceset,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=addons.cluster.x-k8s.io,resources=clusterresourcesets,versions=v1alpha3,name=default.clusterresourceset.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-addons-cluster-x-k8s-io-v1alpha4-clusterresourceset,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=addons.cluster.x-k8s.io,resources=clusterresourcesets,versions=v1alpha4,name=validation.clusterresourceset.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-addons-cluster-x-k8s-io-v1alpha4-clusterresourceset,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=addons.cluster.x-k8s.io,resources=clusterresourcesets,versions=v1alpha4,name=default.clusterresourceset.addons.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &ClusterResourceSet{} var _ webhook.Validator = &ClusterResourceSet{} diff --git a/exp/addons/api/v1alpha3/clusterresourceset_webhook_test.go b/exp/addons/api/v1alpha4/clusterresourceset_webhook_test.go similarity index 99% rename from exp/addons/api/v1alpha3/clusterresourceset_webhook_test.go rename to exp/addons/api/v1alpha4/clusterresourceset_webhook_test.go index 4e1e2118d796..6129ad8f0b36 100644 --- a/exp/addons/api/v1alpha3/clusterresourceset_webhook_test.go +++ b/exp/addons/api/v1alpha4/clusterresourceset_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/exp/addons/api/v1alpha4/clusterresourcesetbinding_types.go b/exp/addons/api/v1alpha4/clusterresourcesetbinding_types.go new file mode 100644 index 000000000000..9aa375865f11 --- /dev/null +++ b/exp/addons/api/v1alpha4/clusterresourcesetbinding_types.go @@ -0,0 +1,136 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + "reflect" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ANCHOR: ResourceBinding + +// ResourceBinding shows the status of a resource that belongs to a ClusterResourceSet matched by the owner cluster of the ClusterResourceSetBinding object. +type ResourceBinding struct { + // ResourceRef specifies a resource. + ResourceRef `json:",inline"` + + // Hash is the hash of a resource's data. This can be used to decide if a resource is changed. + // For "ApplyOnce" ClusterResourceSet.spec.strategy, this is no-op as that strategy does not act on change. + Hash string `json:"hash,omitempty"` + + // LastAppliedTime identifies when this resource was last applied to the cluster. + // +optional + LastAppliedTime *metav1.Time `json:"lastAppliedTime,omitempty"` + + // Applied is to track if a resource is applied to the cluster or not. + Applied bool `json:"applied"` +} + +// ANCHOR_END: ResourceBinding + +// ResourceSetBinding keeps info on all of the resources in a ClusterResourceSet. +type ResourceSetBinding struct { + // ClusterResourceSetName is the name of the ClusterResourceSet that is applied to the owner cluster of the binding. + ClusterResourceSetName string `json:"clusterResourceSetName"` + + // Resources is a list of resources that the ClusterResourceSet has. + Resources []ResourceBinding `json:"resources,omitempty"` +} + +// IsApplied returns true if the resource is applied to the cluster by checking the cluster's binding. +func (r *ResourceSetBinding) IsApplied(resourceRef ResourceRef) bool { + for _, resource := range r.Resources { + if reflect.DeepEqual(resource.ResourceRef, resourceRef) { + if resource.Applied { + return true + } + } + } + return false +} + +// SetBinding sets resourceBinding for a resource in resourceSetbinding either by updating the existing one or +// creating a new one. +func (r *ResourceSetBinding) SetBinding(resourceBinding ResourceBinding) { + for i := range r.Resources { + if reflect.DeepEqual(r.Resources[i].ResourceRef, resourceBinding.ResourceRef) { + r.Resources[i] = resourceBinding + return + } + } + r.Resources = append(r.Resources, resourceBinding) +} + +// GetOrCreateBinding returns the ResourceSetBinding for a given ClusterResourceSet if exists, +// otherwise creates one and updates ClusterResourceSet with it. +func (c *ClusterResourceSetBinding) GetOrCreateBinding(clusterResourceSet *ClusterResourceSet) *ResourceSetBinding { + for _, binding := range c.Spec.Bindings { + if binding.ClusterResourceSetName == clusterResourceSet.Name { + return binding + } + } + binding := &ResourceSetBinding{ClusterResourceSetName: clusterResourceSet.Name, Resources: []ResourceBinding{}} + c.Spec.Bindings = append(c.Spec.Bindings, binding) + return binding +} + +// DeleteBinding removes the ClusterResourceSet from the ClusterResourceSetBinding Bindings list +func (c *ClusterResourceSetBinding) DeleteBinding(clusterResourceSet *ClusterResourceSet) { + for i, binding := range c.Spec.Bindings { + if binding.ClusterResourceSetName == clusterResourceSet.Name { + copy(c.Spec.Bindings[i:], c.Spec.Bindings[i+1:]) + c.Spec.Bindings = c.Spec.Bindings[:len(c.Spec.Bindings)-1] + break + } + } +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=clusterresourcesetbindings,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// ClusterResourceSetBinding lists all matching ClusterResourceSets with the cluster it belongs to. +type ClusterResourceSetBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ClusterResourceSetBindingSpec `json:"spec,omitempty"` +} + +// ANCHOR: ClusterResourceSetBindingSpec + +// ClusterResourceSetBindingSpec defines the desired state of ClusterResourceSetBinding +type ClusterResourceSetBindingSpec struct { + // Bindings is a list of ClusterResourceSets and their resources. + Bindings []*ResourceSetBinding `json:"bindings,omitempty"` +} + +// ANCHOR_END: ClusterResourceSetBindingSpec + +// +kubebuilder:object:root=true + +// ClusterResourceSetBindingList contains a list of ClusterResourceSetBinding +type ClusterResourceSetBindingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterResourceSetBinding `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClusterResourceSetBinding{}, &ClusterResourceSetBindingList{}) +} diff --git a/exp/addons/api/v1alpha4/clusterresourcesetbinding_types_test.go b/exp/addons/api/v1alpha4/clusterresourcesetbinding_types_test.go new file mode 100644 index 000000000000..7ffe81159763 --- /dev/null +++ b/exp/addons/api/v1alpha4/clusterresourcesetbinding_types_test.go @@ -0,0 +1,170 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + "reflect" + "testing" + "time" + + . "github.com/onsi/gomega" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +func TestIsResourceApplied(t *testing.T) { + g := NewWithT(t) + + scheme := runtime.NewScheme() + g.Expect(AddToScheme(scheme)).To(Succeed()) + + resourceRefApplyFailed := ResourceRef{ + Name: "applyFailed", + Kind: "Secret", + } + resourceRefApplySucceeded := ResourceRef{ + Name: "ApplySucceeded", + Kind: "Secret", + } + resourceRefNotExist := ResourceRef{ + Name: "notExist", + Kind: "Secret", + } + CRSBinding := &ResourceSetBinding{ + ClusterResourceSetName: "test-clusterResourceSet", + Resources: []ResourceBinding{ + { + ResourceRef: resourceRefApplySucceeded, + Applied: true, + Hash: "xyz", + LastAppliedTime: &metav1.Time{Time: time.Now().UTC()}, + }, + { + ResourceRef: resourceRefApplyFailed, + Applied: false, + Hash: "", + LastAppliedTime: &metav1.Time{Time: time.Now().UTC()}, + }, + }, + } + + tests := []struct { + name string + resourceSetBinding *ResourceSetBinding + resourceRef ResourceRef + isApplied bool + }{ + { + name: "should return true if the resource is applied successfully", + resourceSetBinding: CRSBinding, + resourceRef: resourceRefApplySucceeded, + isApplied: true, + }, + { + name: "should return false if the resource apply failed", + resourceSetBinding: CRSBinding, + resourceRef: resourceRefApplyFailed, + isApplied: false, + }, + { + name: "should return false if the resource does not exist", + resourceSetBinding: CRSBinding, + resourceRef: resourceRefNotExist, + isApplied: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gs := NewWithT(t) + gs.Expect(tt.resourceSetBinding.IsApplied(tt.resourceRef)).To(BeEquivalentTo(tt.isApplied)) + }) + } +} + +func TestSetResourceBinding(t *testing.T) { + g := NewWithT(t) + + scheme := runtime.NewScheme() + g.Expect(AddToScheme(scheme)).To(Succeed()) + + resourceRefApplyFailed := ResourceRef{ + Name: "applyFailed", + Kind: "Secret", + } + + CRSBinding := &ResourceSetBinding{ + ClusterResourceSetName: "test-clusterResourceSet", + Resources: []ResourceBinding{ + { + ResourceRef: resourceRefApplyFailed, + Applied: false, + Hash: "", + LastAppliedTime: &metav1.Time{Time: time.Now().UTC()}, + }, + }, + } + updateFailedResourceBinding := ResourceBinding{ + ResourceRef: resourceRefApplyFailed, + Applied: true, + Hash: "xyz", + LastAppliedTime: &metav1.Time{Time: time.Now().UTC()}, + } + + newResourceBinding := ResourceBinding{ + ResourceRef: ResourceRef{ + Name: "newBinding", + Kind: "Secret", + }, + Applied: false, + Hash: "xyz", + LastAppliedTime: &metav1.Time{Time: time.Now().UTC()}, + } + + tests := []struct { + name string + resourceSetBinding *ResourceSetBinding + resourceBinding ResourceBinding + }{ + { + name: "should update resourceSetBinding with new resource binding if not exist", + resourceSetBinding: CRSBinding, + resourceBinding: newResourceBinding, + }, + { + name: "should update Applied if resource failed before", + resourceSetBinding: CRSBinding, + resourceBinding: updateFailedResourceBinding, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gs := NewWithT(t) + tt.resourceSetBinding.SetBinding(tt.resourceBinding) + exist := false + for _, b := range tt.resourceSetBinding.Resources { + if reflect.DeepEqual(b.ResourceRef, tt.resourceBinding.ResourceRef) { + gs.Expect(tt.resourceBinding.Applied).To(BeEquivalentTo(b.Applied)) + exist = true + } + } + gs.Expect(exist).To(BeTrue()) + }) + } +} diff --git a/exp/addons/api/v1alpha4/condition_consts.go b/exp/addons/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..97699a508019 --- /dev/null +++ b/exp/addons/api/v1alpha4/condition_consts.go @@ -0,0 +1,42 @@ +/* +Copyright 2020 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 v1alpha4 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + +// Conditions and condition Reasons for the ClusterResourceSet object + +const ( + // ResourcesAppliedCondition documents that all resources in the ClusterResourceSet object are applied to + // all matching clusters. This indicates all resources exist, and no errors during applying them to all clusters. + ResourcesAppliedCondition clusterv1.ConditionType = "ResourcesApplied" + + // RemoteClusterClientFailedReason (Severity=Error) documents failure during getting the remote cluster client. + RemoteClusterClientFailedReason = "RemoteClusterClientFailed" + + // ClusterMatchFailedReason (Severity=Warning) documents failure getting clusters that match the clusterSelector. + ClusterMatchFailedReason = "ClusterMatchFailed" + + // ApplyFailedReason (Severity=Warning) documents applying at least one of the resources to one of the matching clusters is failed. + ApplyFailedReason = "ApplyFailed" + + // RetrievingResourceFailedReason (Severity=Warning) documents at least one of the resources are not successfully retrieved. + RetrievingResourceFailedReason = "RetrievingResourceFailed" + + // WrongSecretType (Severity=Warning) documents at least one of the Secret's type in the resource list is not supported. + WrongSecretTypeReason = "WrongSecretType" +) diff --git a/exp/addons/api/v1alpha4/doc.go b/exp/addons/api/v1alpha4/doc.go new file mode 100644 index 000000000000..b0efd4cde559 --- /dev/null +++ b/exp/addons/api/v1alpha4/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2020 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 v1alpha4 diff --git a/exp/addons/api/v1alpha4/groupversion_info.go b/exp/addons/api/v1alpha4/groupversion_info.go new file mode 100644 index 000000000000..a7c6e2e74a9b --- /dev/null +++ b/exp/addons/api/v1alpha4/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 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 v1alpha4 contains API Schema definitions for the addons v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=addons.cluster.x-k8s.io +package v1alpha4 + +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: "addons.cluster.x-k8s.io", Version: "v1alpha4"} + + // 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 +) diff --git a/exp/addons/api/v1alpha4/zz_generated.deepcopy.go b/exp/addons/api/v1alpha4/zz_generated.deepcopy.go new file mode 100644 index 000000000000..223fc46221b1 --- /dev/null +++ b/exp/addons/api/v1alpha4/zz_generated.deepcopy.go @@ -0,0 +1,269 @@ +// +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 v1alpha4 + +import ( + "k8s.io/apimachinery/pkg/runtime" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResourceSet) DeepCopyInto(out *ClusterResourceSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSet. +func (in *ClusterResourceSet) DeepCopy() *ClusterResourceSet { + if in == nil { + return nil + } + out := new(ClusterResourceSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterResourceSet) 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 *ClusterResourceSetBinding) DeepCopyInto(out *ClusterResourceSetBinding) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetBinding. +func (in *ClusterResourceSetBinding) DeepCopy() *ClusterResourceSetBinding { + if in == nil { + return nil + } + out := new(ClusterResourceSetBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterResourceSetBinding) 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 *ClusterResourceSetBindingList) DeepCopyInto(out *ClusterResourceSetBindingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterResourceSetBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetBindingList. +func (in *ClusterResourceSetBindingList) DeepCopy() *ClusterResourceSetBindingList { + if in == nil { + return nil + } + out := new(ClusterResourceSetBindingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterResourceSetBindingList) 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 *ClusterResourceSetBindingSpec) DeepCopyInto(out *ClusterResourceSetBindingSpec) { + *out = *in + if in.Bindings != nil { + in, out := &in.Bindings, &out.Bindings + *out = make([]*ResourceSetBinding, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(ResourceSetBinding) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetBindingSpec. +func (in *ClusterResourceSetBindingSpec) DeepCopy() *ClusterResourceSetBindingSpec { + if in == nil { + return nil + } + out := new(ClusterResourceSetBindingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResourceSetList) DeepCopyInto(out *ClusterResourceSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterResourceSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetList. +func (in *ClusterResourceSetList) DeepCopy() *ClusterResourceSetList { + if in == nil { + return nil + } + out := new(ClusterResourceSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterResourceSetList) 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 *ClusterResourceSetSpec) DeepCopyInto(out *ClusterResourceSetSpec) { + *out = *in + in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]ResourceRef, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetSpec. +func (in *ClusterResourceSetSpec) DeepCopy() *ClusterResourceSetSpec { + if in == nil { + return nil + } + out := new(ClusterResourceSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResourceSetStatus) DeepCopyInto(out *ClusterResourceSetStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetStatus. +func (in *ClusterResourceSetStatus) DeepCopy() *ClusterResourceSetStatus { + if in == nil { + return nil + } + out := new(ClusterResourceSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceBinding) DeepCopyInto(out *ResourceBinding) { + *out = *in + out.ResourceRef = in.ResourceRef + if in.LastAppliedTime != nil { + in, out := &in.LastAppliedTime, &out.LastAppliedTime + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceBinding. +func (in *ResourceBinding) DeepCopy() *ResourceBinding { + if in == nil { + return nil + } + out := new(ResourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceRef) DeepCopyInto(out *ResourceRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef. +func (in *ResourceRef) DeepCopy() *ResourceRef { + if in == nil { + return nil + } + out := new(ResourceRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSetBinding) DeepCopyInto(out *ResourceSetBinding) { + *out = *in + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make([]ResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSetBinding. +func (in *ResourceSetBinding) DeepCopy() *ResourceSetBinding { + if in == nil { + return nil + } + out := new(ResourceSetBinding) + in.DeepCopyInto(out) + return out +} diff --git a/exp/addons/controllers/clusterresourceset_controller.go b/exp/addons/controllers/clusterresourceset_controller.go index c09473eeddf2..aaa479f10cc8 100644 --- a/exp/addons/controllers/clusterresourceset_controller.go +++ b/exp/addons/controllers/clusterresourceset_controller.go @@ -32,9 +32,9 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/remote" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" resourcepredicates "sigs.k8s.io/cluster-api/exp/addons/controllers/predicates" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/exp/addons/controllers/clusterresourceset_controller_test.go b/exp/addons/controllers/clusterresourceset_controller_test.go index d73efdb12fb4..0cedca4e400c 100644 --- a/exp/addons/controllers/clusterresourceset_controller_test.go +++ b/exp/addons/controllers/clusterresourceset_controller_test.go @@ -29,8 +29,8 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" ) const ( diff --git a/exp/addons/controllers/clusterresourceset_helpers.go b/exp/addons/controllers/clusterresourceset_helpers.go index 09ca18c5db33..681768ec6e8e 100644 --- a/exp/addons/controllers/clusterresourceset_helpers.go +++ b/exp/addons/controllers/clusterresourceset_helpers.go @@ -32,8 +32,8 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" "sigs.k8s.io/cluster-api/util" utilresource "sigs.k8s.io/cluster-api/util/resource" utilyaml "sigs.k8s.io/cluster-api/util/yaml" diff --git a/exp/addons/controllers/clusterresourceset_helpers_test.go b/exp/addons/controllers/clusterresourceset_helpers_test.go index 4868b90d1dec..6331d8271184 100644 --- a/exp/addons/controllers/clusterresourceset_helpers_test.go +++ b/exp/addons/controllers/clusterresourceset_helpers_test.go @@ -27,8 +27,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) diff --git a/exp/addons/controllers/clusterresourcesetbinding_controller.go b/exp/addons/controllers/clusterresourcesetbinding_controller.go index 6556631acd26..7816b46aa973 100644 --- a/exp/addons/controllers/clusterresourcesetbinding_controller.go +++ b/exp/addons/controllers/clusterresourcesetbinding_controller.go @@ -21,8 +21,8 @@ import ( "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/predicates" ctrl "sigs.k8s.io/controller-runtime" diff --git a/exp/addons/controllers/predicates/resource_predicates.go b/exp/addons/controllers/predicates/resource_predicates.go index f872e8728996..82127e85da95 100644 --- a/exp/addons/controllers/predicates/resource_predicates.go +++ b/exp/addons/controllers/predicates/resource_predicates.go @@ -19,7 +19,7 @@ package predicates import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" ) diff --git a/exp/api/v1alpha3/doc.go b/exp/api/v1alpha3/doc.go new file mode 100644 index 000000000000..3311fd5c98a5 --- /dev/null +++ b/exp/api/v1alpha3/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 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. +*/ + +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/exp/api/v1alpha4 +package v1alpha3 diff --git a/exp/api/v1alpha3/groupversion_info.go b/exp/api/v1alpha3/groupversion_info.go index 832a031e9ff5..cbc5fa0716ce 100644 --- a/exp/api/v1alpha3/groupversion_info.go +++ b/exp/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/exp/api/v1alpha3/machinepool_types.go b/exp/api/v1alpha3/machinepool_types.go index b8d8b52cf67d..edcb101cf4c3 100644 --- a/exp/api/v1alpha3/machinepool_types.go +++ b/exp/api/v1alpha3/machinepool_types.go @@ -206,7 +206,6 @@ func (m *MachinePoolStatus) GetTypedPhase() MachinePoolPhase { // +kubebuilder:resource:path=machinepools,shortName=mp,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas -// +kubebuilder:storageversion // +kubebuilder:printcolumn:name="Replicas",type="string",JSONPath=".status.replicas",description="MachinePool replicas count" // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="MachinePool status such as Terminating/Pending/Provisioning/Running/Failed etc" // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachinePool" diff --git a/exp/api/v1alpha3/zz_generated.conversion.go b/exp/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..f4a4a9f24b05 --- /dev/null +++ b/exp/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,217 @@ +// +build !ignore_autogenerated_core_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 v1alpha3 + +import ( + unsafe "unsafe" + + v1 "k8s.io/api/core/v1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + errors "sigs.k8s.io/cluster-api/errors" + v1alpha4 "sigs.k8s.io/cluster-api/exp/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((*MachinePool)(nil), (*v1alpha4.MachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachinePool_To_v1alpha4_MachinePool(a.(*MachinePool), b.(*v1alpha4.MachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachinePool)(nil), (*MachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(a.(*v1alpha4.MachinePool), b.(*MachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachinePoolList)(nil), (*v1alpha4.MachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(a.(*MachinePoolList), b.(*v1alpha4.MachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachinePoolList)(nil), (*MachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList(a.(*v1alpha4.MachinePoolList), b.(*MachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachinePoolSpec)(nil), (*v1alpha4.MachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(a.(*MachinePoolSpec), b.(*v1alpha4.MachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachinePoolSpec)(nil), (*MachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(a.(*v1alpha4.MachinePoolSpec), b.(*MachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*MachinePoolStatus)(nil), (*v1alpha4.MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(a.(*MachinePoolStatus), b.(*v1alpha4.MachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.MachinePoolStatus)(nil), (*MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(a.(*v1alpha4.MachinePoolStatus), b.(*MachinePoolStatus), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_MachinePool_To_v1alpha4_MachinePool(in *MachinePool, out *v1alpha4.MachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_MachinePool_To_v1alpha4_MachinePool is an autogenerated conversion function. +func Convert_v1alpha3_MachinePool_To_v1alpha4_MachinePool(in *MachinePool, out *v1alpha4.MachinePool, s conversion.Scope) error { + return autoConvert_v1alpha3_MachinePool_To_v1alpha4_MachinePool(in, out, s) +} + +func autoConvert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(in *v1alpha4.MachinePool, out *MachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_MachinePool_To_v1alpha3_MachinePool is an autogenerated conversion function. +func Convert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(in *v1alpha4.MachinePool, out *MachinePool, s conversion.Scope) error { + return autoConvert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(in, out, s) +} + +func autoConvert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(in *MachinePoolList, out *v1alpha4.MachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.MachinePool)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList is an autogenerated conversion function. +func Convert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(in *MachinePoolList, out *v1alpha4.MachinePoolList, s conversion.Scope) error { + return autoConvert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(in, out, s) +} + +func autoConvert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList(in *v1alpha4.MachinePoolList, out *MachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]MachinePool)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList is an autogenerated conversion function. +func Convert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList(in *v1alpha4.MachinePoolList, out *MachinePoolList, s conversion.Scope) error { + return autoConvert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList(in, out, s) +} + +func autoConvert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in *MachinePoolSpec, out *v1alpha4.MachinePoolSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Template, &out.Template, 0); err != nil { + return err + } + out.Strategy = (*apiv1alpha4.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + out.FailureDomains = *(*[]string)(unsafe.Pointer(&in.FailureDomains)) + return nil +} + +// Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec is an autogenerated conversion function. +func Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in *MachinePoolSpec, out *v1alpha4.MachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in, out, s) +} + +func autoConvert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in *v1alpha4.MachinePoolSpec, out *MachinePoolSpec, s conversion.Scope) error { + out.ClusterName = in.ClusterName + out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&in.Template, &out.Template, 0); err != nil { + return err + } + out.Strategy = (*apiv1alpha3.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + out.FailureDomains = *(*[]string)(unsafe.Pointer(&in.FailureDomains)) + return nil +} + +// Convert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec is an autogenerated conversion function. +func Convert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in *v1alpha4.MachinePoolSpec, out *MachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in, out, s) +} + +func autoConvert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in *MachinePoolStatus, out *v1alpha4.MachinePoolStatus, s conversion.Scope) error { + out.NodeRefs = *(*[]v1.ObjectReference)(unsafe.Pointer(&in.NodeRefs)) + out.Replicas = in.Replicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.FailureReason = (*errors.MachinePoolStatusFailure)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*apiv1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus is an autogenerated conversion function. +func Convert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in *MachinePoolStatus, out *v1alpha4.MachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in, out, s) +} + +func autoConvert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in *v1alpha4.MachinePoolStatus, out *MachinePoolStatus, s conversion.Scope) error { + out.NodeRefs = *(*[]v1.ObjectReference)(unsafe.Pointer(&in.NodeRefs)) + out.Replicas = in.Replicas + out.ReadyReplicas = in.ReadyReplicas + out.AvailableReplicas = in.AvailableReplicas + out.UnavailableReplicas = in.UnavailableReplicas + out.FailureReason = (*errors.MachinePoolStatusFailure)(unsafe.Pointer(in.FailureReason)) + out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) + out.Phase = in.Phase + out.BootstrapReady = in.BootstrapReady + out.InfrastructureReady = in.InfrastructureReady + out.ObservedGeneration = in.ObservedGeneration + out.Conditions = *(*apiv1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + return nil +} + +// Convert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus is an autogenerated conversion function. +func Convert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in *v1alpha4.MachinePoolStatus, out *MachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in, out, s) +} diff --git a/exp/api/v1alpha4/condition_consts.go b/exp/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..7da5038f9848 --- /dev/null +++ b/exp/api/v1alpha4/condition_consts.go @@ -0,0 +1,30 @@ +/* +Copyright 2020 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 v1alpha4 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + +// Conditions and condition Reasons for the MachinePool object + +const ( + // ReplicasReadyCondition reports an aggregate of current status of the replicas controlled by the MachinePool. + ReplicasReadyCondition clusterv1.ConditionType = "ReplicasReady" + + // WaitingForReplicasReadyReason (Severity=Info) documents a machinepool waiting for the required replicas + // to be ready. + WaitingForReplicasReadyReason = "WaitingForReplicasReady" +) diff --git a/exp/api/v1alpha4/doc.go b/exp/api/v1alpha4/doc.go new file mode 100644 index 000000000000..b0efd4cde559 --- /dev/null +++ b/exp/api/v1alpha4/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2020 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 v1alpha4 diff --git a/exp/api/v1alpha4/groupversion_info.go b/exp/api/v1alpha4/groupversion_info.go new file mode 100644 index 000000000000..37538c19536e --- /dev/null +++ b/exp/api/v1alpha4/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 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 v1alpha4 contains API Schema definitions for the exp v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=exp.cluster.x-k8s.io +package v1alpha4 + +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: "exp.cluster.x-k8s.io", Version: "v1alpha4"} + + // 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 +) diff --git a/exp/api/v1alpha4/machinepool_types.go b/exp/api/v1alpha4/machinepool_types.go new file mode 100644 index 000000000000..06c4e5652c9a --- /dev/null +++ b/exp/api/v1alpha4/machinepool_types.go @@ -0,0 +1,243 @@ +/* +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 v1alpha4 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + capierrors "sigs.k8s.io/cluster-api/errors" +) + +const ( + // MachinePoolFinalizer is used to ensure deletion of dependencies (nodes, infra). + MachinePoolFinalizer = "machinepool.exp.cluster.x-k8s.io" +) + +// ANCHOR: MachinePoolSpec + +// MachinePoolSpec defines the desired state of MachinePool +type MachinePoolSpec struct { + // ClusterName is the name of the Cluster this object belongs to. + // +kubebuilder:validation:MinLength=1 + ClusterName string `json:"clusterName"` + + // Number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + + // Template describes the machines that will be created. + Template clusterv1.MachineTemplateSpec `json:"template"` + + // The deployment strategy to use to replace existing machine instances with + // new ones. + // +optional + Strategy *clusterv1.MachineDeploymentStrategy `json:"strategy,omitempty"` + + // Minimum number of seconds for which a newly created machine instances should + // be ready. + // Defaults to 0 (machine instance will be considered available as soon as it + // is ready) + // +optional + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + + // ProviderIDList are the identification IDs of machine instances provided by the provider. + // This field must match the provider IDs as seen on the node objects corresponding to a machine pool's machine instances. + // +optional + ProviderIDList []string `json:"providerIDList,omitempty"` + + // FailureDomains is the list of failure domains this MachinePool should be attached to. + FailureDomains []string `json:"failureDomains,omitempty"` +} + +// ANCHOR_END: MachinePoolSpec + +// ANCHOR: MachinePoolStatus + +// MachinePoolStatus defines the observed state of MachinePool +type MachinePoolStatus struct { + // NodeRefs will point to the corresponding Nodes if it they exist. + // +optional + NodeRefs []corev1.ObjectReference `json:"nodeRefs,omitempty"` + + // Replicas is the most recently observed number of replicas. + // +optional + Replicas int32 `json:"replicas"` + + // The number of ready replicas for this MachinePool. A machine is considered ready when the node has been created and is "Ready". + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // The number of available replicas (ready for at least minReadySeconds) for this MachinePool. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // Total number of unavailable machine instances targeted by this machine pool. + // This is the total number of machine instances that are still required for + // the machine pool to have 100% available capacity. They may either + // be machine instances that are running but not yet available or machine instances + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"` + + // FailureReason indicates that there is a problem reconciling the state, and + // will be set to a token value suitable for programmatic interpretation. + // +optional + FailureReason *capierrors.MachinePoolStatusFailure `json:"failureReason,omitempty"` + + // FailureMessage indicates that there is a problem reconciling the state, + // and will be set to a descriptive error message. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // Phase represents the current phase of cluster actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase string `json:"phase,omitempty"` + + // BootstrapReady is the state of the bootstrap provider. + // +optional + BootstrapReady bool `json:"bootstrapReady"` + + // InfrastructureReady is the state of the infrastructure provider. + // +optional + InfrastructureReady bool `json:"infrastructureReady"` + + // ObservedGeneration is the latest generation observed by the controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Conditions define the current service state of the MachinePool. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// ANCHOR_END: MachinePoolStatus + +// MachinePoolPhase is a string representation of a MachinePool Phase. +// +// This type is a high-level indicator of the status of the MachinePool as it is provisioned, +// from the API user’s perspective. +// +// The value should not be interpreted by any software components as a reliable indication +// of the actual state of the MachinePool, and controllers should not use the MachinePool Phase field +// value when making decisions about what action to take. +// +// Controllers should always look at the actual state of the MachinePool’s fields to make those decisions. +type MachinePoolPhase string + +const ( + // MachinePoolPhasePending is the first state a MachinePool is assigned by + // Cluster API MachinePool controller after being created. + MachinePoolPhasePending = MachinePoolPhase("Pending") + + // MachinePoolPhaseProvisioning is the state when the + // MachinePool infrastructure is being created or updated. + MachinePoolPhaseProvisioning = MachinePoolPhase("Provisioning") + + // MachinePoolPhaseProvisioned is the state when its + // infrastructure has been created and configured. + MachinePoolPhaseProvisioned = MachinePoolPhase("Provisioned") + + // MachinePoolPhaseRunning is the MachinePool state when its instances + // have become Kubernetes Nodes in the Ready state. + MachinePoolPhaseRunning = MachinePoolPhase("Running") + + // MachinePoolPhaseScalingUp is the MachinePool state when the + // MachinePool infrastructure is scaling up. + MachinePoolPhaseScalingUp = MachinePoolPhase("ScalingUp") + + // MachinePoolPhaseScalingDown is the MachinePool state when the + // MachinePool infrastructure is scaling down. + MachinePoolPhaseScalingDown = MachinePoolPhase("ScalingDown") + + // MachinePoolPhaseDeleting is the MachinePool state when a delete + // request has been sent to the API Server, + // but its infrastructure has not yet been fully deleted. + MachinePoolPhaseDeleting = MachinePoolPhase("Deleting") + + // MachinePoolPhaseFailed is the MachinePool state when the system + // might require user intervention. + MachinePoolPhaseFailed = MachinePoolPhase("Failed") + + // MachinePoolPhaseUnknown is returned if the MachinePool state cannot be determined. + MachinePoolPhaseUnknown = MachinePoolPhase("Unknown") +) + +// SetTypedPhase sets the Phase field to the string representation of MachinePoolPhase. +func (m *MachinePoolStatus) SetTypedPhase(p MachinePoolPhase) { + m.Phase = string(p) +} + +// GetTypedPhase attempts to parse the Phase field and return +// the typed MachinePoolPhase representation as described in `machinepool_phase_types.go`. +func (m *MachinePoolStatus) GetTypedPhase() MachinePoolPhase { + switch phase := MachinePoolPhase(m.Phase); phase { + case + MachinePoolPhasePending, + MachinePoolPhaseProvisioning, + MachinePoolPhaseProvisioned, + MachinePoolPhaseRunning, + MachinePoolPhaseScalingUp, + MachinePoolPhaseScalingDown, + MachinePoolPhaseDeleting, + MachinePoolPhaseFailed: + return phase + default: + return MachinePoolPhaseUnknown + } +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=machinepools,shortName=mp,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Replicas",type="string",JSONPath=".status.replicas",description="MachinePool replicas count" +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="MachinePool status such as Terminating/Pending/Provisioning/Running/Failed etc" +// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachinePool" +// +k8s:conversion-gen=false + +// MachinePool is the Schema for the machinepools API +type MachinePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachinePoolSpec `json:"spec,omitempty"` + Status MachinePoolStatus `json:"status,omitempty"` +} + +func (m *MachinePool) GetConditions() clusterv1.Conditions { + return m.Status.Conditions +} + +func (m *MachinePool) SetConditions(conditions clusterv1.Conditions) { + m.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// MachinePoolList contains a list of MachinePool +type MachinePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachinePool `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachinePool{}, &MachinePoolList{}) +} diff --git a/exp/api/v1alpha3/machinepool_webhook.go b/exp/api/v1alpha4/machinepool_webhook.go similarity index 92% rename from exp/api/v1alpha3/machinepool_webhook.go rename to exp/api/v1alpha4/machinepool_webhook.go index eb6f19e71234..4d9aedbcf67e 100644 --- a/exp/api/v1alpha3/machinepool_webhook.go +++ b/exp/api/v1alpha4/machinepool_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "fmt" @@ -24,7 +24,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" runtime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/webhook" ) @@ -35,8 +35,8 @@ func (m *MachinePool) SetupWebhookWithManager(mgr ctrl.Manager) error { Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-exp-cluster-x-k8s-io-v1alpha3-machinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=exp.cluster.x-k8s.io,resources=machinepools,versions=v1alpha3,name=validation.exp.machinepool.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 -// +kubebuilder:webhook:verbs=create;update,path=/mutate-exp-cluster-x-k8s-io-v1alpha3-machinepool,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=exp.cluster.x-k8s.io,resources=machinepools,versions=v1alpha3,name=default.exp.machinepool.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-exp-cluster-x-k8s-io-v1alpha4-machinepool,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=exp.cluster.x-k8s.io,resources=machinepools,versions=v1alpha4,name=validation.exp.machinepool.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/mutate-exp-cluster-x-k8s-io-v1alpha4-machinepool,mutating=true,failurePolicy=fail,matchPolicy=Equivalent,groups=exp.cluster.x-k8s.io,resources=machinepools,versions=v1alpha4,name=default.exp.machinepool.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Defaulter = &MachinePool{} var _ webhook.Validator = &MachinePool{} diff --git a/exp/api/v1alpha3/machinepool_webhook_test.go b/exp/api/v1alpha4/machinepool_webhook_test.go similarity index 98% rename from exp/api/v1alpha3/machinepool_webhook_test.go rename to exp/api/v1alpha4/machinepool_webhook_test.go index 4f2360ffd7ae..82fa1f7c5006 100644 --- a/exp/api/v1alpha3/machinepool_webhook_test.go +++ b/exp/api/v1alpha4/machinepool_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" @@ -24,7 +24,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestMachinePoolDefault(t *testing.T) { diff --git a/exp/api/v1alpha4/zz_generated.deepcopy.go b/exp/api/v1alpha4/zz_generated.deepcopy.go new file mode 100644 index 000000000000..fb29fc56c782 --- /dev/null +++ b/exp/api/v1alpha4/zz_generated.deepcopy.go @@ -0,0 +1,165 @@ +// +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 v1alpha4 + +import ( + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/runtime" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + "sigs.k8s.io/cluster-api/errors" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachinePool) DeepCopyInto(out *MachinePool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePool. +func (in *MachinePool) DeepCopy() *MachinePool { + if in == nil { + return nil + } + out := new(MachinePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachinePool) 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 *MachinePoolList) DeepCopyInto(out *MachinePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachinePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePoolList. +func (in *MachinePoolList) DeepCopy() *MachinePoolList { + if in == nil { + return nil + } + out := new(MachinePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachinePoolList) 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 *MachinePoolSpec) DeepCopyInto(out *MachinePoolSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Template.DeepCopyInto(&out.Template) + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + *out = new(apiv1alpha4.MachineDeploymentStrategy) + (*in).DeepCopyInto(*out) + } + if in.MinReadySeconds != nil { + in, out := &in.MinReadySeconds, &out.MinReadySeconds + *out = new(int32) + **out = **in + } + if in.ProviderIDList != nil { + in, out := &in.ProviderIDList, &out.ProviderIDList + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePoolSpec. +func (in *MachinePoolSpec) DeepCopy() *MachinePoolSpec { + if in == nil { + return nil + } + out := new(MachinePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachinePoolStatus) DeepCopyInto(out *MachinePoolStatus) { + *out = *in + if in.NodeRefs != nil { + in, out := &in.NodeRefs, &out.NodeRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachinePoolStatusFailure) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePoolStatus. +func (in *MachinePoolStatus) DeepCopy() *MachinePoolStatus { + if in == nil { + return nil + } + out := new(MachinePoolStatus) + in.DeepCopyInto(out) + return out +} diff --git a/exp/controllers/machinepool_controller.go b/exp/controllers/machinepool_controller.go index f3805cdc140c..ddc416ec2b94 100644 --- a/exp/controllers/machinepool_controller.go +++ b/exp/controllers/machinepool_controller.go @@ -28,10 +28,10 @@ import ( kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/rest" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/controllers/remote" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/exp/controllers/machinepool_controller_noderef.go b/exp/controllers/machinepool_controller_noderef.go index 54fd611874a1..30f6fad23e43 100644 --- a/exp/controllers/machinepool_controller_noderef.go +++ b/exp/controllers/machinepool_controller_noderef.go @@ -26,10 +26,10 @@ import ( "github.com/pkg/errors" apicorev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/noderefutil" "sigs.k8s.io/cluster-api/controllers/remote" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/exp/controllers/machinepool_controller_noderef_test.go b/exp/controllers/machinepool_controller_noderef_test.go index 1a844a4cc9b6..1474f932dd7f 100644 --- a/exp/controllers/machinepool_controller_noderef_test.go +++ b/exp/controllers/machinepool_controller_noderef_test.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestMachinePoolGetNodeReference(t *testing.T) { diff --git a/exp/controllers/machinepool_controller_phases.go b/exp/controllers/machinepool_controller_phases.go index 929a17447d93..faf417dcee8a 100644 --- a/exp/controllers/machinepool_controller_phases.go +++ b/exp/controllers/machinepool_controller_phases.go @@ -31,10 +31,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" capierrors "sigs.k8s.io/cluster-api/errors" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" diff --git a/exp/controllers/machinepool_controller_phases_test.go b/exp/controllers/machinepool_controller_phases_test.go index 6589639f56f6..9744c247e6b3 100644 --- a/exp/controllers/machinepool_controller_phases_test.go +++ b/exp/controllers/machinepool_controller_phases_test.go @@ -29,8 +29,8 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util/kubeconfig" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -63,13 +63,13 @@ var _ = Describe("Reconcile MachinePool Phases", func() { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -81,7 +81,7 @@ var _ = Describe("Reconcile MachinePool Phases", func() { defaultBootstrap := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -94,7 +94,7 @@ var _ = Describe("Reconcile MachinePool Phases", func() { defaultInfra := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -458,7 +458,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, @@ -487,7 +487,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "new machinepool, bootstrap config ready with data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -509,7 +509,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "new machinepool, bootstrap config ready with no data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -529,7 +529,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "new machinepool, bootstrap config not ready", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -547,7 +547,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "new machinepool, bootstrap config is not found", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "wrong-namespace", @@ -564,7 +564,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "new machinepool, no bootstrap config or data", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "wrong-namespace", @@ -578,7 +578,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "existing machinepool, bootstrap data should not change", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -599,7 +599,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, @@ -622,7 +622,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { name: "existing machinepool, bootstrap provider is to not ready", bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -643,7 +643,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, @@ -708,13 +708,13 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -744,7 +744,7 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { name: "new machinepool, infrastructure config ready", infraConfig: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -787,13 +787,13 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap-config1", }, }, InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -808,7 +808,7 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { }, bootstrapConfig: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap-config1", "namespace": "default", @@ -821,7 +821,7 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { }, infraConfig: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{}, }, expectError: true, @@ -837,7 +837,7 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) { name: "infrastructure ref is paused", infraConfig: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", diff --git a/exp/controllers/machinepool_controller_test.go b/exp/controllers/machinepool_controller_test.go index 8aaf1afaf6a1..4531aa68d243 100644 --- a/exp/controllers/machinepool_controller_test.go +++ b/exp/controllers/machinepool_controller_test.go @@ -26,8 +26,8 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/test/helpers" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" @@ -258,7 +258,7 @@ func TestReconcileMachinePoolRequest(t *testing.T) { infraConfig := unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra-config1", "namespace": "default", @@ -290,7 +290,7 @@ func TestReconcileMachinePoolRequest(t *testing.T) { bootstrapConfig := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "test-bootstrap", "namespace": "default", @@ -321,7 +321,7 @@ func TestReconcileMachinePoolRequest(t *testing.T) { Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -357,7 +357,7 @@ func TestReconcileMachinePoolRequest(t *testing.T) { Template: clusterv1.MachineTemplateSpec{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -396,7 +396,7 @@ func TestReconcileMachinePoolRequest(t *testing.T) { Template: clusterv1.MachineTemplateSpec{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -450,7 +450,7 @@ func TestReconcileMachinePoolDeleteExternal(t *testing.T) { bootstrapConfig := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "delete-bootstrap", "namespace": "default", @@ -461,7 +461,7 @@ func TestReconcileMachinePoolDeleteExternal(t *testing.T) { infraConfig := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "delete-infra", "namespace": "default", @@ -480,13 +480,13 @@ func TestReconcileMachinePoolDeleteExternal(t *testing.T) { Template: clusterv1.MachineTemplateSpec{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "delete-infra", }, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "delete-bootstrap", }, @@ -588,7 +588,7 @@ func TestRemoveMachinePoolFinalizerAfterDeleteReconcile(t *testing.T) { Template: clusterv1.MachineTemplateSpec{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra-config1", }, @@ -619,7 +619,7 @@ func TestMachinePoolConditions(t *testing.T) { return &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapConfig", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "bootstrap1", "namespace": "default", @@ -636,7 +636,7 @@ func TestMachinePoolConditions(t *testing.T) { return &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "InfrastructureConfig", - "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha3", + "apiVersion": "infrastructure.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "name": "infra1", "namespace": "default", @@ -666,13 +666,13 @@ func TestMachinePoolConditions(t *testing.T) { Template: clusterv1.MachineTemplateSpec{ Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha3", + APIVersion: "infrastructure.cluster.x-k8s.io/v1alpha4", Kind: "InfrastructureConfig", Name: "infra1", }, Bootstrap: clusterv1.Bootstrap{ ConfigRef: &corev1.ObjectReference{ - APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha3", + APIVersion: "bootstrap.cluster.x-k8s.io/v1alpha4", Kind: "BootstrapConfig", Name: "bootstrap1", }, diff --git a/exp/util/util.go b/exp/util/util.go index 73889df40f9c..e175e7bd5e12 100644 --- a/exp/util/util.go +++ b/exp/util/util.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/reconcile" diff --git a/main.go b/main.go index a6562ef7291c..34f7ccb2dde0 100644 --- a/main.go +++ b/main.go @@ -30,14 +30,13 @@ import ( clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/klog" "k8s.io/klog/klogr" - clusterv1alpha2 "sigs.k8s.io/cluster-api/api/v1alpha2" - clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/cmd/version" "sigs.k8s.io/cluster-api/controllers" "sigs.k8s.io/cluster-api/controllers/remote" - addonsv1alpha3 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" addonscontrollers "sigs.k8s.io/cluster-api/exp/addons/controllers" - expv1alpha3 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" expcontrollers "sigs.k8s.io/cluster-api/exp/controllers" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util" @@ -75,10 +74,9 @@ func init() { klog.InitFlags(nil) _ = clientgoscheme.AddToScheme(scheme) - _ = clusterv1alpha2.AddToScheme(scheme) - _ = clusterv1alpha3.AddToScheme(scheme) - _ = expv1alpha3.AddToScheme(scheme) - _ = addonsv1alpha3.AddToScheme(scheme) + _ = clusterv1.AddToScheme(scheme) + _ = expv1.AddToScheme(scheme) + _ = addonsv1.AddToScheme(scheme) _ = apiextensionsv1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -291,77 +289,41 @@ func setupWebhooks(mgr ctrl.Manager) { return } - if err := (&clusterv1alpha2.Cluster{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&clusterv1.Cluster{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Cluster") os.Exit(1) } - if err := (&clusterv1alpha3.Cluster{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Cluster") - os.Exit(1) - } - - if err := (&clusterv1alpha2.ClusterList{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "ClusterList") - os.Exit(1) - } - if err := (&clusterv1alpha2.Machine{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&clusterv1.Machine{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "Machine") os.Exit(1) } - if err := (&clusterv1alpha3.Machine{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "Machine") - os.Exit(1) - } - - if err := (&clusterv1alpha2.MachineList{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "MachineList") - os.Exit(1) - } - if err := (&clusterv1alpha2.MachineSet{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&clusterv1.MachineSet{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "MachineSet") os.Exit(1) } - if err := (&clusterv1alpha3.MachineSet{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "MachineSet") - os.Exit(1) - } - - if err := (&clusterv1alpha2.MachineSetList{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "MachineSetList") - os.Exit(1) - } - if err := (&clusterv1alpha2.MachineDeployment{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&clusterv1.MachineDeployment{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "MachineDeployment") os.Exit(1) } - if err := (&clusterv1alpha3.MachineDeployment{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "MachineDeployment") - os.Exit(1) - } - - if err := (&clusterv1alpha2.MachineDeploymentList{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "MachineDeploymentList") - os.Exit(1) - } if feature.Gates.Enabled(feature.MachinePool) { - if err := (&expv1alpha3.MachinePool{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&expv1.MachinePool{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "MachinePool") os.Exit(1) } } if feature.Gates.Enabled(feature.ClusterResourceSet) { - if err := (&addonsv1alpha3.ClusterResourceSet{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&addonsv1.ClusterResourceSet{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "ClusterResourceSet") os.Exit(1) } } - if err := (&clusterv1alpha3.MachineHealthCheck{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&clusterv1.MachineHealthCheck{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "MachineHealthCheck") os.Exit(1) } diff --git a/test/e2e/common.go b/test/e2e/common.go index 896a1d9f6d92..709f4172a365 100644 --- a/test/e2e/common.go +++ b/test/e2e/common.go @@ -26,7 +26,7 @@ import ( "github.com/blang/semver" "github.com/onsi/gomega/types" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/util" ) diff --git a/test/e2e/data/infrastructure-docker/bases/cluster-with-kcp.yaml b/test/e2e/data/infrastructure-docker/bases/cluster-with-kcp.yaml index 5fb45f7a77ea..c9fb94dc6f5a 100644 --- a/test/e2e/data/infrastructure-docker/bases/cluster-with-kcp.yaml +++ b/test/e2e/data/infrastructure-docker/bases/cluster-with-kcp.yaml @@ -1,6 +1,6 @@ --- # DockerCluster object referenced by the Cluster object -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerCluster metadata: name: '${CLUSTER_NAME}' @@ -8,7 +8,7 @@ metadata: # Cluster object with # - Reference to the KubeadmControlPlane object # - the label cni=${CLUSTER_NAME}-crs-0, so the cluster can be selected by the ClusterResourceSet. -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1alpha4 kind: Cluster metadata: name: '${CLUSTER_NAME}' @@ -22,16 +22,16 @@ spec: cidrBlocks: ['${DOCKER_POD_CIDRS}'] serviceDomain: '${DOCKER_SERVICE_DOMAIN}' infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerCluster name: '${CLUSTER_NAME}' controlPlaneRef: kind: KubeadmControlPlane - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 name: "${CLUSTER_NAME}-control-plane" --- # DockerMachineTemplate object referenced by the KubeadmControlPlane object -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachineTemplate metadata: name: "${CLUSTER_NAME}-control-plane" @@ -45,7 +45,7 @@ spec: # KubeadmControlPlane referenced by the Cluster object with # - the label kcp-adoption.step2, because it should be created in the second step of the kcp-adoption test. kind: KubeadmControlPlane -apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +apiVersion: controlplane.cluster.x-k8s.io/v1alpha4 metadata: name: "${CLUSTER_NAME}-control-plane" labels: @@ -54,7 +54,7 @@ spec: replicas: ${CONTROL_PLANE_MACHINE_COUNT} infrastructureTemplate: kind: DockerMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 name: "${CLUSTER_NAME}-control-plane" kubeadmConfigSpec: clusterConfiguration: diff --git a/test/e2e/data/infrastructure-docker/bases/crs.yaml b/test/e2e/data/infrastructure-docker/bases/crs.yaml index d88867d1ddb1..7f8f9f9d46e1 100644 --- a/test/e2e/data/infrastructure-docker/bases/crs.yaml +++ b/test/e2e/data/infrastructure-docker/bases/crs.yaml @@ -10,7 +10,7 @@ binaryData: --- # ClusterResourceSet object with # a selector that targets all the Cluster with label cni=${CLUSTER_NAME}-crs-0 -apiVersion: addons.cluster.x-k8s.io/v1alpha3 +apiVersion: addons.cluster.x-k8s.io/v1alpha4 kind: ClusterResourceSet metadata: name: "${CLUSTER_NAME}-crs-0" diff --git a/test/e2e/data/infrastructure-docker/bases/md.yaml b/test/e2e/data/infrastructure-docker/bases/md.yaml index 5cef10112881..32a541c61301 100644 --- a/test/e2e/data/infrastructure-docker/bases/md.yaml +++ b/test/e2e/data/infrastructure-docker/bases/md.yaml @@ -1,7 +1,7 @@ --- # DockerMachineTemplate referenced by the MachineDeployment and with # - extraMounts for the docker sock, thus allowing self-hosting test -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -13,7 +13,7 @@ spec: hostPath: "/var/run/docker.sock" --- # KubeadmConfigTemplate referenced by the MachineDeployment -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfigTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -27,7 +27,7 @@ spec: --- # MachineDeployment object with # - the label nodepool=pool1 that applies to all the machines, so those machine can be targeted by the MachineHealthCheck object -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1alpha4 kind: MachineDeployment metadata: name: "${CLUSTER_NAME}-md-0" @@ -46,9 +46,9 @@ spec: bootstrap: configRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfigTemplate infrastructureRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachineTemplate diff --git a/test/e2e/data/infrastructure-docker/bases/mhc.yaml b/test/e2e/data/infrastructure-docker/bases/mhc.yaml index 34dd68ec7afe..693a75ab11d6 100644 --- a/test/e2e/data/infrastructure-docker/bases/mhc.yaml +++ b/test/e2e/data/infrastructure-docker/bases/mhc.yaml @@ -2,7 +2,7 @@ # MachineHealthCheck object with # - a selector that targets all the machines with label nodepool=pool1 # - unhealthyConditions triggering remediation after 30s the node is up (because it is testing a condition that does not exists) -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1alpha4 kind: MachineHealthCheck metadata: name: "${CLUSTER_NAME}-mhc-0" diff --git a/test/e2e/data/infrastructure-docker/bases/mp.yaml b/test/e2e/data/infrastructure-docker/bases/mp.yaml index 44249ad2b9b7..b2229d78d184 100644 --- a/test/e2e/data/infrastructure-docker/bases/mp.yaml +++ b/test/e2e/data/infrastructure-docker/bases/mp.yaml @@ -1,6 +1,6 @@ --- # MachinePool which references the DockerMachinePool and KubeadmConfigTemplate below -apiVersion: exp.cluster.x-k8s.io/v1alpha3 +apiVersion: exp.cluster.x-k8s.io/v1alpha4 kind: MachinePool metadata: name: "${CLUSTER_NAME}-mp-0" @@ -11,24 +11,24 @@ spec: spec: bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfig name: "${CLUSTER_NAME}-mp-0-config" clusterName: '${CLUSTER_NAME}' infrastructureRef: - apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachinePool name: "${CLUSTER_NAME}-dmp-0" version: "${KUBERNETES_VERSION}" --- # DockerMachinePool using default values referenced by the MachinePool -apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: exp.infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachinePool metadata: name: "${CLUSTER_NAME}-dmp-0" --- # KubeadmConfigTemplate referenced by the MachinePool -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfig metadata: name: "${CLUSTER_NAME}-mp-0-config" diff --git a/test/e2e/data/infrastructure-docker/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml b/test/e2e/data/infrastructure-docker/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml index beaf11f91398..fbbfac3d1007 100644 --- a/test/e2e/data/infrastructure-docker/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml +++ b/test/e2e/data/infrastructure-docker/cluster-template-kcp-adoption/step1/cluster-with-cp0.yaml @@ -1,6 +1,6 @@ --- # DockerCluster object referenced by the Cluster object -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerCluster metadata: name: '${CLUSTER_NAME}' @@ -8,7 +8,7 @@ metadata: # Cluster object with # - No reference to the KubeadmControlPlane object # - the label cni=${CLUSTER_NAME}-crs-0, so the cluster can be selected by the ClusterResourceSet. -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1alpha4 kind: Cluster metadata: name: '${CLUSTER_NAME}' @@ -22,19 +22,19 @@ spec: cidrBlocks: ['${DOCKER_POD_CIDRS}'] serviceDomain: '${DOCKER_SERVICE_DOMAIN}' infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerCluster name: '${CLUSTER_NAME}' --- # DockerMachine referenced by the Machine cp0 -apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachine metadata: name: "${CLUSTER_NAME}-control-plane-0" spec: {} --- # KubeadmConfig referenced by the Machine cp0 -apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfig metadata: name: "${CLUSTER_NAME}-control-plane-0" @@ -54,7 +54,7 @@ spec: kubeletExtraArgs: {eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'} --- # cp0 Machine -apiVersion: cluster.x-k8s.io/v1alpha3 +apiVersion: cluster.x-k8s.io/v1alpha4 kind: Machine metadata: name: "${CLUSTER_NAME}-control-plane-0" @@ -66,9 +66,9 @@ spec: bootstrap: configRef: name: "${ CLUSTER_NAME }-control-plane-0" - apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4 kind: KubeadmConfig infrastructureRef: name: "${ CLUSTER_NAME }-control-plane-0" - apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4 kind: DockerMachine diff --git a/test/e2e/kcp_adoption.go b/test/e2e/kcp_adoption.go index 2942c89fb65f..9824b74e9b3f 100644 --- a/test/e2e/kcp_adoption.go +++ b/test/e2e/kcp_adoption.go @@ -26,14 +26,14 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/clusterctl" "sigs.k8s.io/cluster-api/util" diff --git a/test/e2e/self_hosted.go b/test/e2e/self_hosted.go index e16741705f1d..c8cece53ce49 100644 --- a/test/e2e/self_hosted.go +++ b/test/e2e/self_hosted.go @@ -28,7 +28,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/e2e/internal/log" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/bootstrap" diff --git a/test/framework/alltypes_helpers.go b/test/framework/alltypes_helpers.go index a42d4ec28e2e..479194f1d87c 100644 --- a/test/framework/alltypes_helpers.go +++ b/test/framework/alltypes_helpers.go @@ -34,7 +34,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" ) diff --git a/test/framework/cluster_helpers.go b/test/framework/cluster_helpers.go index 91c3eeabb46e..d1f90fbccbc8 100644 --- a/test/framework/cluster_helpers.go +++ b/test/framework/cluster_helpers.go @@ -24,7 +24,7 @@ import ( . "github.com/onsi/gomega" apierrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework/internal/log" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/test/framework/cluster_proxy.go b/test/framework/cluster_proxy.go index 2a343fac3e1c..6ca701706cb0 100644 --- a/test/framework/cluster_proxy.go +++ b/test/framework/cluster_proxy.go @@ -34,7 +34,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework/exec" "sigs.k8s.io/cluster-api/test/framework/internal/log" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/test/framework/clusterctl/clusterctl_helpers.go b/test/framework/clusterctl/clusterctl_helpers.go index 63af9bb5265a..3d5b46fe291e 100644 --- a/test/framework/clusterctl/clusterctl_helpers.go +++ b/test/framework/clusterctl/clusterctl_helpers.go @@ -24,10 +24,10 @@ import ( . "github.com/onsi/gomega" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/cmd/clusterctl/client/config" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" + clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/cluster-api/test/framework/internal/log" ) diff --git a/test/framework/clusterresourceset_helpers.go b/test/framework/clusterresourceset_helpers.go index f62660cd4f2e..3ff6600721af 100644 --- a/test/framework/clusterresourceset_helpers.go +++ b/test/framework/clusterresourceset_helpers.go @@ -25,8 +25,8 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/test/framework/control_plane.go b/test/framework/control_plane.go index 941c426891ec..dcac765f1e2e 100644 --- a/test/framework/control_plane.go +++ b/test/framework/control_plane.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/test/framework/controlplane_helpers.go b/test/framework/controlplane_helpers.go index 4924ad90fed6..0c5d43207a6f 100644 --- a/test/framework/controlplane_helpers.go +++ b/test/framework/controlplane_helpers.go @@ -23,9 +23,9 @@ import ( . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/labels" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework/internal/log" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/test/framework/convenience.go b/test/framework/convenience.go index e59de5623c9e..10efcb6a1c11 100644 --- a/test/framework/convenience.go +++ b/test/framework/convenience.go @@ -25,10 +25,10 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" apiextensionsv1beta "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" ) // TryAddDefaultSchemes tries to add the following schemes: diff --git a/test/framework/docker_logcollector.go b/test/framework/docker_logcollector.go index 78fdbe06a1b8..07dfa1d80389 100644 --- a/test/framework/docker_logcollector.go +++ b/test/framework/docker_logcollector.go @@ -23,7 +23,7 @@ import ( "path/filepath" "strings" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/kind/pkg/errors" "sigs.k8s.io/kind/pkg/exec" diff --git a/test/framework/kubernetesversions/template.go b/test/framework/kubernetesversions/template.go index 8a535ecffe6e..0f7453e245c5 100644 --- a/test/framework/kubernetesversions/template.go +++ b/test/framework/kubernetesversions/template.go @@ -24,8 +24,8 @@ import ( "path" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" - kcpv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" + cabpkv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" + kcpv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework" "sigs.k8s.io/yaml" ) diff --git a/test/framework/machine_helpers.go b/test/framework/machine_helpers.go index 913f87e83510..ac56ec85fab9 100644 --- a/test/framework/machine_helpers.go +++ b/test/framework/machine_helpers.go @@ -26,7 +26,7 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework/internal/log" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/test/framework/machinedeployment_helpers.go b/test/framework/machinedeployment_helpers.go index a89d0d10ddc7..bd7f7844b391 100644 --- a/test/framework/machinedeployment_helpers.go +++ b/test/framework/machinedeployment_helpers.go @@ -27,7 +27,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/test/framework/internal/log" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/patch" diff --git a/test/framework/machinehealthcheck_helpers.go b/test/framework/machinehealthcheck_helpers.go index 03e18b9ec916..55bc490acee4 100644 --- a/test/framework/machinehealthcheck_helpers.go +++ b/test/framework/machinehealthcheck_helpers.go @@ -27,7 +27,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/test/framework/machinepool_helpers.go b/test/framework/machinepool_helpers.go index efb7f754fb35..d3d52ee60493 100644 --- a/test/framework/machinepool_helpers.go +++ b/test/framework/machinepool_helpers.go @@ -27,8 +27,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/test/framework/machines.go b/test/framework/machines.go index 8c12109dc692..102d88bbad4b 100644 --- a/test/framework/machines.go +++ b/test/framework/machines.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/test/helpers/envtest.go b/test/helpers/envtest.go index 8ac8d606a53c..6e3034518c82 100644 --- a/test/helpers/envtest.go +++ b/test/helpers/envtest.go @@ -40,14 +40,14 @@ import ( "k8s.io/client-go/rest" "k8s.io/klog" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/cmd/clusterctl/log" "sigs.k8s.io/cluster-api/controllers/external" - kcpv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha3" - addonv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" - crs "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha3" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + kcpv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1alpha4" + addonv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" + crs "sigs.k8s.io/cluster-api/exp/addons/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/kubeconfig" utilyaml "sigs.k8s.io/cluster-api/util/yaml" @@ -256,7 +256,7 @@ func initializeWebhookInEnvironment() { } mutatingWebhooks, validatingWebhooks, err = appendWebhookConfiguration(mutatingWebhooks, validatingWebhooks, controlplaneyamlFile, "cp") if err != nil { - klog.Fatalf("Failed to append cocontrolplane controller webhook config: %v", err) + klog.Fatalf("Failed to append controlplane controller webhook config: %v", err) } env.WebhookInstallOptions = envtest.WebhookInstallOptions{ MaxTime: 20 * time.Second, diff --git a/test/infrastructure/docker/Makefile b/test/infrastructure/docker/Makefile index f3e170f87f9f..c9e782271258 100644 --- a/test/infrastructure/docker/Makefile +++ b/test/infrastructure/docker/Makefile @@ -111,8 +111,12 @@ generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate tar object:headerFile=$(ROOT)/hack/boilerplate/boilerplate.generatego.txt \ paths=./api/... \ paths=./$(EXP_DIR)/api/... + (IFS=','; for i in "./api/v1alpha3,./$(EXP_DIR)/api/v1alpha3"; do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done) $(CONVERSION_GEN) \ --input-dirs=./api/v1alpha3 \ + --input-dirs=./$(EXP_DIR)/api/v1alpha3 \ + --build-tag=ignore_autogenerated_capd_v1alpha3 \ + --extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \ --output-file-base=zz_generated.conversion \ --go-header-file=$(ROOT)/hack/boilerplate/boilerplate.generatego.txt diff --git a/test/infrastructure/docker/PROJECT b/test/infrastructure/docker/PROJECT index 548d3447a4f1..a7a1716cd820 100644 --- a/test/infrastructure/docker/PROJECT +++ b/test/infrastructure/docker/PROJECT @@ -8,3 +8,9 @@ resources: - group: infrastructure version: v1alpha3 kind: DockerMachine +- group: infrastructure + version: v1alpha4 + kind: DockerCluster +- group: infrastructure + version: v1alpha4 + kind: DockerMachine diff --git a/test/infrastructure/docker/api/v1alpha3/doc.go b/test/infrastructure/docker/api/v1alpha3/doc.go new file mode 100644 index 000000000000..7b2307144a62 --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha3/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 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. +*/ + +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4 +package v1alpha3 diff --git a/test/infrastructure/docker/api/v1alpha3/dockercluster_types.go b/test/infrastructure/docker/api/v1alpha3/dockercluster_types.go index 78a29cf4f4b0..089676a06d83 100644 --- a/test/infrastructure/docker/api/v1alpha3/dockercluster_types.go +++ b/test/infrastructure/docker/api/v1alpha3/dockercluster_types.go @@ -69,7 +69,6 @@ type APIEndpoint struct { // +kubebuilder:resource:path=dockerclusters,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +kubebuilder:object:root=true // DockerCluster is the Schema for the dockerclusters API diff --git a/test/infrastructure/docker/api/v1alpha3/dockermachine_types.go b/test/infrastructure/docker/api/v1alpha3/dockermachine_types.go index 8fb81a1187c1..dfb5e461099e 100644 --- a/test/infrastructure/docker/api/v1alpha3/dockermachine_types.go +++ b/test/infrastructure/docker/api/v1alpha3/dockermachine_types.go @@ -92,7 +92,6 @@ type DockerMachineStatus struct { // +kubebuilder:resource:path=dockermachines,scope=Namespaced,categories=cluster-api // +kubebuilder:object:root=true -// +kubebuilder:storageversion // +kubebuilder:subresource:status // DockerMachine is the Schema for the dockermachines API diff --git a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_types.go b/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_types.go index 07be3a7596a0..d83a7b8a6ed3 100644 --- a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_types.go +++ b/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_types.go @@ -27,7 +27,6 @@ type DockerMachineTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:path=dockermachinetemplates,scope=Namespaced,categories=cluster-api -// +kubebuilder:storageversion // DockerMachineTemplate is the Schema for the dockermachinetemplates API type DockerMachineTemplate struct { diff --git a/test/infrastructure/docker/api/v1alpha3/groupversion_info.go b/test/infrastructure/docker/api/v1alpha3/groupversion_info.go index b6614ac16396..5a602374212d 100644 --- a/test/infrastructure/docker/api/v1alpha3/groupversion_info.go +++ b/test/infrastructure/docker/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..6edba55eea91 --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,683 @@ +// +build !ignore_autogenerated_capd_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 v1alpha3 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + v1alpha4 "sigs.k8s.io/cluster-api/test/infrastructure/docker/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_v1alpha3_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_v1alpha3_APIEndpoint(a.(*v1alpha4.APIEndpoint), b.(*APIEndpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerCluster)(nil), (*v1alpha4.DockerCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster(a.(*DockerCluster), b.(*v1alpha4.DockerCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerCluster)(nil), (*DockerCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster(a.(*v1alpha4.DockerCluster), b.(*DockerCluster), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerClusterList)(nil), (*v1alpha4.DockerClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerClusterList_To_v1alpha4_DockerClusterList(a.(*DockerClusterList), b.(*v1alpha4.DockerClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerClusterList)(nil), (*DockerClusterList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerClusterList_To_v1alpha3_DockerClusterList(a.(*v1alpha4.DockerClusterList), b.(*DockerClusterList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerClusterSpec)(nil), (*v1alpha4.DockerClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec(a.(*DockerClusterSpec), b.(*v1alpha4.DockerClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerClusterSpec)(nil), (*DockerClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec(a.(*v1alpha4.DockerClusterSpec), b.(*DockerClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerClusterStatus)(nil), (*v1alpha4.DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(a.(*DockerClusterStatus), b.(*v1alpha4.DockerClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerClusterStatus)(nil), (*DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(a.(*v1alpha4.DockerClusterStatus), b.(*DockerClusterStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachine)(nil), (*v1alpha4.DockerMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine(a.(*DockerMachine), b.(*v1alpha4.DockerMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachine)(nil), (*DockerMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine(a.(*v1alpha4.DockerMachine), b.(*DockerMachine), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineList)(nil), (*v1alpha4.DockerMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineList_To_v1alpha4_DockerMachineList(a.(*DockerMachineList), b.(*v1alpha4.DockerMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineList)(nil), (*DockerMachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineList_To_v1alpha3_DockerMachineList(a.(*v1alpha4.DockerMachineList), b.(*DockerMachineList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineSpec)(nil), (*v1alpha4.DockerMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(a.(*DockerMachineSpec), b.(*v1alpha4.DockerMachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineSpec)(nil), (*DockerMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(a.(*v1alpha4.DockerMachineSpec), b.(*DockerMachineSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineStatus)(nil), (*v1alpha4.DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(a.(*DockerMachineStatus), b.(*v1alpha4.DockerMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineStatus)(nil), (*DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(a.(*v1alpha4.DockerMachineStatus), b.(*DockerMachineStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineTemplate)(nil), (*v1alpha4.DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(a.(*DockerMachineTemplate), b.(*v1alpha4.DockerMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineTemplate)(nil), (*DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(a.(*v1alpha4.DockerMachineTemplate), b.(*DockerMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineTemplateList)(nil), (*v1alpha4.DockerMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineTemplateList_To_v1alpha4_DockerMachineTemplateList(a.(*DockerMachineTemplateList), b.(*v1alpha4.DockerMachineTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineTemplateList)(nil), (*DockerMachineTemplateList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineTemplateList_To_v1alpha3_DockerMachineTemplateList(a.(*v1alpha4.DockerMachineTemplateList), b.(*DockerMachineTemplateList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineTemplateResource)(nil), (*v1alpha4.DockerMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(a.(*DockerMachineTemplateResource), b.(*v1alpha4.DockerMachineTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineTemplateResource)(nil), (*DockerMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(a.(*v1alpha4.DockerMachineTemplateResource), b.(*DockerMachineTemplateResource), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineTemplateSpec)(nil), (*v1alpha4.DockerMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec(a.(*DockerMachineTemplateSpec), b.(*v1alpha4.DockerMachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineTemplateSpec)(nil), (*DockerMachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec(a.(*v1alpha4.DockerMachineTemplateSpec), b.(*DockerMachineTemplateSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Mount)(nil), (*v1alpha4.Mount)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Mount_To_v1alpha4_Mount(a.(*Mount), b.(*v1alpha4.Mount), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.Mount)(nil), (*Mount)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_Mount_To_v1alpha3_Mount(a.(*v1alpha4.Mount), b.(*Mount), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = in.Port + return nil +} + +// Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in *APIEndpoint, out *v1alpha4.APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + out.Host = in.Host + out.Port = in.Port + return nil +} + +// Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint is an autogenerated conversion function. +func Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1alpha4.APIEndpoint, out *APIEndpoint, s conversion.Scope) error { + return autoConvert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in, out, s) +} + +func autoConvert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster(in *DockerCluster, out *v1alpha4.DockerCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster is an autogenerated conversion function. +func Convert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster(in *DockerCluster, out *v1alpha4.DockerCluster, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster(in, out, s) +} + +func autoConvert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster(in *v1alpha4.DockerCluster, out *DockerCluster, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster is an autogenerated conversion function. +func Convert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster(in *v1alpha4.DockerCluster, out *DockerCluster, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster(in, out, s) +} + +func autoConvert_v1alpha3_DockerClusterList_To_v1alpha4_DockerClusterList(in *DockerClusterList, out *v1alpha4.DockerClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.DockerCluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_DockerCluster_To_v1alpha4_DockerCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_DockerClusterList_To_v1alpha4_DockerClusterList is an autogenerated conversion function. +func Convert_v1alpha3_DockerClusterList_To_v1alpha4_DockerClusterList(in *DockerClusterList, out *v1alpha4.DockerClusterList, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerClusterList_To_v1alpha4_DockerClusterList(in, out, s) +} + +func autoConvert_v1alpha4_DockerClusterList_To_v1alpha3_DockerClusterList(in *v1alpha4.DockerClusterList, out *DockerClusterList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerCluster, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_DockerCluster_To_v1alpha3_DockerCluster(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha4_DockerClusterList_To_v1alpha3_DockerClusterList is an autogenerated conversion function. +func Convert_v1alpha4_DockerClusterList_To_v1alpha3_DockerClusterList(in *v1alpha4.DockerClusterList, out *DockerClusterList, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerClusterList_To_v1alpha3_DockerClusterList(in, out, s) +} + +func autoConvert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec(in *DockerClusterSpec, out *v1alpha4.DockerClusterSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_APIEndpoint_To_v1alpha4_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { + return err + } + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha4.FailureDomains, len(*in)) + for key, val := range *in { + newVal := new(apiv1alpha4.FailureDomainSpec) + if err := apiv1alpha3.Convert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(&val, newVal, s); err != nil { + return err + } + (*out)[key] = *newVal + } + } else { + out.FailureDomains = nil + } + return nil +} + +// Convert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec is an autogenerated conversion function. +func Convert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec(in *DockerClusterSpec, out *v1alpha4.DockerClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerClusterSpec_To_v1alpha4_DockerClusterSpec(in, out, s) +} + +func autoConvert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec(in *v1alpha4.DockerClusterSpec, out *DockerClusterSpec, s conversion.Scope) error { + if err := Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(&in.ControlPlaneEndpoint, &out.ControlPlaneEndpoint, s); err != nil { + return err + } + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha3.FailureDomains, len(*in)) + for key, val := range *in { + newVal := new(apiv1alpha3.FailureDomainSpec) + if err := apiv1alpha3.Convert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(&val, newVal, s); err != nil { + return err + } + (*out)[key] = *newVal + } + } else { + out.FailureDomains = nil + } + return nil +} + +// Convert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec is an autogenerated conversion function. +func Convert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec(in *v1alpha4.DockerClusterSpec, out *DockerClusterSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerClusterSpec_To_v1alpha3_DockerClusterSpec(in, out, s) +} + +func autoConvert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in *DockerClusterStatus, out *v1alpha4.DockerClusterStatus, s conversion.Scope) error { + out.Ready = in.Ready + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha4.FailureDomains, len(*in)) + for key, val := range *in { + newVal := new(apiv1alpha4.FailureDomainSpec) + if err := apiv1alpha3.Convert_v1alpha3_FailureDomainSpec_To_v1alpha4_FailureDomainSpec(&val, newVal, s); err != nil { + return err + } + (*out)[key] = *newVal + } + } else { + out.FailureDomains = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus is an autogenerated conversion function. +func Convert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in *DockerClusterStatus, out *v1alpha4.DockerClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in, out, s) +} + +func autoConvert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in *v1alpha4.DockerClusterStatus, out *DockerClusterStatus, s conversion.Scope) error { + out.Ready = in.Ready + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha3.FailureDomains, len(*in)) + for key, val := range *in { + newVal := new(apiv1alpha3.FailureDomainSpec) + if err := apiv1alpha3.Convert_v1alpha4_FailureDomainSpec_To_v1alpha3_FailureDomainSpec(&val, newVal, s); err != nil { + return err + } + (*out)[key] = *newVal + } + } else { + out.FailureDomains = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha3.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus is an autogenerated conversion function. +func Convert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in *v1alpha4.DockerClusterStatus, out *DockerClusterStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine(in *DockerMachine, out *v1alpha4.DockerMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine(in *DockerMachine, out *v1alpha4.DockerMachine, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine(in *v1alpha4.DockerMachine, out *DockerMachine, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine(in *v1alpha4.DockerMachine, out *DockerMachine, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineList_To_v1alpha4_DockerMachineList(in *DockerMachineList, out *v1alpha4.DockerMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.DockerMachine, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_DockerMachine_To_v1alpha4_DockerMachine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_DockerMachineList_To_v1alpha4_DockerMachineList is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineList_To_v1alpha4_DockerMachineList(in *DockerMachineList, out *v1alpha4.DockerMachineList, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineList_To_v1alpha4_DockerMachineList(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineList_To_v1alpha3_DockerMachineList(in *v1alpha4.DockerMachineList, out *DockerMachineList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerMachine, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_DockerMachine_To_v1alpha3_DockerMachine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha4_DockerMachineList_To_v1alpha3_DockerMachineList is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineList_To_v1alpha3_DockerMachineList(in *v1alpha4.DockerMachineList, out *DockerMachineList, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineList_To_v1alpha3_DockerMachineList(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in *DockerMachineSpec, out *v1alpha4.DockerMachineSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.CustomImage = in.CustomImage + out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages)) + out.ExtraMounts = *(*[]v1alpha4.Mount)(unsafe.Pointer(&in.ExtraMounts)) + out.Bootstrapped = in.Bootstrapped + return nil +} + +// Convert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in *DockerMachineSpec, out *v1alpha4.DockerMachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in *v1alpha4.DockerMachineSpec, out *DockerMachineSpec, s conversion.Scope) error { + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.CustomImage = in.CustomImage + out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages)) + out.ExtraMounts = *(*[]Mount)(unsafe.Pointer(&in.ExtraMounts)) + out.Bootstrapped = in.Bootstrapped + return nil +} + +// Convert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in *v1alpha4.DockerMachineSpec, out *DockerMachineSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in *DockerMachineStatus, out *v1alpha4.DockerMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.LoadBalancerConfigured = in.LoadBalancerConfigured + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]apiv1alpha4.MachineAddress, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Addresses = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in *DockerMachineStatus, out *v1alpha4.DockerMachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in *v1alpha4.DockerMachineStatus, out *DockerMachineStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.LoadBalancerConfigured = in.LoadBalancerConfigured + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]apiv1alpha3.MachineAddress, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Addresses = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha3.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in *v1alpha4.DockerMachineStatus, out *DockerMachineStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in *DockerMachineTemplate, out *v1alpha4.DockerMachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in *DockerMachineTemplate, out *v1alpha4.DockerMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in *v1alpha4.DockerMachineTemplate, out *DockerMachineTemplate, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in *v1alpha4.DockerMachineTemplate, out *DockerMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineTemplateList_To_v1alpha4_DockerMachineTemplateList(in *DockerMachineTemplateList, out *v1alpha4.DockerMachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1alpha4.DockerMachineTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha3_DockerMachineTemplateList_To_v1alpha4_DockerMachineTemplateList is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineTemplateList_To_v1alpha4_DockerMachineTemplateList(in *DockerMachineTemplateList, out *v1alpha4.DockerMachineTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineTemplateList_To_v1alpha4_DockerMachineTemplateList(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineTemplateList_To_v1alpha3_DockerMachineTemplateList(in *v1alpha4.DockerMachineTemplateList, out *DockerMachineTemplateList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]DockerMachineTemplate)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha4_DockerMachineTemplateList_To_v1alpha3_DockerMachineTemplateList is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineTemplateList_To_v1alpha3_DockerMachineTemplateList(in *v1alpha4.DockerMachineTemplateList, out *DockerMachineTemplateList, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineTemplateList_To_v1alpha3_DockerMachineTemplateList(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(in *DockerMachineTemplateResource, out *v1alpha4.DockerMachineTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha3_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(in *DockerMachineTemplateResource, out *v1alpha4.DockerMachineTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(in *v1alpha4.DockerMachineTemplateResource, out *DockerMachineTemplateResource, s conversion.Scope) error { + if err := Convert_v1alpha4_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(in *v1alpha4.DockerMachineTemplateResource, out *DockerMachineTemplateResource, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec(in *DockerMachineTemplateSpec, out *v1alpha4.DockerMachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec(in *DockerMachineTemplateSpec, out *v1alpha4.DockerMachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineTemplateSpec_To_v1alpha4_DockerMachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec(in *v1alpha4.DockerMachineTemplateSpec, out *DockerMachineTemplateSpec, s conversion.Scope) error { + if err := Convert_v1alpha4_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(&in.Template, &out.Template, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec(in *v1alpha4.DockerMachineTemplateSpec, out *DockerMachineTemplateSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineTemplateSpec_To_v1alpha3_DockerMachineTemplateSpec(in, out, s) +} + +func autoConvert_v1alpha3_Mount_To_v1alpha4_Mount(in *Mount, out *v1alpha4.Mount, s conversion.Scope) error { + out.ContainerPath = in.ContainerPath + out.HostPath = in.HostPath + out.Readonly = in.Readonly + return nil +} + +// Convert_v1alpha3_Mount_To_v1alpha4_Mount is an autogenerated conversion function. +func Convert_v1alpha3_Mount_To_v1alpha4_Mount(in *Mount, out *v1alpha4.Mount, s conversion.Scope) error { + return autoConvert_v1alpha3_Mount_To_v1alpha4_Mount(in, out, s) +} + +func autoConvert_v1alpha4_Mount_To_v1alpha3_Mount(in *v1alpha4.Mount, out *Mount, s conversion.Scope) error { + out.ContainerPath = in.ContainerPath + out.HostPath = in.HostPath + out.Readonly = in.Readonly + return nil +} + +// Convert_v1alpha4_Mount_To_v1alpha3_Mount is an autogenerated conversion function. +func Convert_v1alpha4_Mount_To_v1alpha3_Mount(in *v1alpha4.Mount, out *Mount, s conversion.Scope) error { + return autoConvert_v1alpha4_Mount_To_v1alpha3_Mount(in, out, s) +} diff --git a/test/infrastructure/docker/api/v1alpha4/condition_consts.go b/test/infrastructure/docker/api/v1alpha4/condition_consts.go new file mode 100644 index 000000000000..1d12658acedf --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/condition_consts.go @@ -0,0 +1,79 @@ +/* +Copyright 2020 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 v1alpha4 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + +// Conditions and condition Reasons for the DockerMachine object + +const ( + // ContainerProvisionedCondition documents the status of the provisioning of the container + // generated by a DockerMachine. + // + // NOTE: When the container provisioning starts the process completes almost immediately and within + // the same reconciliation, so the user will always see a transition from Wait to Provisioned without + // having evidence that the operation is started/is in progress. + ContainerProvisionedCondition clusterv1.ConditionType = "ContainerProvisioned" + + // WaitingForClusterInfrastructureReason (Severity=Info) documents a DockerMachine waiting for the cluster + // infrastructure to be ready before starting to create the container that provides the DockerMachine + // infrastructure. + WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" + + // WaitingForBootstrapDataReason (Severity=Info) documents a DockerMachine waiting for the bootstrap + // script to be ready before starting to create the container that provides the DockerMachine infrastructure. + WaitingForBootstrapDataReason = "WaitingForBootstrapData" + + // ContainerProvisioningFailedReason (Severity=Warning) documents a DockerMachine controller detecting + // an error while provisioning the container that provides the DockerMachine infrastructure; those kind of + // errors are usually transient and failed provisioning are automatically re-tried by the controller. + ContainerProvisioningFailedReason = "ContainerProvisioningFailed" +) + +const ( + // BootstrapExecSucceededCondition provide an observation of the DockerMachine bootstrap process. + // The condition gets generated after ContainerProvisionedCondition is True. + // + // NOTE as a difference from other providers, container provisioning and bootstrap are directly managed + // by the DockerMachine controller (not by cloud-init). + BootstrapExecSucceededCondition clusterv1.ConditionType = "BootstrapExecSucceeded" + + // BootstrappingReason documents (Severity=Info) a DockerMachine currently executing the bootstrap + // script that creates the Kubernetes node on the newly provisioned machine infrastructure. + BootstrappingReason = "Bootstrapping" + + // BootstrapFailedReason documents (Severity=Warning) a DockerMachine controller detecting an error while + // bootstrapping the Kubernetes node on the machine just provisioned; those kind of errors are usually + // transient and failed bootstrap are automatically re-tried by the controller. + BootstrapFailedReason = "BootstrapFailed" +) + +// Conditions and condition Reasons for the DockerCluster object + +const ( + // LoadBalancerAvailableCondition documents the availability of the container that implements the cluster load balancer. + // + // NOTE: When the load balancer provisioning starts the process completes almost immediately and within + // the same reconciliation, so the user will always see a transition from no condition to available without + // having evidence that the operation is started/is in progress. + LoadBalancerAvailableCondition clusterv1.ConditionType = "LoadBalancerAvailable" + + // LoadBalancerProvisioningFailedReason (Severity=Warning) documents a DockerCluster controller detecting + // an error while provisioning the container that provides the cluster load balancer.; those kind of + // errors are usually transient and failed provisioning are automatically re-tried by the controller. + LoadBalancerProvisioningFailedReason = "LoadBalancerProvisioningFailed" +) diff --git a/test/infrastructure/docker/api/v1alpha4/doc.go b/test/infrastructure/docker/api/v1alpha4/doc.go new file mode 100644 index 000000000000..b0efd4cde559 --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/doc.go @@ -0,0 +1,17 @@ +/* +Copyright 2020 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 v1alpha4 diff --git a/test/infrastructure/docker/api/v1alpha4/dockercluster_types.go b/test/infrastructure/docker/api/v1alpha4/dockercluster_types.go new file mode 100644 index 000000000000..d737d73ae75a --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/dockercluster_types.go @@ -0,0 +1,103 @@ +/* +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 v1alpha4 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +const ( + // ClusterFinalizer allows DockerClusterReconciler to clean up resources associated with DockerCluster before + // removing it from the apiserver. + ClusterFinalizer = "dockercluster.infrastructure.cluster.x-k8s.io" +) + +// DockerClusterSpec defines the desired state of DockerCluster. +type DockerClusterSpec struct { + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // Important: Run "make" to regenerate code after modifying this file + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"` + + // FailureDomains are not usulaly defined on the spec. + // The docker provider is special since failure domains don't mean anything in a local docker environment. + // Instead, the docker cluster controller will simply copy these into the Status and allow the Cluster API + // controllers to do what they will with the defined failure domains. + // +optional + FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"` +} + +// DockerClusterStatus defines the observed state of DockerCluster. +type DockerClusterStatus struct { + // Ready denotes that the docker cluster (infrastructure) is ready. + Ready bool `json:"ready"` + + // FailureDomains don't mean much in CAPD since it's all local, but we can see how the rest of cluster API + // will use this if we populate it. + FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"` + + // Conditions defines current service state of the DockerCluster. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// APIEndpoint represents a reachable Kubernetes API endpoint. +type APIEndpoint struct { + // Host is the hostname on which the API server is serving. + Host string `json:"host"` + + // Port is the port on which the API server is serving. + Port int `json:"port"` +} + +// +kubebuilder:resource:path=dockerclusters,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:object:root=true + +// DockerCluster is the Schema for the dockerclusters API +type DockerCluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DockerClusterSpec `json:"spec,omitempty"` + Status DockerClusterStatus `json:"status,omitempty"` +} + +func (c *DockerCluster) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +func (c *DockerCluster) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// DockerClusterList contains a list of DockerCluster +type DockerClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DockerCluster `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DockerCluster{}, &DockerClusterList{}) +} diff --git a/test/infrastructure/docker/api/v1alpha4/dockermachine_types.go b/test/infrastructure/docker/api/v1alpha4/dockermachine_types.go new file mode 100644 index 000000000000..391a6f127e4a --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/dockermachine_types.go @@ -0,0 +1,126 @@ +/* +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 v1alpha4 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +const ( + // MachineFinalizer allows ReconcileDockerMachine to clean up resources associated with AWSMachine before + // removing it from the apiserver. + MachineFinalizer = "dockermachine.infrastructure.cluster.x-k8s.io" +) + +// DockerMachineSpec defines the desired state of DockerMachine +type DockerMachineSpec struct { + // ProviderID will be the container name in ProviderID format (docker:////) + // +optional + ProviderID *string `json:"providerID,omitempty"` + + // CustomImage allows customizing the container image that is used for + // running the machine + // +optional + CustomImage string `json:"customImage,omitempty"` + + // PreLoadImages allows to pre-load images in a newly created machine. This can be used to + // speed up tests by avoiding e.g. to download CNI images on all the containers. + // +optional + PreLoadImages []string `json:"preLoadImages,omitempty"` + + // ExtraMounts describes additional mount points for the node container + // These may be used to bind a hostPath + // +optional + ExtraMounts []Mount `json:"extraMounts,omitempty"` + + // Bootstrapped is true when the kubeadm bootstrapping has been run + // against this machine + // +optional + Bootstrapped bool `json:"bootstrapped,omitempty"` +} + +// Mount specifies a host volume to mount into a container. +// This is a simplified version of kind v1alpha4.Mount types +type Mount struct { + // Path of the mount within the container. + ContainerPath string `json:"containerPath,omitempty"` + + // Path of the mount on the host. If the hostPath doesn't exist, then runtimes + // should report error. If the hostpath is a symbolic link, runtimes should + // follow the symlink and mount the real destination to container. + HostPath string `json:"hostPath,omitempty"` + + // If set, the mount is read-only. + // +optional + Readonly bool `json:"readOnly,omitempty"` +} + +// DockerMachineStatus defines the observed state of DockerMachine +type DockerMachineStatus struct { + // Ready denotes that the machine (docker container) is ready + // +optional + Ready bool `json:"ready"` + + // LoadBalancerConfigured denotes that the machine has been + // added to the load balancer + // +optional + LoadBalancerConfigured bool `json:"loadBalancerConfigured,omitempty"` + + // Addresses contains the associated addresses for the docker machine. + // +optional + Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"` + + // Conditions defines current service state of the DockerMachine. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +// +kubebuilder:resource:path=dockermachines,scope=Namespaced,categories=cluster-api +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// DockerMachine is the Schema for the dockermachines API +type DockerMachine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DockerMachineSpec `json:"spec,omitempty"` + Status DockerMachineStatus `json:"status,omitempty"` +} + +func (c *DockerMachine) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +func (c *DockerMachine) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// DockerMachineList contains a list of DockerMachine +type DockerMachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DockerMachine `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DockerMachine{}, &DockerMachineList{}) +} diff --git a/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_types.go b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_types.go new file mode 100644 index 000000000000..edd5b5b56a7e --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_types.go @@ -0,0 +1,57 @@ +/* +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 v1alpha4 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// DockerMachineTemplateSpec defines the desired state of DockerMachineTemplate +type DockerMachineTemplateSpec struct { + Template DockerMachineTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=dockermachinetemplates,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion + +// DockerMachineTemplate is the Schema for the dockermachinetemplates API +type DockerMachineTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DockerMachineTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// DockerMachineTemplateList contains a list of DockerMachineTemplate +type DockerMachineTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DockerMachineTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DockerMachineTemplate{}, &DockerMachineTemplateList{}) +} + +// DockerMachineTemplateResource describes the data needed to create a DockerMachine from a template +type DockerMachineTemplateResource struct { + // Spec is the specification of the desired behavior of the machine. + Spec DockerMachineSpec `json:"spec"` +} diff --git a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook.go b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook.go similarity index 92% rename from test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook.go rename to test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook.go index f3c70e150bcd..f59d5d9466e4 100644 --- a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook.go +++ b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "errors" @@ -31,7 +31,7 @@ func (m *DockerMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error Complete() } -// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1alpha3-dockermachinetemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=dockermachinetemplates,versions=v1alpha3,name=validation.dockermachinetemplate.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 +// +kubebuilder:webhook:verbs=create;update,path=/validate-infrastructure-cluster-x-k8s-io-v1alpha4-dockermachinetemplate,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=infrastructure.cluster.x-k8s.io,resources=dockermachinetemplates,versions=v1alpha4,name=validation.dockermachinetemplate.infrastructure.cluster.x-k8s.io,sideEffects=None,admissionReviewVersions=v1beta1 var _ webhook.Validator = &DockerMachineTemplate{} diff --git a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook_test.go b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook_test.go similarity index 99% rename from test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook_test.go rename to test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook_test.go index 9957885ed857..ce104bace697 100644 --- a/test/infrastructure/docker/api/v1alpha3/dockermachinetemplate_webhook_test.go +++ b/test/infrastructure/docker/api/v1alpha4/dockermachinetemplate_webhook_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha3 +package v1alpha4 import ( "testing" diff --git a/test/infrastructure/docker/api/v1alpha4/groupversion_info.go b/test/infrastructure/docker/api/v1alpha4/groupversion_info.go new file mode 100644 index 000000000000..c2f3e538eb3a --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/groupversion_info.go @@ -0,0 +1,36 @@ +/* +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 v1alpha4 contains API Schema definitions for the infrastructure v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=infrastructure.cluster.x-k8s.io +package v1alpha4 + +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: "infrastructure.cluster.x-k8s.io", Version: "v1alpha4"} + + // 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 +) diff --git a/test/infrastructure/docker/api/v1alpha4/zz_generated.deepcopy.go b/test/infrastructure/docker/api/v1alpha4/zz_generated.deepcopy.go new file mode 100644 index 000000000000..31a18396f264 --- /dev/null +++ b/test/infrastructure/docker/api/v1alpha4/zz_generated.deepcopy.go @@ -0,0 +1,373 @@ +// +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 v1alpha4 + +import ( + "k8s.io/apimachinery/pkg/runtime" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" +) + +// 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 *DockerCluster) DeepCopyInto(out *DockerCluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerCluster. +func (in *DockerCluster) DeepCopy() *DockerCluster { + if in == nil { + return nil + } + out := new(DockerCluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerCluster) 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 *DockerClusterList) DeepCopyInto(out *DockerClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerCluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerClusterList. +func (in *DockerClusterList) DeepCopy() *DockerClusterList { + if in == nil { + return nil + } + out := new(DockerClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerClusterList) 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 *DockerClusterSpec) DeepCopyInto(out *DockerClusterSpec) { + *out = *in + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha4.FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerClusterSpec. +func (in *DockerClusterSpec) DeepCopy() *DockerClusterSpec { + if in == nil { + return nil + } + out := new(DockerClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerClusterStatus) DeepCopyInto(out *DockerClusterStatus) { + *out = *in + if in.FailureDomains != nil { + in, out := &in.FailureDomains, &out.FailureDomains + *out = make(apiv1alpha4.FailureDomains, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerClusterStatus. +func (in *DockerClusterStatus) DeepCopy() *DockerClusterStatus { + if in == nil { + return nil + } + out := new(DockerClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachine) DeepCopyInto(out *DockerMachine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachine. +func (in *DockerMachine) DeepCopy() *DockerMachine { + if in == nil { + return nil + } + out := new(DockerMachine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachine) 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 *DockerMachineList) DeepCopyInto(out *DockerMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineList. +func (in *DockerMachineList) DeepCopy() *DockerMachineList { + if in == nil { + return nil + } + out := new(DockerMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachineList) 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 *DockerMachineSpec) DeepCopyInto(out *DockerMachineSpec) { + *out = *in + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + if in.PreLoadImages != nil { + in, out := &in.PreLoadImages, &out.PreLoadImages + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExtraMounts != nil { + in, out := &in.ExtraMounts, &out.ExtraMounts + *out = make([]Mount, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineSpec. +func (in *DockerMachineSpec) DeepCopy() *DockerMachineSpec { + if in == nil { + return nil + } + out := new(DockerMachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachineStatus) DeepCopyInto(out *DockerMachineStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]apiv1alpha4.MachineAddress, len(*in)) + copy(*out, *in) + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineStatus. +func (in *DockerMachineStatus) DeepCopy() *DockerMachineStatus { + if in == nil { + return nil + } + out := new(DockerMachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachineTemplate) DeepCopyInto(out *DockerMachineTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineTemplate. +func (in *DockerMachineTemplate) DeepCopy() *DockerMachineTemplate { + if in == nil { + return nil + } + out := new(DockerMachineTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachineTemplate) 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 *DockerMachineTemplateList) DeepCopyInto(out *DockerMachineTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerMachineTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineTemplateList. +func (in *DockerMachineTemplateList) DeepCopy() *DockerMachineTemplateList { + if in == nil { + return nil + } + out := new(DockerMachineTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachineTemplateList) 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 *DockerMachineTemplateResource) DeepCopyInto(out *DockerMachineTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineTemplateResource. +func (in *DockerMachineTemplateResource) DeepCopy() *DockerMachineTemplateResource { + if in == nil { + return nil + } + out := new(DockerMachineTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachineTemplateSpec) DeepCopyInto(out *DockerMachineTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineTemplateSpec. +func (in *DockerMachineTemplateSpec) DeepCopy() *DockerMachineTemplateSpec { + if in == nil { + return nil + } + out := new(DockerMachineTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Mount) DeepCopyInto(out *Mount) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Mount. +func (in *Mount) DeepCopy() *Mount { + if in == nil { + return nil + } + out := new(Mount) + in.DeepCopyInto(out) + return out +} diff --git a/test/infrastructure/docker/config/crd/bases/exp.infrastructure.cluster.x-k8s.io_dockermachinepools.yaml b/test/infrastructure/docker/config/crd/bases/exp.infrastructure.cluster.x-k8s.io_dockermachinepools.yaml index 6001b7e361a8..9ef48c15d633 100644 --- a/test/infrastructure/docker/config/crd/bases/exp.infrastructure.cluster.x-k8s.io_dockermachinepools.yaml +++ b/test/infrastructure/docker/config/crd/bases/exp.infrastructure.cluster.x-k8s.io_dockermachinepools.yaml @@ -154,6 +154,145 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1alpha4 + schema: + openAPIV3Schema: + description: DockerMachinePool is the Schema for the dockermachinepools API + 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' + 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' + type: string + metadata: + type: object + spec: + description: DockerMachinePoolSpec defines the desired state of DockerMachinePool + properties: + providerID: + description: ProviderID is the identification ID of the Machine Pool + type: string + providerIDList: + description: ProviderIDList is the list of identification IDs of machine instances managed by this Machine Pool + items: + type: string + type: array + template: + description: Template contains the details used to build a replica machine within the Machine Pool + properties: + customImage: + description: CustomImage allows customizing the container image that is used for running the machine + type: string + extraMounts: + description: ExtraMounts describes additional mount points for the node container These may be used to bind a hostPath + items: + description: Mount specifies a host volume to mount into a container. This is a simplified version of kind v1alpha4.Mount types + properties: + containerPath: + description: Path of the mount within the container. + type: string + hostPath: + description: Path of the mount on the host. If the hostPath doesn't exist, then runtimes should report error. If the hostpath is a symbolic link, runtimes should follow the symlink and mount the real destination to container. + type: string + readOnly: + description: If set, the mount is read-only. + type: boolean + type: object + type: array + preLoadImages: + description: PreLoadImages allows to pre-load images in a newly created machine. This can be used to speed up tests by avoiding e.g. to download CNI images on all the containers. + items: + type: string + type: array + type: object + type: object + status: + description: DockerMachinePoolStatus defines the observed state of DockerMachinePool + properties: + conditions: + description: Conditions defines current service state of the DockerMachinePool. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + instances: + description: Instances contains the status for each instance in the pool + items: + properties: + addresses: + description: Addresses contains the associated addresses for the docker machine. + items: + description: MachineAddress contains information for the node's address. + properties: + address: + description: The machine address. + type: string + type: + description: Machine address type, one of Hostname, ExternalIP or InternalIP. + type: string + required: + - address + - type + type: object + type: array + bootstrapped: + description: Bootstrapped is true when the kubeadm bootstrapping has been run against this machine + type: boolean + instanceName: + description: InstanceName is the identification of the Machine Instance within the Machine Pool + type: string + providerID: + description: ProviderID is the provider identification of the Machine Pool Instance + type: string + ready: + description: Ready denotes that the machine (docker container) is ready + type: boolean + version: + description: Version defines the Kubernetes version for the Machine Instance + type: string + type: object + type: array + observedGeneration: + description: The generation observed by the deployment controller. + format: int64 + type: integer + ready: + description: Ready denotes that the machine pool is ready + type: boolean + replicas: + description: Replicas is the most recently observed number of replicas. + format: int32 + type: integer + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml index 2bd6aac3a70e..ac1250c1c60d 100644 --- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml +++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml @@ -19,6 +19,109 @@ spec: scope: Namespaced versions: - name: v1alpha3 + schema: + openAPIV3Schema: + description: DockerCluster is the Schema for the dockerclusters API + 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' + 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' + type: string + metadata: + type: object + spec: + description: DockerClusterSpec defines the desired state of DockerCluster. + properties: + controlPlaneEndpoint: + description: ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + properties: + host: + description: Host is the hostname on which the API server is serving. + type: string + port: + description: Port is the port on which the API server is serving. + type: integer + required: + - host + - port + type: object + failureDomains: + additionalProperties: + description: FailureDomainSpec is the Schema for Cluster API failure domains. It allows controllers to understand how many failure domains a cluster can optionally span across. + properties: + attributes: + additionalProperties: + type: string + description: Attributes is a free form map of attributes an infrastructure provider might use or require. + type: object + controlPlane: + description: ControlPlane determines if this failure domain is suitable for use by control plane machines. + type: boolean + type: object + description: FailureDomains are not usulaly defined on the spec. The docker provider is special since failure domains don't mean anything in a local docker environment. Instead, the docker cluster controller will simply copy these into the Status and allow the Cluster API controllers to do what they will with the defined failure domains. + type: object + type: object + status: + description: DockerClusterStatus defines the observed state of DockerCluster. + properties: + conditions: + description: Conditions defines current service state of the DockerCluster. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + failureDomains: + additionalProperties: + description: FailureDomainSpec is the Schema for Cluster API failure domains. It allows controllers to understand how many failure domains a cluster can optionally span across. + properties: + attributes: + additionalProperties: + type: string + description: Attributes is a free form map of attributes an infrastructure provider might use or require. + type: object + controlPlane: + description: ControlPlane determines if this failure domain is suitable for use by control plane machines. + type: boolean + type: object + description: FailureDomains don't mean much in CAPD since it's all local, but we can see how the rest of cluster API will use this if we populate it. + type: object + ready: + description: Ready denotes that the docker cluster (infrastructure) is ready. + type: boolean + required: + - ready + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha4 schema: openAPIV3Schema: description: DockerCluster is the Schema for the dockerclusters API diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml index a05f1c20a1f4..eb8e8b6303a5 100644 --- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml +++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml @@ -122,6 +122,113 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v1alpha4 + schema: + openAPIV3Schema: + description: DockerMachine is the Schema for the dockermachines API + 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' + 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' + type: string + metadata: + type: object + spec: + description: DockerMachineSpec defines the desired state of DockerMachine + properties: + bootstrapped: + description: Bootstrapped is true when the kubeadm bootstrapping has been run against this machine + type: boolean + customImage: + description: CustomImage allows customizing the container image that is used for running the machine + type: string + extraMounts: + description: ExtraMounts describes additional mount points for the node container These may be used to bind a hostPath + items: + description: Mount specifies a host volume to mount into a container. This is a simplified version of kind v1alpha4.Mount types + properties: + containerPath: + description: Path of the mount within the container. + type: string + hostPath: + description: Path of the mount on the host. If the hostPath doesn't exist, then runtimes should report error. If the hostpath is a symbolic link, runtimes should follow the symlink and mount the real destination to container. + type: string + readOnly: + description: If set, the mount is read-only. + type: boolean + type: object + type: array + preLoadImages: + description: PreLoadImages allows to pre-load images in a newly created machine. This can be used to speed up tests by avoiding e.g. to download CNI images on all the containers. + items: + type: string + type: array + providerID: + description: ProviderID will be the container name in ProviderID format (docker:////) + type: string + type: object + status: + description: DockerMachineStatus defines the observed state of DockerMachine + properties: + addresses: + description: Addresses contains the associated addresses for the docker machine. + items: + description: MachineAddress contains information for the node's address. + properties: + address: + description: The machine address. + type: string + type: + description: Machine address type, one of Hostname, ExternalIP or InternalIP. + type: string + required: + - address + - type + type: object + type: array + conditions: + description: Conditions defines current service state of the DockerMachine. + items: + description: Condition defines an observation of a Cluster API resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition in CamelCase. The specific API may choose whether or not this field is considered a guaranteed API. This field may not be empty. + type: string + severity: + description: Severity provides an explicit classification of Reason code, so the users or machines can immediately understand the current situation and act accordingly. The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - status + - type + type: object + type: array + loadBalancerConfigured: + description: LoadBalancerConfigured denotes that the machine has been added to the load balancer + type: boolean + ready: + description: Ready denotes that the machine (docker container) is ready + type: boolean + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml index 21002627a6db..49e4c3e480aa 100644 --- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml +++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml @@ -19,6 +19,68 @@ spec: scope: Namespaced versions: - name: v1alpha3 + schema: + openAPIV3Schema: + description: DockerMachineTemplate is the Schema for the dockermachinetemplates API + 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' + 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' + type: string + metadata: + type: object + spec: + description: DockerMachineTemplateSpec defines the desired state of DockerMachineTemplate + properties: + template: + description: DockerMachineTemplateResource describes the data needed to create a DockerMachine from a template + properties: + spec: + description: Spec is the specification of the desired behavior of the machine. + properties: + bootstrapped: + description: Bootstrapped is true when the kubeadm bootstrapping has been run against this machine + type: boolean + customImage: + description: CustomImage allows customizing the container image that is used for running the machine + type: string + extraMounts: + description: ExtraMounts describes additional mount points for the node container These may be used to bind a hostPath + items: + description: Mount specifies a host volume to mount into a container. This is a simplified version of kind v1alpha4.Mount types + properties: + containerPath: + description: Path of the mount within the container. + type: string + hostPath: + description: Path of the mount on the host. If the hostPath doesn't exist, then runtimes should report error. If the hostpath is a symbolic link, runtimes should follow the symlink and mount the real destination to container. + type: string + readOnly: + description: If set, the mount is read-only. + type: boolean + type: object + type: array + preLoadImages: + description: PreLoadImages allows to pre-load images in a newly created machine. This can be used to speed up tests by avoiding e.g. to download CNI images on all the containers. + items: + type: string + type: array + providerID: + description: ProviderID will be the container name in ProviderID format (docker:////) + type: string + type: object + required: + - spec + type: object + required: + - template + type: object + type: object + served: true + storage: false + - name: v1alpha4 schema: openAPIV3Schema: description: DockerMachineTemplate is the Schema for the dockermachinetemplates API diff --git a/test/infrastructure/docker/config/crd/kustomization.yaml b/test/infrastructure/docker/config/crd/kustomization.yaml index 8323fd3162e5..4c92a1893540 100644 --- a/test/infrastructure/docker/config/crd/kustomization.yaml +++ b/test/infrastructure/docker/config/crd/kustomization.yaml @@ -1,5 +1,6 @@ commonLabels: cluster.x-k8s.io/v1alpha3: v1alpha3 + cluster.x-k8s.io/v1alpha4: v1alpha4 # This kustomization.yaml is not intended to be run by itself, # since it depends on service name and namespace that are out of this kustomize package. diff --git a/test/infrastructure/docker/config/webhook/manifests.yaml b/test/infrastructure/docker/config/webhook/manifests.yaml index cdc8b4b555b7..121c738a43c9 100644 --- a/test/infrastructure/docker/config/webhook/manifests.yaml +++ b/test/infrastructure/docker/config/webhook/manifests.yaml @@ -13,7 +13,7 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-infrastructure-cluster-x-k8s-io-v1alpha3-dockermachinetemplate + path: /validate-infrastructure-cluster-x-k8s-io-v1alpha4-dockermachinetemplate failurePolicy: Fail matchPolicy: Equivalent name: validation.dockermachinetemplate.infrastructure.cluster.x-k8s.io @@ -21,7 +21,7 @@ webhooks: - apiGroups: - infrastructure.cluster.x-k8s.io apiVersions: - - v1alpha3 + - v1alpha4 operations: - CREATE - UPDATE diff --git a/test/infrastructure/docker/controllers/dockercluster_controller.go b/test/infrastructure/docker/controllers/dockercluster_controller.go index 8b1ea11552a6..f5ab36d76cc0 100644 --- a/test/infrastructure/docker/controllers/dockercluster_controller.go +++ b/test/infrastructure/docker/controllers/dockercluster_controller.go @@ -22,8 +22,8 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/docker" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/test/infrastructure/docker/controllers/dockermachine_controller.go b/test/infrastructure/docker/controllers/dockermachine_controller.go index 6f5c3c33e3d1..056e82420885 100644 --- a/test/infrastructure/docker/controllers/dockermachine_controller.go +++ b/test/infrastructure/docker/controllers/dockermachine_controller.go @@ -25,8 +25,8 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/docker" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" diff --git a/test/infrastructure/docker/controllers/dockermachine_controller_test.go b/test/infrastructure/docker/controllers/dockermachine_controller_test.go index e1cc557241cc..8ab890f99607 100644 --- a/test/infrastructure/docker/controllers/dockermachine_controller_test.go +++ b/test/infrastructure/docker/controllers/dockermachine_controller_test.go @@ -24,8 +24,8 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" ) diff --git a/test/infrastructure/docker/docker/machine.go b/test/infrastructure/docker/docker/machine.go index 76962dbd857b..c5009d2ecc80 100644 --- a/test/infrastructure/docker/docker/machine.go +++ b/test/infrastructure/docker/docker/machine.go @@ -30,7 +30,7 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/wait" - infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/cloudinit" "sigs.k8s.io/cluster-api/test/infrastructure/docker/docker/types" "sigs.k8s.io/kind/pkg/apis/config/v1alpha4" diff --git a/test/infrastructure/docker/exp/PROJECT b/test/infrastructure/docker/exp/PROJECT index 30c1be97a308..07560d39e0fe 100644 --- a/test/infrastructure/docker/exp/PROJECT +++ b/test/infrastructure/docker/exp/PROJECT @@ -1,7 +1,10 @@ +version: "2" domain: cluster.x-k8s.io repo: sigs.k8s.io/cluster-api/test/infrastructure/docker/exp resources: - group: exp.infrastructure kind: DockerMachinePool version: v1alpha3 -version: "2" +- group: exp.infrastructure + kind: DockerMachinePool + version: v1alpha4 diff --git a/test/infrastructure/docker/exp/api/v1alpha3/doc.go b/test/infrastructure/docker/exp/api/v1alpha3/doc.go new file mode 100644 index 000000000000..b518c01c42d3 --- /dev/null +++ b/test/infrastructure/docker/exp/api/v1alpha3/doc.go @@ -0,0 +1,18 @@ +/* +Copyright 2020 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. +*/ + +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha4 +package v1alpha3 diff --git a/test/infrastructure/docker/exp/api/v1alpha3/dockermachinepool_types.go b/test/infrastructure/docker/exp/api/v1alpha3/dockermachinepool_types.go index a1089a3d2a05..0e77ae8d0430 100644 --- a/test/infrastructure/docker/exp/api/v1alpha3/dockermachinepool_types.go +++ b/test/infrastructure/docker/exp/api/v1alpha3/dockermachinepool_types.go @@ -112,7 +112,6 @@ type DockerMachinePoolInstanceStatus struct { // +kubebuilder:resource:path=dockermachinepools,scope=Namespaced,categories=cluster-api // +kubebuilder:object:root=true -// +kubebuilder:storageversion // +kubebuilder:subresource:status // DockerMachinePool is the Schema for the dockermachinepools API diff --git a/test/infrastructure/docker/exp/api/v1alpha3/groupversion_info.go b/test/infrastructure/docker/exp/api/v1alpha3/groupversion_info.go index 6a6a8d3c9fcb..58fb917a9652 100644 --- a/test/infrastructure/docker/exp/api/v1alpha3/groupversion_info.go +++ b/test/infrastructure/docker/exp/api/v1alpha3/groupversion_info.go @@ -33,4 +33,6 @@ var ( // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder ) diff --git a/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.conversion.go b/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.conversion.go new file mode 100644 index 000000000000..4a34983047ac --- /dev/null +++ b/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.conversion.go @@ -0,0 +1,349 @@ +// +build !ignore_autogenerated_capd_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 v1alpha3 + +import ( + unsafe "unsafe" + + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + apiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" + apiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + dockerapiv1alpha3 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + dockerapiv1alpha4 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" + v1alpha4 "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/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((*DockerMachinePool)(nil), (*v1alpha4.DockerMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool(a.(*DockerMachinePool), b.(*v1alpha4.DockerMachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachinePool)(nil), (*DockerMachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool(a.(*v1alpha4.DockerMachinePool), b.(*DockerMachinePool), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachinePoolInstanceStatus)(nil), (*v1alpha4.DockerMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachinePoolInstanceStatus_To_v1alpha4_DockerMachinePoolInstanceStatus(a.(*DockerMachinePoolInstanceStatus), b.(*v1alpha4.DockerMachinePoolInstanceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachinePoolInstanceStatus)(nil), (*DockerMachinePoolInstanceStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachinePoolInstanceStatus_To_v1alpha3_DockerMachinePoolInstanceStatus(a.(*v1alpha4.DockerMachinePoolInstanceStatus), b.(*DockerMachinePoolInstanceStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachinePoolList)(nil), (*v1alpha4.DockerMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachinePoolList_To_v1alpha4_DockerMachinePoolList(a.(*DockerMachinePoolList), b.(*v1alpha4.DockerMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachinePoolList)(nil), (*DockerMachinePoolList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachinePoolList_To_v1alpha3_DockerMachinePoolList(a.(*v1alpha4.DockerMachinePoolList), b.(*DockerMachinePoolList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachinePoolSpec)(nil), (*v1alpha4.DockerMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec(a.(*DockerMachinePoolSpec), b.(*v1alpha4.DockerMachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachinePoolSpec)(nil), (*DockerMachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec(a.(*v1alpha4.DockerMachinePoolSpec), b.(*DockerMachinePoolSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachinePoolStatus)(nil), (*v1alpha4.DockerMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus(a.(*DockerMachinePoolStatus), b.(*v1alpha4.DockerMachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachinePoolStatus)(nil), (*DockerMachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus(a.(*v1alpha4.DockerMachinePoolStatus), b.(*DockerMachinePoolStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*DockerMachineTemplate)(nil), (*v1alpha4.DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(a.(*DockerMachineTemplate), b.(*v1alpha4.DockerMachineTemplate), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1alpha4.DockerMachineTemplate)(nil), (*DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(a.(*v1alpha4.DockerMachineTemplate), b.(*DockerMachineTemplate), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool(in *DockerMachinePool, out *v1alpha4.DockerMachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool(in *DockerMachinePool, out *v1alpha4.DockerMachinePool, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool(in *v1alpha4.DockerMachinePool, out *DockerMachinePool, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool(in *v1alpha4.DockerMachinePool, out *DockerMachinePool, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachinePoolInstanceStatus_To_v1alpha4_DockerMachinePoolInstanceStatus(in *DockerMachinePoolInstanceStatus, out *v1alpha4.DockerMachinePoolInstanceStatus, s conversion.Scope) error { + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]apiv1alpha4.MachineAddress, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_MachineAddress_To_v1alpha4_MachineAddress(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Addresses = nil + } + out.InstanceName = in.InstanceName + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.Ready = in.Ready + out.Bootstrapped = in.Bootstrapped + return nil +} + +// Convert_v1alpha3_DockerMachinePoolInstanceStatus_To_v1alpha4_DockerMachinePoolInstanceStatus is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachinePoolInstanceStatus_To_v1alpha4_DockerMachinePoolInstanceStatus(in *DockerMachinePoolInstanceStatus, out *v1alpha4.DockerMachinePoolInstanceStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachinePoolInstanceStatus_To_v1alpha4_DockerMachinePoolInstanceStatus(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachinePoolInstanceStatus_To_v1alpha3_DockerMachinePoolInstanceStatus(in *v1alpha4.DockerMachinePoolInstanceStatus, out *DockerMachinePoolInstanceStatus, s conversion.Scope) error { + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]apiv1alpha3.MachineAddress, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_MachineAddress_To_v1alpha3_MachineAddress(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Addresses = nil + } + out.InstanceName = in.InstanceName + out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) + out.Version = (*string)(unsafe.Pointer(in.Version)) + out.Ready = in.Ready + out.Bootstrapped = in.Bootstrapped + return nil +} + +// Convert_v1alpha4_DockerMachinePoolInstanceStatus_To_v1alpha3_DockerMachinePoolInstanceStatus is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachinePoolInstanceStatus_To_v1alpha3_DockerMachinePoolInstanceStatus(in *v1alpha4.DockerMachinePoolInstanceStatus, out *DockerMachinePoolInstanceStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachinePoolInstanceStatus_To_v1alpha3_DockerMachinePoolInstanceStatus(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachinePoolList_To_v1alpha4_DockerMachinePoolList(in *DockerMachinePoolList, out *v1alpha4.DockerMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.DockerMachinePool, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_DockerMachinePool_To_v1alpha4_DockerMachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha3_DockerMachinePoolList_To_v1alpha4_DockerMachinePoolList is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachinePoolList_To_v1alpha4_DockerMachinePoolList(in *DockerMachinePoolList, out *v1alpha4.DockerMachinePoolList, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachinePoolList_To_v1alpha4_DockerMachinePoolList(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachinePoolList_To_v1alpha3_DockerMachinePoolList(in *v1alpha4.DockerMachinePoolList, out *DockerMachinePoolList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerMachinePool, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_DockerMachinePool_To_v1alpha3_DockerMachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +// Convert_v1alpha4_DockerMachinePoolList_To_v1alpha3_DockerMachinePoolList is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachinePoolList_To_v1alpha3_DockerMachinePoolList(in *v1alpha4.DockerMachinePoolList, out *DockerMachinePoolList, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachinePoolList_To_v1alpha3_DockerMachinePoolList(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec(in *DockerMachinePoolSpec, out *v1alpha4.DockerMachinePoolSpec, s conversion.Scope) error { + if err := Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(&in.Template, &out.Template, s); err != nil { + return err + } + out.ProviderID = in.ProviderID + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec(in *DockerMachinePoolSpec, out *v1alpha4.DockerMachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachinePoolSpec_To_v1alpha4_DockerMachinePoolSpec(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec(in *v1alpha4.DockerMachinePoolSpec, out *DockerMachinePoolSpec, s conversion.Scope) error { + if err := Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(&in.Template, &out.Template, s); err != nil { + return err + } + out.ProviderID = in.ProviderID + out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) + return nil +} + +// Convert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec(in *v1alpha4.DockerMachinePoolSpec, out *DockerMachinePoolSpec, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachinePoolSpec_To_v1alpha3_DockerMachinePoolSpec(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus(in *DockerMachinePoolStatus, out *v1alpha4.DockerMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Replicas = in.Replicas + out.ObservedGeneration = in.ObservedGeneration + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]*v1alpha4.DockerMachinePoolInstanceStatus, len(*in)) + for i := range *in { + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&(*in)[i], &(*out)[i], 0); err != nil { + return err + } + } + } else { + out.Instances = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha4.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha3_Condition_To_v1alpha4_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus(in *DockerMachinePoolStatus, out *v1alpha4.DockerMachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachinePoolStatus_To_v1alpha4_DockerMachinePoolStatus(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus(in *v1alpha4.DockerMachinePoolStatus, out *DockerMachinePoolStatus, s conversion.Scope) error { + out.Ready = in.Ready + out.Replicas = in.Replicas + out.ObservedGeneration = in.ObservedGeneration + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]*DockerMachinePoolInstanceStatus, len(*in)) + for i := range *in { + // TODO: Inefficient conversion - can we improve it? + if err := s.Convert(&(*in)[i], &(*out)[i], 0); err != nil { + return err + } + } + } else { + out.Instances = nil + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(apiv1alpha3.Conditions, len(*in)) + for i := range *in { + if err := apiv1alpha3.Convert_v1alpha4_Condition_To_v1alpha3_Condition(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Conditions = nil + } + return nil +} + +// Convert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus(in *v1alpha4.DockerMachinePoolStatus, out *DockerMachinePoolStatus, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachinePoolStatus_To_v1alpha3_DockerMachinePoolStatus(in, out, s) +} + +func autoConvert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in *DockerMachineTemplate, out *v1alpha4.DockerMachineTemplate, s conversion.Scope) error { + out.CustomImage = in.CustomImage + out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages)) + out.ExtraMounts = *(*[]dockerapiv1alpha4.Mount)(unsafe.Pointer(&in.ExtraMounts)) + return nil +} + +// Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in *DockerMachineTemplate, out *v1alpha4.DockerMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha3_DockerMachineTemplate_To_v1alpha4_DockerMachineTemplate(in, out, s) +} + +func autoConvert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in *v1alpha4.DockerMachineTemplate, out *DockerMachineTemplate, s conversion.Scope) error { + out.CustomImage = in.CustomImage + out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages)) + out.ExtraMounts = *(*[]dockerapiv1alpha3.Mount)(unsafe.Pointer(&in.ExtraMounts)) + return nil +} + +// Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate is an autogenerated conversion function. +func Convert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in *v1alpha4.DockerMachineTemplate, out *DockerMachineTemplate, s conversion.Scope) error { + return autoConvert_v1alpha4_DockerMachineTemplate_To_v1alpha3_DockerMachineTemplate(in, out, s) +} diff --git a/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.deepcopy.go b/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.deepcopy.go index 237cf2180525..92696bd4447e 100644 --- a/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.deepcopy.go +++ b/test/infrastructure/docker/exp/api/v1alpha3/zz_generated.deepcopy.go @@ -21,7 +21,7 @@ limitations under the License. package v1alpha3 import ( - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" cluster_apiapiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" apiv1alpha3 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" ) diff --git a/test/infrastructure/docker/exp/api/v1alpha4/dockermachinepool_types.go b/test/infrastructure/docker/exp/api/v1alpha4/dockermachinepool_types.go new file mode 100644 index 000000000000..d168de9a6c6a --- /dev/null +++ b/test/infrastructure/docker/exp/api/v1alpha4/dockermachinepool_types.go @@ -0,0 +1,146 @@ +/* +Copyright 2020 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 v1alpha4 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" +) + +const ( + // MachinePoolFinalizer allows ReconcileDockerMachinePool to clean up resources + MachinePoolFinalizer = "dockermachinepool.infrastructure.cluster.x-k8s.io" +) + +// DockerMachineTemplate defines the desired state of DockerMachine +type DockerMachineTemplate struct { + // CustomImage allows customizing the container image that is used for + // running the machine + // +optional + CustomImage string `json:"customImage,omitempty"` + + // PreLoadImages allows to pre-load images in a newly created machine. This can be used to + // speed up tests by avoiding e.g. to download CNI images on all the containers. + // +optional + PreLoadImages []string `json:"preLoadImages,omitempty"` + + // ExtraMounts describes additional mount points for the node container + // These may be used to bind a hostPath + // +optional + ExtraMounts []infrav1.Mount `json:"extraMounts,omitempty"` +} + +// DockerMachinePoolSpec defines the desired state of DockerMachinePool +type DockerMachinePoolSpec struct { + // Template contains the details used to build a replica machine within the Machine Pool + // +optional + Template DockerMachineTemplate `json:"template"` + + // ProviderID is the identification ID of the Machine Pool + // +optional + ProviderID string `json:"providerID,omitempty"` + + // ProviderIDList is the list of identification IDs of machine instances managed by this Machine Pool + //+optional + ProviderIDList []string `json:"providerIDList,omitempty"` +} + +// DockerMachinePoolStatus defines the observed state of DockerMachinePool +type DockerMachinePoolStatus struct { + // Ready denotes that the machine pool is ready + // +optional + Ready bool `json:"ready"` + + // Replicas is the most recently observed number of replicas. + // +optional + Replicas int32 `json:"replicas"` + + // The generation observed by the deployment controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // Instances contains the status for each instance in the pool + // +optional + Instances []*DockerMachinePoolInstanceStatus `json:"instances,omitempty"` + + // Conditions defines current service state of the DockerMachinePool. + // +optional + Conditions clusterv1.Conditions `json:"conditions,omitempty"` +} + +type DockerMachinePoolInstanceStatus struct { + // Addresses contains the associated addresses for the docker machine. + // +optional + Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"` + + // InstanceName is the identification of the Machine Instance within the Machine Pool + InstanceName string `json:"instanceName,omitempty"` + + // ProviderID is the provider identification of the Machine Pool Instance + // +optional + ProviderID *string `json:"providerID,omitempty"` + + // Version defines the Kubernetes version for the Machine Instance + // +optional + Version *string `json:"version,omitempty"` + + // Ready denotes that the machine (docker container) is ready + // +optional + Ready bool `json:"ready"` + + // Bootstrapped is true when the kubeadm bootstrapping has been run + // against this machine + // +optional + Bootstrapped bool `json:"bootstrapped,omitempty"` +} + +// +kubebuilder:resource:path=dockermachinepools,scope=Namespaced,categories=cluster-api +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// DockerMachinePool is the Schema for the dockermachinepools API +type DockerMachinePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DockerMachinePoolSpec `json:"spec,omitempty"` + Status DockerMachinePoolStatus `json:"status,omitempty"` +} + +func (c *DockerMachinePool) GetConditions() clusterv1.Conditions { + return c.Status.Conditions +} + +func (c *DockerMachinePool) SetConditions(conditions clusterv1.Conditions) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// DockerMachinePoolList contains a list of DockerMachinePool +type DockerMachinePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DockerMachinePool `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DockerMachinePool{}, &DockerMachinePoolList{}) +} diff --git a/test/infrastructure/docker/exp/api/v1alpha4/groupversion_info.go b/test/infrastructure/docker/exp/api/v1alpha4/groupversion_info.go new file mode 100644 index 000000000000..f2e0b3c1ddaf --- /dev/null +++ b/test/infrastructure/docker/exp/api/v1alpha4/groupversion_info.go @@ -0,0 +1,36 @@ +/* +Copyright 2020 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 v1alpha4 contains API Schema definitions for the exp.infrastructure v1alpha4 API group +// +kubebuilder:object:generate=true +// +groupName=exp.infrastructure.cluster.x-k8s.io +package v1alpha4 + +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: "exp.infrastructure.cluster.x-k8s.io", Version: "v1alpha4"} + + // 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 +) diff --git a/test/infrastructure/docker/exp/api/v1alpha4/zz_generated.deepcopy.go b/test/infrastructure/docker/exp/api/v1alpha4/zz_generated.deepcopy.go new file mode 100644 index 000000000000..fef17de86a9e --- /dev/null +++ b/test/infrastructure/docker/exp/api/v1alpha4/zz_generated.deepcopy.go @@ -0,0 +1,195 @@ +// +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 v1alpha4 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + cluster_apiapiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + apiv1alpha4 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachinePool) DeepCopyInto(out *DockerMachinePool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachinePool. +func (in *DockerMachinePool) DeepCopy() *DockerMachinePool { + if in == nil { + return nil + } + out := new(DockerMachinePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachinePool) 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 *DockerMachinePoolInstanceStatus) DeepCopyInto(out *DockerMachinePoolInstanceStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]cluster_apiapiv1alpha4.MachineAddress, len(*in)) + copy(*out, *in) + } + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachinePoolInstanceStatus. +func (in *DockerMachinePoolInstanceStatus) DeepCopy() *DockerMachinePoolInstanceStatus { + if in == nil { + return nil + } + out := new(DockerMachinePoolInstanceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachinePoolList) DeepCopyInto(out *DockerMachinePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DockerMachinePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachinePoolList. +func (in *DockerMachinePoolList) DeepCopy() *DockerMachinePoolList { + if in == nil { + return nil + } + out := new(DockerMachinePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DockerMachinePoolList) 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 *DockerMachinePoolSpec) DeepCopyInto(out *DockerMachinePoolSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) + if in.ProviderIDList != nil { + in, out := &in.ProviderIDList, &out.ProviderIDList + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachinePoolSpec. +func (in *DockerMachinePoolSpec) DeepCopy() *DockerMachinePoolSpec { + if in == nil { + return nil + } + out := new(DockerMachinePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachinePoolStatus) DeepCopyInto(out *DockerMachinePoolStatus) { + *out = *in + if in.Instances != nil { + in, out := &in.Instances, &out.Instances + *out = make([]*DockerMachinePoolInstanceStatus, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(DockerMachinePoolInstanceStatus) + (*in).DeepCopyInto(*out) + } + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(cluster_apiapiv1alpha4.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachinePoolStatus. +func (in *DockerMachinePoolStatus) DeepCopy() *DockerMachinePoolStatus { + if in == nil { + return nil + } + out := new(DockerMachinePoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachineTemplate) DeepCopyInto(out *DockerMachineTemplate) { + *out = *in + if in.PreLoadImages != nil { + in, out := &in.PreLoadImages, &out.PreLoadImages + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExtraMounts != nil { + in, out := &in.ExtraMounts, &out.ExtraMounts + *out = make([]apiv1alpha4.Mount, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineTemplate. +func (in *DockerMachineTemplate) DeepCopy() *DockerMachineTemplate { + if in == nil { + return nil + } + out := new(DockerMachineTemplate) + in.DeepCopyInto(out) + return out +} diff --git a/test/infrastructure/docker/exp/controllers/dockermachinepool_controller.go b/test/infrastructure/docker/exp/controllers/dockermachinepool_controller.go index 20768ad7ecfe..1631ab01a479 100644 --- a/test/infrastructure/docker/exp/controllers/dockermachinepool_controller.go +++ b/test/infrastructure/docker/exp/controllers/dockermachinepool_controller.go @@ -26,10 +26,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4" utilexp "sigs.k8s.io/cluster-api/exp/util" - infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha3" + infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/docker" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/patch" diff --git a/test/infrastructure/docker/exp/docker/nodepool.go b/test/infrastructure/docker/exp/docker/nodepool.go index b764d46273e1..4f9a7435173e 100644 --- a/test/infrastructure/docker/exp/docker/nodepool.go +++ b/test/infrastructure/docker/exp/docker/nodepool.go @@ -25,10 +25,10 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/docker" - infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha3" + infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/kind/pkg/cluster/constants" diff --git a/test/infrastructure/docker/main.go b/test/infrastructure/docker/main.go index 864838f26252..a145401713aa 100644 --- a/test/infrastructure/docker/main.go +++ b/test/infrastructure/docker/main.go @@ -30,12 +30,12 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" "k8s.io/klog" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4" "sigs.k8s.io/cluster-api/feature" - infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" + infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" "sigs.k8s.io/cluster-api/test/infrastructure/docker/controllers" - infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha3" + infrav1exp "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/api/v1alpha4" expcontrollers "sigs.k8s.io/cluster-api/test/infrastructure/docker/exp/controllers" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -62,7 +62,7 @@ func init() { _ = infrav1.AddToScheme(myscheme) _ = infrav1exp.AddToScheme(myscheme) _ = clusterv1.AddToScheme(myscheme) - _ = clusterv1exp.AddToScheme(myscheme) + _ = expv1.AddToScheme(myscheme) // +kubebuilder:scaffold:scheme } diff --git a/util/annotations/helpers.go b/util/annotations/helpers.go index fbccc929f01e..d17a70212732 100644 --- a/util/annotations/helpers.go +++ b/util/annotations/helpers.go @@ -20,7 +20,7 @@ import ( "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // IsPaused returns true if the Cluster is paused or the object has the `paused` annotation. diff --git a/util/conditions/getter.go b/util/conditions/getter.go index e58d1dc01e3c..92a1a67a7a77 100644 --- a/util/conditions/getter.go +++ b/util/conditions/getter.go @@ -19,7 +19,7 @@ package conditions import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/util/conditions/getter_test.go b/util/conditions/getter_test.go index ca0183b3ee5a..55fec31bc061 100644 --- a/util/conditions/getter_test.go +++ b/util/conditions/getter_test.go @@ -23,7 +23,7 @@ import ( "github.com/onsi/gomega/format" "github.com/onsi/gomega/types" "github.com/pkg/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) var ( diff --git a/util/conditions/merge.go b/util/conditions/merge.go index 868cf5ad0a96..a5650d891cdc 100644 --- a/util/conditions/merge.go +++ b/util/conditions/merge.go @@ -20,7 +20,7 @@ import ( "sort" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // localizedCondition defines a condition with the information of the object the conditions diff --git a/util/conditions/merge_strategies.go b/util/conditions/merge_strategies.go index bd8bbc00e01e..87bda830fcd0 100644 --- a/util/conditions/merge_strategies.go +++ b/util/conditions/merge_strategies.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // mergeOptions allows to set strategies for merging a set of conditions into a single condition, diff --git a/util/conditions/merge_strategies_test.go b/util/conditions/merge_strategies_test.go index bfcc939567d5..cddc13572b12 100644 --- a/util/conditions/merge_strategies_test.go +++ b/util/conditions/merge_strategies_test.go @@ -21,7 +21,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestGetStepCounterMessage(t *testing.T) { diff --git a/util/conditions/merge_test.go b/util/conditions/merge_test.go index 8adab0b253c0..c2c2331dd105 100644 --- a/util/conditions/merge_test.go +++ b/util/conditions/merge_test.go @@ -21,7 +21,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestNewConditionsGroup(t *testing.T) { diff --git a/util/conditions/patch.go b/util/conditions/patch.go index 6236e7e4c2f2..9f955081c078 100644 --- a/util/conditions/patch.go +++ b/util/conditions/patch.go @@ -21,7 +21,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/pkg/errors" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // Patch defines a list of operations to change a list of conditions into another diff --git a/util/conditions/patch_test.go b/util/conditions/patch_test.go index b488a70fcf81..4d87b92a5709 100644 --- a/util/conditions/patch_test.go +++ b/util/conditions/patch_test.go @@ -23,7 +23,7 @@ import ( . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestNewPatch(t *testing.T) { diff --git a/util/conditions/setter.go b/util/conditions/setter.go index fe6c97ec9f15..207ce55b2b9c 100644 --- a/util/conditions/setter.go +++ b/util/conditions/setter.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) // Setter interface defines methods that a Cluster API object should implement in order to diff --git a/util/conditions/setter_test.go b/util/conditions/setter_test.go index 50334c2bc75c..39077e2dcda8 100644 --- a/util/conditions/setter_test.go +++ b/util/conditions/setter_test.go @@ -26,7 +26,7 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestHasSameState(t *testing.T) { diff --git a/util/conditions/unstructured.go b/util/conditions/unstructured.go index 7ab048e8fd8e..47fcf98e0530 100644 --- a/util/conditions/unstructured.go +++ b/util/conditions/unstructured.go @@ -18,7 +18,7 @@ package conditions import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/util/conditions/unstructured_test.go b/util/conditions/unstructured_test.go index eca0472a7da6..5158bb37fb45 100644 --- a/util/conditions/unstructured_test.go +++ b/util/conditions/unstructured_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestUnstructuredGetConditions(t *testing.T) { diff --git a/util/conversion/conversion.go b/util/conversion/conversion.go index fa2f470ebcce..030c4fef38a1 100644 --- a/util/conversion/conversion.go +++ b/util/conversion/conversion.go @@ -37,7 +37,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/json" "k8s.io/client-go/rest" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/util/conversion/conversion_test.go b/util/conversion/conversion_test.go index 2396eea4728b..279cda5ac434 100644 --- a/util/conversion/conversion_test.go +++ b/util/conversion/conversion_test.go @@ -22,8 +22,8 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1a2 "sigs.k8s.io/cluster-api/api/v1alpha3" - clusterv1a3 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1a2 "sigs.k8s.io/cluster-api/api/v1alpha4" + clusterv1a3 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestMarshalData(t *testing.T) { diff --git a/util/kubeconfig/kubeconfig.go b/util/kubeconfig/kubeconfig.go index 6bef9e1fdd06..f3b1aea834d1 100644 --- a/util/kubeconfig/kubeconfig.go +++ b/util/kubeconfig/kubeconfig.go @@ -29,7 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/cluster-api/util/secret" diff --git a/util/kubeconfig/kubeconfig_test.go b/util/kubeconfig/kubeconfig_test.go index 469469ca9ce0..4d0f6dc06eca 100644 --- a/util/kubeconfig/kubeconfig_test.go +++ b/util/kubeconfig/kubeconfig_test.go @@ -32,7 +32,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/cluster-api/util/secret" diff --git a/util/kubeconfig/testing.go b/util/kubeconfig/testing.go index d8765da4f1f0..8d9a4e826b20 100644 --- a/util/kubeconfig/testing.go +++ b/util/kubeconfig/testing.go @@ -23,7 +23,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/util/patch/options.go b/util/patch/options.go index 24afe9241961..abf0e8184298 100644 --- a/util/patch/options.go +++ b/util/patch/options.go @@ -16,7 +16,7 @@ limitations under the License. package patch -import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" +import clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" // Option is some configuration that modifies options for a patch request. type Option interface { diff --git a/util/patch/patch.go b/util/patch/patch.go index 117a67b1ba49..f13ba702c70e 100644 --- a/util/patch/patch.go +++ b/util/patch/patch.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/wait" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/util/patch/patch_test.go b/util/patch/patch_test.go index 275117fa4dfb..78008c99c9b0 100644 --- a/util/patch/patch_test.go +++ b/util/patch/patch_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/controllers/external" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" @@ -42,7 +42,7 @@ var _ = Describe("Patch Helper", func() { obj := &unstructured.Unstructured{ Object: map[string]interface{}{ "kind": "BootstrapMachine", - "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha3", + "apiVersion": "bootstrap.cluster.x-k8s.io/v1alpha4", "metadata": map[string]interface{}{ "generateName": "test-bootstrap-", "namespace": "default", @@ -81,7 +81,7 @@ var _ = Describe("Patch Helper", func() { By("Modifying the OwnerReferences") refs := []metav1.OwnerReference{ { - APIVersion: "cluster.x-k8s.io/v1alpha3", + APIVersion: "cluster.x-k8s.io/v1alpha4", Kind: "Cluster", Name: "test", UID: types.UID("fake-uid"), diff --git a/util/patch/utils_test.go b/util/patch/utils_test.go index 7fbd304d6a00..0b32d952ad8d 100644 --- a/util/patch/utils_test.go +++ b/util/patch/utils_test.go @@ -22,7 +22,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ) func TestToUnstructured(t *testing.T) { diff --git a/util/predicates/cluster_predicates.go b/util/predicates/cluster_predicates.go index 1da12d86ae4a..7f806cf03953 100644 --- a/util/predicates/cluster_predicates.go +++ b/util/predicates/cluster_predicates.go @@ -18,7 +18,7 @@ package predicates import ( "github.com/go-logr/logr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" ) diff --git a/util/secret/certificates.go b/util/secret/certificates.go index 2cda34a89352..b0de9c3f69c0 100644 --- a/util/secret/certificates.go +++ b/util/secret/certificates.go @@ -34,8 +34,8 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/cert" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" - bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" + bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1" "sigs.k8s.io/cluster-api/util/certs" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/util/util.go b/util/util.go index b7829dfcaf63..770342fe4843 100644 --- a/util/util.go +++ b/util/util.go @@ -42,7 +42,7 @@ import ( "k8s.io/client-go/metadata" "k8s.io/client-go/rest" "k8s.io/klog/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/container" "sigs.k8s.io/cluster-api/util/predicates" diff --git a/util/util_test.go b/util/util_test.go index ff1af6eeb745..ad819ef19c05 100644 --- a/util/util_test.go +++ b/util/util_test.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -100,7 +100,7 @@ func TestMachineToInfrastructureMapFunc(t *testing.T) { name: "should reconcile infra-1", input: schema.GroupVersionKind{ Group: "foo.cluster.x-k8s.io", - Version: "v1alpha3", + Version: "v1alpha4", Kind: "TestMachine", }, request: &clusterv1.Machine{ @@ -110,7 +110,7 @@ func TestMachineToInfrastructureMapFunc(t *testing.T) { }, Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "foo.cluster.x-k8s.io/v1alpha3", + APIVersion: "foo.cluster.x-k8s.io/v1alpha4", Kind: "TestMachine", Name: "infra-1", }, @@ -129,7 +129,7 @@ func TestMachineToInfrastructureMapFunc(t *testing.T) { name: "should return no matching reconcile requests", input: schema.GroupVersionKind{ Group: "foo.cluster.x-k8s.io", - Version: "v1alpha3", + Version: "v1alpha4", Kind: "TestMachine", }, request: &clusterv1.Machine{ @@ -139,7 +139,7 @@ func TestMachineToInfrastructureMapFunc(t *testing.T) { }, Spec: clusterv1.MachineSpec{ InfrastructureRef: corev1.ObjectReference{ - APIVersion: "bar.cluster.x-k8s.io/v1alpha3", + APIVersion: "bar.cluster.x-k8s.io/v1alpha4", Kind: "TestMachine", Name: "bar-1", }, @@ -171,7 +171,7 @@ func TestClusterToInfrastructureMapFunc(t *testing.T) { name: "should reconcile infra-1", input: schema.GroupVersionKind{ Group: "foo.cluster.x-k8s.io", - Version: "v1alpha3", + Version: "v1alpha4", Kind: "TestCluster", }, request: &clusterv1.Cluster{ @@ -181,7 +181,7 @@ func TestClusterToInfrastructureMapFunc(t *testing.T) { }, Spec: clusterv1.ClusterSpec{ InfrastructureRef: &corev1.ObjectReference{ - APIVersion: "foo.cluster.x-k8s.io/v1alpha3", + APIVersion: "foo.cluster.x-k8s.io/v1alpha4", Kind: "TestCluster", Name: "infra-1", }, @@ -200,7 +200,7 @@ func TestClusterToInfrastructureMapFunc(t *testing.T) { name: "should return no matching reconcile requests", input: schema.GroupVersionKind{ Group: "foo.cluster.x-k8s.io", - Version: "v1alpha3", + Version: "v1alpha4", Kind: "TestCluster", }, request: &clusterv1.Cluster{ @@ -210,7 +210,7 @@ func TestClusterToInfrastructureMapFunc(t *testing.T) { }, Spec: clusterv1.ClusterSpec{ InfrastructureRef: &corev1.ObjectReference{ - APIVersion: "bar.cluster.x-k8s.io/v1alpha3", + APIVersion: "bar.cluster.x-k8s.io/v1alpha4", Kind: "TestCluster", Name: "bar-1", }, @@ -893,7 +893,7 @@ func TestRemoveOwnerRef(t *testing.T) { Name: "m4g1c", }, { - APIVersion: "bar.cluster.x-k8s.io/v1alpha3", + APIVersion: "bar.cluster.x-k8s.io/v1alpha4", Kind: "TestCluster", Name: "bar-1", }, diff --git a/util/yaml/yaml.go b/util/yaml/yaml.go index 72961122ad5d..6ac93e1d36c0 100644 --- a/util/yaml/yaml.go +++ b/util/yaml/yaml.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/streaming" apiyaml "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/kubernetes/scheme" - clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" + clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/yaml" ) diff --git a/util/yaml/yaml_test.go b/util/yaml/yaml_test.go index 65e91ab6fd7c..e388a81456b6 100644 --- a/util/yaml/yaml_test.go +++ b/util/yaml/yaml_test.go @@ -28,7 +28,7 @@ import ( ) const validCluster = ` -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1 @@ -36,39 +36,39 @@ spec:` const validMachines1 = ` --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine2` const validUnified1 = ` -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine1` const validUnified2 = ` -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine2` @@ -85,24 +85,24 @@ metadata: name: cluster-api-shared-configuration namespace: cluster-api-test --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine2` const invalidMachines1 = ` items: -- apiVersion: "cluster.x-k8s.io/v1alpha3" +- apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine metadata: name: machine1 @@ -129,12 +129,12 @@ metadata: name: cluster-api-shared-configuration namespace: cluster-api-test --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1 --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Machine - metadata: name: machine1 @@ -155,7 +155,7 @@ metadata: name: cluster-api-shared-configuration namespace: cluster-api-test --- -apiVersion: "cluster.x-k8s.io/v1alpha3" +apiVersion: "cluster.x-k8s.io/v1alpha4" kind: Cluster metadata: name: cluster1