From 4a666de4f327fda90ceafaabb4d10b95d8087124 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Fri, 18 Jul 2025 12:15:58 +0200 Subject: [PATCH 1/7] Restructure MHC fields in MHC, Cluster and ClusterClass CRDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- .golangci-kal.yml | 4 + api/core/v1beta1/conversion.go | 251 +++- api/core/v1beta1/conversion_test.go | 25 +- api/core/v1beta1/zz_generated.conversion.go | 197 +-- api/core/v1beta2/cluster_types.go | 232 +++- api/core/v1beta2/clusterclass_types.go | 240 ++-- api/core/v1beta2/machinehealthcheck_types.go | 87 +- api/core/v1beta2/zz_generated.deepcopy.go | 472 ++++++-- api/core/v1beta2/zz_generated.openapi.go | 1060 ++++++++++++----- .../cluster.x-k8s.io_clusterclasses.yaml | 502 ++++---- .../crd/bases/cluster.x-k8s.io_clusters.yaml | 506 ++++---- .../cluster.x-k8s.io_machinehealthchecks.yaml | 248 ++-- exp/topology/desiredstate/desired_state.go | 19 +- .../desiredstate/desired_state_test.go | 56 +- exp/topology/scope/blueprint.go | 82 +- exp/topology/scope/blueprint_test.go | 268 +++-- internal/api/core/v1alpha3/conversion.go | 27 +- .../core/v1alpha3/zz_generated.conversion.go | 28 +- internal/api/core/v1alpha4/conversion.go | 43 +- internal/api/core/v1alpha4/conversion_test.go | 2 +- .../core/v1alpha4/zz_generated.conversion.go | 42 +- .../machinehealthcheck_controller.go | 44 +- .../machinehealthcheck_controller_test.go | 60 +- .../machinehealthcheck_targets.go | 2 +- .../machinehealthcheck_targets_test.go | 34 +- .../controllers/topology/cluster/blueprint.go | 6 +- .../topology/cluster/blueprint_test.go | 21 +- .../topology/cluster/reconcile_state_test.go | 16 +- internal/webhooks/cluster.go | 28 +- internal/webhooks/cluster_test.go | 56 +- internal/webhooks/clusterclass.go | 49 +- internal/webhooks/clusterclass_test.go | 112 +- internal/webhooks/machinehealthcheck.go | 32 +- internal/webhooks/machinehealthcheck_test.go | 102 +- .../cluster-template-kcp-remediation/mhc.yaml | 15 +- .../cluster-template-md-remediation/mhc.yaml | 13 +- .../main/clusterclass-in-memory.yaml | 34 +- .../main/clusterclass-quick-start.yaml | 11 +- .../handler_integration_test.go | 6 +- test/framework/machinehealthcheck_helpers.go | 8 +- .../templates/clusterclass-in-memory.yaml | 34 +- .../templates/clusterclass-quick-start.yaml | 34 +- util/test/builder/builders.go | 50 +- util/test/builder/zz_generated.deepcopy.go | 8 +- 44 files changed, 3272 insertions(+), 1894 deletions(-) diff --git a/.golangci-kal.yml b/.golangci-kal.yml index 0a092da36ccc..17e522400740 100644 --- a/.golangci-kal.yml +++ b/.golangci-kal.yml @@ -178,6 +178,10 @@ linters: text: "optionalfields: field (Workers|Metadata|ControlPlane|Strategy|Infrastructure|DeprecatedV1Beta1Metadata) is optional and should (be a pointer|have the omitempty tag)" linters: - kubeapilinter + - path: "api/core/v1beta2/(cluster_types.go|clusterclass_types.go|machinehealthcheck_types.go)" + text: "optionalfields: field (Checks|Remediation|TriggerIf) is optional and should (be a pointer|have the omitempty tag)" + linters: + - kubeapilinter - path: "api/core/v1beta2/machinedeployment_types.go" text: "optionalfields: field (Strategy|RollingUpdate|Remediation) is optional and should (be a pointer|have the omitempty tag)" linters: diff --git a/api/core/v1beta1/conversion.go b/api/core/v1beta1/conversion.go index f43526696242..112ea479fab9 100644 --- a/api/core/v1beta1/conversion.go +++ b/api/core/v1beta1/conversion.go @@ -526,8 +526,6 @@ func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { dst.Spec.RemediationTemplate.Namespace = src.Namespace } - dropEmptyStringsMachineHealthCheck(dst) - return utilconversion.MarshalData(src, dst) } @@ -663,40 +661,6 @@ func Convert_v1beta1_ClusterClassSpec_To_v1beta2_ClusterClassSpec(in *ClusterCla return nil } -func Convert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(in *MachineHealthCheckClass, out *clusterv1.MachineHealthCheckClass, s apimachineryconversion.Scope) error { - if err := autoConvert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(in, out, s); err != nil { - return err - } - - for _, c := range in.UnhealthyConditions { - out.UnhealthyNodeConditions = append(out.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ - Type: c.Type, - Status: c.Status, - TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), - }) - } - out.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) - - return nil -} - -func Convert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(in *clusterv1.MachineHealthCheckClass, out *MachineHealthCheckClass, s apimachineryconversion.Scope) error { - if err := autoConvert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(in, out, s); err != nil { - return err - } - - for _, c := range in.UnhealthyNodeConditions { - out.UnhealthyConditions = append(out.UnhealthyConditions, UnhealthyCondition{ - Type: c.Type, - Status: c.Status, - Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), - }) - } - out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.NodeStartupTimeoutSeconds) - - return nil -} - func Convert_v1beta1_LocalObjectTemplate_To_v1beta2_InfrastructureClass(in *LocalObjectTemplate, out *clusterv1.InfrastructureClass, s apimachineryconversion.Scope) error { if in == nil { return nil @@ -714,6 +678,26 @@ func Convert_v1beta1_ControlPlaneClass_To_v1beta2_ControlPlaneClass(in *ControlP out.Deletion.NodeVolumeDetachTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeVolumeDetachTimeout) out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) convert_v1beta1_LocalObjectTemplate_To_v1beta2_ClusterClassTemplateReference(&in.LocalObjectTemplate, &out.TemplateRef, s) + + if in.MachineHealthCheck != nil { + out.HealthCheck = &clusterv1.ControlPlaneClassMachineHealthCheck{} + for _, c := range in.MachineHealthCheck.UnhealthyConditions { + out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + Type: c.Type, + Status: c.Status, + TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), + }) + } + out.HealthCheck.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.MachineHealthCheck.NodeStartupTimeout) + out.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MachineHealthCheck.MaxUnhealthy + out.HealthCheck.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.MachineHealthCheck.UnhealthyRange, "") + if in.MachineHealthCheck.RemediationTemplate != nil { + out.HealthCheck.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.MachineHealthCheck.RemediationTemplate, out.HealthCheck.Remediation.TemplateRef, s); err != nil { + return err + } + } + } return nil } @@ -725,6 +709,28 @@ func Convert_v1beta2_ControlPlaneClass_To_v1beta1_ControlPlaneClass(in *clusterv out.NodeVolumeDetachTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeVolumeDetachTimeoutSeconds) out.NodeDeletionTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDeletionTimeoutSeconds) Convert_v1beta2_ClusterClassTemplateReference_To_v1beta1_LocalObjectTemplate(&in.TemplateRef, &out.LocalObjectTemplate, s) + + if in.HealthCheck != nil { + out.MachineHealthCheck = &MachineHealthCheckClass{} + for _, c := range in.HealthCheck.Checks.UnhealthyNodeConditions { + out.MachineHealthCheck.UnhealthyConditions = append(out.MachineHealthCheck.UnhealthyConditions, UnhealthyCondition{ + Type: c.Type, + Status: c.Status, + Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), + }) + } + out.MachineHealthCheck.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.HealthCheck.Checks.NodeStartupTimeoutSeconds) + out.MachineHealthCheck.MaxUnhealthy = in.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange != "" { + out.MachineHealthCheck.UnhealthyRange = ptr.To(in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange) + } + if in.HealthCheck.Remediation.TemplateRef != nil { + out.MachineHealthCheck.RemediationTemplate = &corev1.ObjectReference{} + if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.HealthCheck.Remediation.TemplateRef, out.MachineHealthCheck.RemediationTemplate, s); err != nil { + return err + } + } + } return nil } @@ -740,6 +746,27 @@ func Convert_v1beta1_ControlPlaneTopology_To_v1beta2_ControlPlaneTopology(in *Co out.Deletion.NodeDrainTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDrainTimeout) out.Deletion.NodeVolumeDetachTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeVolumeDetachTimeout) out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) + + if in.MachineHealthCheck != nil { + out.HealthCheck = &clusterv1.ControlPlaneTopologyMachineHealthCheck{} + out.HealthCheck.Enabled = in.MachineHealthCheck.Enable + for _, c := range in.MachineHealthCheck.UnhealthyConditions { + out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + Type: c.Type, + Status: c.Status, + TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), + }) + } + out.HealthCheck.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.MachineHealthCheck.NodeStartupTimeout) + out.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MachineHealthCheck.MaxUnhealthy + out.HealthCheck.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.MachineHealthCheck.UnhealthyRange, "") + if in.MachineHealthCheck.RemediationTemplate != nil { + out.HealthCheck.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.MachineHealthCheck.RemediationTemplate, out.HealthCheck.Remediation.TemplateRef, s); err != nil { + return err + } + } + } return nil } @@ -756,6 +783,29 @@ func Convert_v1beta2_ControlPlaneTopology_To_v1beta1_ControlPlaneTopology(in *cl out.NodeDrainTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDrainTimeoutSeconds) out.NodeVolumeDetachTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeVolumeDetachTimeoutSeconds) out.NodeDeletionTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDeletionTimeoutSeconds) + + if in.HealthCheck != nil { + out.MachineHealthCheck = &MachineHealthCheckTopology{} + out.MachineHealthCheck.Enable = in.HealthCheck.Enabled + for _, c := range in.HealthCheck.Checks.UnhealthyNodeConditions { + out.MachineHealthCheck.UnhealthyConditions = append(out.MachineHealthCheck.UnhealthyConditions, UnhealthyCondition{ + Type: c.Type, + Status: c.Status, + Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), + }) + } + out.MachineHealthCheck.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.HealthCheck.Checks.NodeStartupTimeoutSeconds) + out.MachineHealthCheck.MaxUnhealthy = in.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange != "" { + out.MachineHealthCheck.UnhealthyRange = ptr.To(in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange) + } + if in.HealthCheck.Remediation.TemplateRef != nil { + out.MachineHealthCheck.RemediationTemplate = &corev1.ObjectReference{} + if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.HealthCheck.Remediation.TemplateRef, out.MachineHealthCheck.RemediationTemplate, s); err != nil { + return err + } + } + } return nil } @@ -780,6 +830,26 @@ func Convert_v1beta1_MachineDeploymentClass_To_v1beta2_MachineDeploymentClass(in out.Deletion.NodeDrainTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDrainTimeout) out.Deletion.NodeVolumeDetachTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeVolumeDetachTimeout) out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) + + if in.MachineHealthCheck != nil { + out.HealthCheck = &clusterv1.MachineDeploymentClassMachineHealthCheck{} + for _, c := range in.MachineHealthCheck.UnhealthyConditions { + out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + Type: c.Type, + Status: c.Status, + TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), + }) + } + out.HealthCheck.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.MachineHealthCheck.NodeStartupTimeout) + out.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MachineHealthCheck.MaxUnhealthy + out.HealthCheck.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.MachineHealthCheck.UnhealthyRange, "") + if in.MachineHealthCheck.RemediationTemplate != nil { + out.HealthCheck.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.MachineHealthCheck.RemediationTemplate, out.HealthCheck.Remediation.TemplateRef, s); err != nil { + return err + } + } + } return nil } @@ -805,6 +875,28 @@ func Convert_v1beta2_MachineDeploymentClass_To_v1beta1_MachineDeploymentClass(in out.NodeDrainTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDrainTimeoutSeconds) out.NodeVolumeDetachTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeVolumeDetachTimeoutSeconds) out.NodeDeletionTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDeletionTimeoutSeconds) + + if in.HealthCheck != nil { + out.MachineHealthCheck = &MachineHealthCheckClass{} + for _, c := range in.HealthCheck.Checks.UnhealthyNodeConditions { + out.MachineHealthCheck.UnhealthyConditions = append(out.MachineHealthCheck.UnhealthyConditions, UnhealthyCondition{ + Type: c.Type, + Status: c.Status, + Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), + }) + } + out.MachineHealthCheck.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.HealthCheck.Checks.NodeStartupTimeoutSeconds) + out.MachineHealthCheck.MaxUnhealthy = in.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange != "" { + out.MachineHealthCheck.UnhealthyRange = ptr.To(in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange) + } + if in.HealthCheck.Remediation.TemplateRef != nil { + out.MachineHealthCheck.RemediationTemplate = &corev1.ObjectReference{} + if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.HealthCheck.Remediation.TemplateRef, out.MachineHealthCheck.RemediationTemplate, s); err != nil { + return err + } + } + } return nil } @@ -825,6 +917,27 @@ func Convert_v1beta1_MachineDeploymentTopology_To_v1beta2_MachineDeploymentTopol out.Deletion.NodeDrainTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDrainTimeout) out.Deletion.NodeVolumeDetachTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeVolumeDetachTimeout) out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) + + if in.MachineHealthCheck != nil { + out.HealthCheck = &clusterv1.MachineDeploymentTopologyMachineHealthCheck{} + out.HealthCheck.Enabled = in.MachineHealthCheck.Enable + for _, c := range in.MachineHealthCheck.UnhealthyConditions { + out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + Type: c.Type, + Status: c.Status, + TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), + }) + } + out.HealthCheck.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.MachineHealthCheck.NodeStartupTimeout) + out.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MachineHealthCheck.MaxUnhealthy + out.HealthCheck.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.MachineHealthCheck.UnhealthyRange, "") + if in.MachineHealthCheck.RemediationTemplate != nil { + out.HealthCheck.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.MachineHealthCheck.RemediationTemplate, out.HealthCheck.Remediation.TemplateRef, s); err != nil { + return err + } + } + } return nil } @@ -847,6 +960,29 @@ func Convert_v1beta2_MachineDeploymentTopology_To_v1beta1_MachineDeploymentTopol out.NodeDrainTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDrainTimeoutSeconds) out.NodeVolumeDetachTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeVolumeDetachTimeoutSeconds) out.NodeDeletionTimeout = clusterv1.ConvertFromSeconds(in.Deletion.NodeDeletionTimeoutSeconds) + + if in.HealthCheck != nil { + out.MachineHealthCheck = &MachineHealthCheckTopology{} + out.MachineHealthCheck.Enable = in.HealthCheck.Enabled + for _, c := range in.HealthCheck.Checks.UnhealthyNodeConditions { + out.MachineHealthCheck.UnhealthyConditions = append(out.MachineHealthCheck.UnhealthyConditions, UnhealthyCondition{ + Type: c.Type, + Status: c.Status, + Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), + }) + } + out.MachineHealthCheck.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.HealthCheck.Checks.NodeStartupTimeoutSeconds) + out.MachineHealthCheck.MaxUnhealthy = in.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange != "" { + out.MachineHealthCheck.UnhealthyRange = ptr.To(in.HealthCheck.Remediation.TriggerIf.UnhealthyInRange) + } + if in.HealthCheck.Remediation.TemplateRef != nil { + out.MachineHealthCheck.RemediationTemplate = &corev1.ObjectReference{} + if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.HealthCheck.Remediation.TemplateRef, out.MachineHealthCheck.RemediationTemplate, s); err != nil { + return err + } + } + } return nil } @@ -1224,13 +1360,21 @@ func Convert_v1beta1_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSpec(in } for _, c := range in.UnhealthyConditions { - out.UnhealthyNodeConditions = append(out.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + out.Checks.UnhealthyNodeConditions = append(out.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ Type: c.Type, Status: c.Status, TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), }) } - out.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MaxUnhealthy + out.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.UnhealthyRange, "") + if in.RemediationTemplate != nil { + out.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.RemediationTemplate, out.Remediation.TemplateRef, s); err != nil { + return err + } + } return nil } @@ -1240,14 +1384,24 @@ func Convert_v1beta2_MachineHealthCheckSpec_To_v1beta1_MachineHealthCheckSpec(in return err } - for _, c := range in.UnhealthyNodeConditions { + for _, c := range in.Checks.UnhealthyNodeConditions { out.UnhealthyConditions = append(out.UnhealthyConditions, UnhealthyCondition{ Type: c.Type, Status: c.Status, Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), }) } - out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.NodeStartupTimeoutSeconds) + out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.Checks.NodeStartupTimeoutSeconds) + out.MaxUnhealthy = in.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.Remediation.TriggerIf.UnhealthyInRange != "" { + out.UnhealthyRange = ptr.To(in.Remediation.TriggerIf.UnhealthyInRange) + } + if in.Remediation.TemplateRef != nil { + out.RemediationTemplate = &corev1.ObjectReference{} + if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.Remediation.TemplateRef, out.RemediationTemplate, s); err != nil { + return err + } + } return nil } @@ -1972,16 +2126,9 @@ func Convert_v1beta1_JSONSchemaProps_To_v1beta2_JSONSchemaProps(in *JSONSchemaPr func dropEmptyStringsCluster(dst *Cluster) { if dst.Spec.Topology != nil { - if dst.Spec.Topology.ControlPlane.MachineHealthCheck != nil { - dropEmptyString(&dst.Spec.Topology.ControlPlane.MachineHealthCheck.UnhealthyRange) - } - if dst.Spec.Topology.Workers != nil { for i, md := range dst.Spec.Topology.Workers.MachineDeployments { dropEmptyString(&md.FailureDomain) - if md.MachineHealthCheck != nil { - dropEmptyString(&md.MachineHealthCheck.UnhealthyRange) - } dst.Spec.Topology.Workers.MachineDeployments[i] = md } } @@ -1996,18 +2143,12 @@ func dropEmptyStringsClusterClass(dst *ClusterClass) { if dst.Spec.ControlPlane.NamingStrategy != nil { dropEmptyString(&dst.Spec.ControlPlane.NamingStrategy.Template) } - if dst.Spec.ControlPlane.MachineHealthCheck != nil { - dropEmptyString(&dst.Spec.ControlPlane.MachineHealthCheck.UnhealthyRange) - } for i, md := range dst.Spec.Workers.MachineDeployments { if md.NamingStrategy != nil { dropEmptyString(&md.NamingStrategy.Template) } dropEmptyString(&md.FailureDomain) - if md.MachineHealthCheck != nil { - dropEmptyString(&md.MachineHealthCheck.UnhealthyRange) - } dst.Spec.Workers.MachineDeployments[i] = md } @@ -2048,10 +2189,6 @@ func dropEmptyStringsMachineSpec(spec *MachineSpec) { dropEmptyString(&spec.FailureDomain) } -func dropEmptyStringsMachineHealthCheck(dst *MachineHealthCheck) { - dropEmptyString(&dst.Spec.UnhealthyRange) -} - func dropEmptyString(s **string) { if *s != nil && **s == "" { *s = nil diff --git a/api/core/v1beta1/conversion_test.go b/api/core/v1beta1/conversion_test.go index dc774f23bc7c..0b0116139c26 100644 --- a/api/core/v1beta1/conversion_test.go +++ b/api/core/v1beta1/conversion_test.go @@ -194,6 +194,20 @@ func spokeCluster(in *Cluster, c randfill.Continue) { } dropEmptyStringsCluster(in) + if in.Spec.Topology != nil { + if in.Spec.Topology.ControlPlane.MachineHealthCheck != nil { + dropEmptyString(&in.Spec.Topology.ControlPlane.MachineHealthCheck.UnhealthyRange) + } + if in.Spec.Topology.Workers != nil { + for i, md := range in.Spec.Topology.Workers.MachineDeployments { + dropEmptyString(&md.FailureDomain) + if md.MachineHealthCheck != nil { + dropEmptyString(&md.MachineHealthCheck.UnhealthyRange) + } + in.Spec.Topology.Workers.MachineDeployments[i] = md + } + } + } if in.Spec.ClusterNetwork != nil { if in.Spec.ClusterNetwork.Services != nil && reflect.DeepEqual(in.Spec.ClusterNetwork.Services, &NetworkRanges{}) { @@ -332,6 +346,15 @@ func spokeClusterClass(in *ClusterClass, c randfill.Continue) { in.Namespace = "foo" dropEmptyStringsClusterClass(in) + if in.Spec.ControlPlane.MachineHealthCheck != nil { + dropEmptyString(&in.Spec.ControlPlane.MachineHealthCheck.UnhealthyRange) + } + for i, md := range in.Spec.Workers.MachineDeployments { + if md.MachineHealthCheck != nil { + dropEmptyString(&md.MachineHealthCheck.UnhealthyRange) + } + in.Spec.Workers.MachineDeployments[i] = md + } } func spokeClusterClassStatus(in *ClusterClassStatus, c randfill.Continue) { @@ -653,7 +676,7 @@ func spokeMachineHealthCheck(in *MachineHealthCheck, c randfill.Continue) { in.Namespace = "foo" - dropEmptyStringsMachineHealthCheck(in) + dropEmptyString(&in.Spec.UnhealthyRange) } func spokeMachineHealthCheckStatus(in *MachineHealthCheckStatus, c randfill.Continue) { diff --git a/api/core/v1beta1/zz_generated.conversion.go b/api/core/v1beta1/zz_generated.conversion.go index 003c38efaea4..cb077715089e 100644 --- a/api/core/v1beta1/zz_generated.conversion.go +++ b/api/core/v1beta1/zz_generated.conversion.go @@ -355,16 +355,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*MachineHealthCheckTopology)(nil), (*v1beta2.MachineHealthCheckTopology)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(a.(*MachineHealthCheckTopology), b.(*v1beta2.MachineHealthCheckTopology), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta2.MachineHealthCheckTopology)(nil), (*MachineHealthCheckTopology)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(a.(*v1beta2.MachineHealthCheckTopology), b.(*MachineHealthCheckTopology), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1beta2.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineList_To_v1beta2_MachineList(a.(*MachineList), b.(*v1beta2.MachineList), scope) }); err != nil { @@ -755,11 +745,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*MachineHealthCheckClass)(nil), (*v1beta2.MachineHealthCheckClass)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(a.(*MachineHealthCheckClass), b.(*v1beta2.MachineHealthCheckClass), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*MachineHealthCheckSpec)(nil), (*v1beta2.MachineHealthCheckSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSpec(a.(*MachineHealthCheckSpec), b.(*v1beta2.MachineHealthCheckSpec), scope) }); err != nil { @@ -930,11 +915,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddConversionFunc((*v1beta2.MachineHealthCheckClass)(nil), (*MachineHealthCheckClass)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(a.(*v1beta2.MachineHealthCheckClass), b.(*MachineHealthCheckClass), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*v1beta2.MachineHealthCheckRemediationTemplateReference)(nil), (*corev1.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(a.(*v1beta2.MachineHealthCheckRemediationTemplateReference), b.(*corev1.ObjectReference), scope) }); err != nil { @@ -1768,15 +1748,7 @@ func autoConvert_v1beta1_ControlPlaneClass_To_v1beta2_ControlPlaneClass(in *Cont } else { out.MachineInfrastructure = nil } - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(v1beta2.MachineHealthCheckClass) - if err := Convert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type if in.NamingStrategy != nil { in, out := &in.NamingStrategy, &out.NamingStrategy *out = new(v1beta2.ControlPlaneClassNamingStrategy) @@ -1807,15 +1779,7 @@ func autoConvert_v1beta2_ControlPlaneClass_To_v1beta1_ControlPlaneClass(in *v1be } else { out.MachineInfrastructure = nil } - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckClass) - if err := Convert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type if in.NamingStrategy != nil { in, out := &in.NamingStrategy, &out.NamingStrategy *out = new(ControlPlaneClassNamingStrategy) @@ -1859,15 +1823,7 @@ func autoConvert_v1beta1_ControlPlaneTopology_To_v1beta2_ControlPlaneTopology(in return err } out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(v1beta2.MachineHealthCheckTopology) - if err := Convert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeVolumeDetachTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeDeletionTimeout requires manual conversion: does not exist in peer-type @@ -1881,15 +1837,7 @@ func autoConvert_v1beta2_ControlPlaneTopology_To_v1beta1_ControlPlaneTopology(in return err } out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckTopology) - if err := Convert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type out.ReadinessGates = *(*[]MachineReadinessGate)(unsafe.Pointer(&in.ReadinessGates)) // WARNING: in.Variables requires manual conversion: inconvertible types (sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables vs *sigs.k8s.io/cluster-api/api/core/v1beta1.ControlPlaneVariables) @@ -2364,15 +2312,7 @@ func Convert_v1beta2_MachineDeployment_To_v1beta1_MachineDeployment(in *v1beta2. func autoConvert_v1beta1_MachineDeploymentClass_To_v1beta2_MachineDeploymentClass(in *MachineDeploymentClass, out *v1beta2.MachineDeploymentClass, s conversion.Scope) error { out.Class = in.Class // WARNING: in.Template requires manual conversion: does not exist in peer-type - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(v1beta2.MachineHealthCheckClass) - if err := Convert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type if err := v1.Convert_Pointer_string_To_string(&in.FailureDomain, &out.FailureDomain, s); err != nil { return err } @@ -2399,15 +2339,7 @@ func autoConvert_v1beta2_MachineDeploymentClass_To_v1beta1_MachineDeploymentClas out.Class = in.Class // WARNING: in.Bootstrap requires manual conversion: does not exist in peer-type // WARNING: in.Infrastructure requires manual conversion: does not exist in peer-type - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckClass) - if err := Convert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type if err := v1.Convert_string_To_Pointer_string(&in.FailureDomain, &out.FailureDomain, s); err != nil { return err } @@ -2611,15 +2543,7 @@ func autoConvert_v1beta1_MachineDeploymentTopology_To_v1beta2_MachineDeploymentT return err } out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(v1beta2.MachineHealthCheckTopology) - if err := Convert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.NodeDrainTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeVolumeDetachTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeDeletionTimeout requires manual conversion: does not exist in peer-type @@ -2640,15 +2564,7 @@ func autoConvert_v1beta2_MachineDeploymentTopology_To_v1beta1_MachineDeploymentT return err } out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckTopology) - if err := Convert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(*in, *out, s); err != nil { - return err - } - } else { - out.MachineHealthCheck = nil - } + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) out.ReadinessGates = *(*[]MachineReadinessGate)(unsafe.Pointer(&in.ReadinessGates)) @@ -2871,44 +2787,6 @@ func Convert_v1beta2_MachineHealthCheck_To_v1beta1_MachineHealthCheck(in *v1beta return autoConvert_v1beta2_MachineHealthCheck_To_v1beta1_MachineHealthCheck(in, out, s) } -func autoConvert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(in *MachineHealthCheckClass, out *v1beta2.MachineHealthCheckClass, s conversion.Scope) error { - // WARNING: in.UnhealthyConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_Pointer_string_To_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } - // WARNING: in.NodeStartupTimeout requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(v1beta2.MachineHealthCheckRemediationTemplateReference) - if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } - return nil -} - -func autoConvert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(in *v1beta2.MachineHealthCheckClass, out *MachineHealthCheckClass, s conversion.Scope) error { - // WARNING: in.UnhealthyNodeConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_string_To_Pointer_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } - // WARNING: in.NodeStartupTimeoutSeconds requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(corev1.ObjectReference) - if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } - return nil -} - func autoConvert_v1beta1_MachineHealthCheckList_To_v1beta2_MachineHealthCheckList(in *MachineHealthCheckList, out *v1beta2.MachineHealthCheckList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { @@ -2955,41 +2833,18 @@ func autoConvert_v1beta1_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSpe out.ClusterName = in.ClusterName out.Selector = in.Selector // WARNING: in.UnhealthyConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_Pointer_string_To_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } + // WARNING: in.MaxUnhealthy requires manual conversion: does not exist in peer-type + // WARNING: in.UnhealthyRange requires manual conversion: does not exist in peer-type // WARNING: in.NodeStartupTimeout requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(v1beta2.MachineHealthCheckRemediationTemplateReference) - if err := Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.RemediationTemplate requires manual conversion: does not exist in peer-type return nil } func autoConvert_v1beta2_MachineHealthCheckSpec_To_v1beta1_MachineHealthCheckSpec(in *v1beta2.MachineHealthCheckSpec, out *MachineHealthCheckSpec, s conversion.Scope) error { out.ClusterName = in.ClusterName out.Selector = in.Selector - // WARNING: in.UnhealthyNodeConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_string_To_Pointer_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } - // WARNING: in.NodeStartupTimeoutSeconds requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(corev1.ObjectReference) - if err := Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.Checks requires manual conversion: does not exist in peer-type + // WARNING: in.Remediation requires manual conversion: does not exist in peer-type return nil } @@ -3047,32 +2902,6 @@ func autoConvert_v1beta2_MachineHealthCheckStatus_To_v1beta1_MachineHealthCheckS return nil } -func autoConvert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(in *MachineHealthCheckTopology, out *v1beta2.MachineHealthCheckTopology, s conversion.Scope) error { - out.Enable = (*bool)(unsafe.Pointer(in.Enable)) - if err := Convert_v1beta1_MachineHealthCheckClass_To_v1beta2_MachineHealthCheckClass(&in.MachineHealthCheckClass, &out.MachineHealthCheckClass, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology is an autogenerated conversion function. -func Convert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(in *MachineHealthCheckTopology, out *v1beta2.MachineHealthCheckTopology, s conversion.Scope) error { - return autoConvert_v1beta1_MachineHealthCheckTopology_To_v1beta2_MachineHealthCheckTopology(in, out, s) -} - -func autoConvert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(in *v1beta2.MachineHealthCheckTopology, out *MachineHealthCheckTopology, s conversion.Scope) error { - out.Enable = (*bool)(unsafe.Pointer(in.Enable)) - if err := Convert_v1beta2_MachineHealthCheckClass_To_v1beta1_MachineHealthCheckClass(&in.MachineHealthCheckClass, &out.MachineHealthCheckClass, s); err != nil { - return err - } - return nil -} - -// Convert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology is an autogenerated conversion function. -func Convert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(in *v1beta2.MachineHealthCheckTopology, out *MachineHealthCheckTopology, s conversion.Scope) error { - return autoConvert_v1beta2_MachineHealthCheckTopology_To_v1beta1_MachineHealthCheckTopology(in, out, s) -} - func autoConvert_v1beta1_MachineList_To_v1beta2_MachineList(in *MachineList, out *v1beta2.MachineList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index 50abdd58559c..528c541e5a88 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -20,11 +20,13 @@ import ( "cmp" "fmt" "net" + "reflect" "strings" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/intstr" capierrors "sigs.k8s.io/cluster-api/errors" ) @@ -609,10 +611,10 @@ type ControlPlaneTopology struct { // +optional Replicas *int32 `json:"replicas,omitempty"` - // machineHealthCheck allows to enable, disable and override + // healthCheck allows to enable, disable and override // the MachineHealthCheck configuration in the ClusterClass for this control plane. // +optional - MachineHealthCheck *MachineHealthCheckTopology `json:"machineHealthCheck,omitempty"` + HealthCheck *ControlPlaneTopologyMachineHealthCheck `json:"healthCheck,omitempty"` // deletion contains configuration options for Machine deletion. // +optional @@ -639,6 +641,107 @@ type ControlPlaneTopology struct { Variables ControlPlaneVariables `json:"variables,omitempty,omitzero"` } +// ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneTopologyMachineHealthCheck struct { + // enabled controls if a MachineHealthCheck should be created for the target machines. + // + // If false: No MachineHealthCheck will be created. + // + // If not set(default): A MachineHealthCheck will be created if it is defined here or + // in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created. + // + // If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will + // block if `enable` is true and no MachineHealthCheck definition is available. + // +optional + Enabled *bool `json:"enabled,omitempty"` + + // checks are the checks that are used to evaluate if a Machine is healthy. + // +optional + Checks ControlPlaneTopologyMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // +optional + Remediation ControlPlaneTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` +} + +// IsHealthCheckConfigZero returns true if both checks and remediation are zero. +func (m *ControlPlaneTopologyMachineHealthCheck) IsHealthCheckConfigZero() bool { + return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() +} + +// ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneTopologyMachineHealthCheckChecks struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + + // unhealthyNodeConditions contains a list of 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. + // + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` +} + +// ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneTopologyMachineHealthCheckRemediation struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + // +optional + TriggerIf ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + // +optional + TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` +} + +// ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + // + // +optional + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + // + // +optional + // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=32 + UnhealthyInRange string `json:"unhealthyInRange,omitempty"` +} + // ControlPlaneTopologyMachineDeletionSpec contains configuration options for Machine deletion. // +kubebuilder:validation:MinProperties=1 type ControlPlaneTopologyMachineDeletionSpec struct { @@ -722,10 +825,10 @@ type MachineDeploymentTopology struct { // +optional Replicas *int32 `json:"replicas,omitempty"` - // machineHealthCheck allows to enable, disable and override + // healthCheck allows to enable, disable and override // the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment. // +optional - MachineHealthCheck *MachineHealthCheckTopology `json:"machineHealthCheck,omitempty"` + HealthCheck *MachineDeploymentTopologyMachineHealthCheck `json:"healthCheck,omitempty"` // deletion contains configuration options for Machine deletion. // +optional @@ -763,6 +866,107 @@ type MachineDeploymentTopology struct { Variables MachineDeploymentVariables `json:"variables,omitempty,omitzero"` } +// MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentTopologyMachineHealthCheck struct { + // enabled controls if a MachineHealthCheck should be created for the target machines. + // + // If false: No MachineHealthCheck will be created. + // + // If not set(default): A MachineHealthCheck will be created if it is defined here or + // in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created. + // + // If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will + // block if `enable` is true and no MachineHealthCheck definition is available. + // +optional + Enabled *bool `json:"enabled,omitempty"` + + // checks are the checks that are used to evaluate if a Machine is healthy. + // +optional + Checks MachineDeploymentTopologyMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // +optional + Remediation MachineDeploymentTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` +} + +// IsHealthCheckConfigZero returns true if both checks and remediation are zero. +func (m *MachineDeploymentTopologyMachineHealthCheck) IsHealthCheckConfigZero() bool { + return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() +} + +// MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentTopologyMachineHealthCheckChecks struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + + // unhealthyNodeConditions contains a list of 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. + // + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` +} + +// MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentTopologyMachineHealthCheckRemediation struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + // +optional + TriggerIf MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + // +optional + TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` +} + +// MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + // + // +optional + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + // + // +optional + // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=32 + UnhealthyInRange string `json:"unhealthyInRange,omitempty"` +} + // MachineDeploymentTopologyMachineDeletionSpec contains configuration options for Machine deletion. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentTopologyMachineDeletionSpec struct { @@ -787,26 +991,6 @@ type MachineDeploymentTopologyMachineDeletionSpec struct { NodeDeletionTimeoutSeconds *int32 `json:"nodeDeletionTimeoutSeconds,omitempty"` } -// MachineHealthCheckTopology defines a MachineHealthCheck for a group of machines. -// +kubebuilder:validation:MinProperties=1 -type MachineHealthCheckTopology struct { - // enable controls if a MachineHealthCheck should be created for the target machines. - // - // If false: No MachineHealthCheck will be created. - // - // If not set(default): A MachineHealthCheck will be created if it is defined here or - // in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created. - // - // If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will - // block if `enable` is true and no MachineHealthCheck definition is available. - // +optional - Enable *bool `json:"enable,omitempty"` - - // MachineHealthCheckClass defines a MachineHealthCheck for a group of machines. - // If specified (any field is set), it entirely overrides the MachineHealthCheckClass defined in ClusterClass. - MachineHealthCheckClass `json:",inline"` -} - // MachinePoolTopology specifies the different parameters for a pool of worker nodes in the topology. // This pool of nodes is managed by a MachinePool object whose lifecycle is managed by the Cluster controller. type MachinePoolTopology struct { diff --git a/api/core/v1beta2/clusterclass_types.go b/api/core/v1beta2/clusterclass_types.go index 5243e9611fd1..893a53c7c75f 100644 --- a/api/core/v1beta2/clusterclass_types.go +++ b/api/core/v1beta2/clusterclass_types.go @@ -17,8 +17,6 @@ limitations under the License. package v1beta2 import ( - "reflect" - corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -169,11 +167,11 @@ type ControlPlaneClass struct { // +optional MachineInfrastructure *ControlPlaneClassMachineInfrastructureTemplate `json:"machineInfrastructure,omitempty"` - // machineHealthCheck defines a MachineHealthCheck for this ControlPlaneClass. + // healthCheck defines a MachineHealthCheck for this ControlPlaneClass. // This field is supported if and only if the ControlPlane provider template // referenced above is Machine based and supports setting replicas. // +optional - MachineHealthCheck *MachineHealthCheckClass `json:"machineHealthCheck,omitempty"` + HealthCheck *ControlPlaneClassMachineHealthCheck `json:"healthCheck,omitempty"` // namingStrategy allows changing the naming pattern used when creating the control plane provider object. // +optional @@ -200,6 +198,90 @@ type ControlPlaneClass struct { ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"` } +// ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneClassMachineHealthCheck struct { + // checks are the checks that are used to evaluate if a Machine is healthy. + // +optional + Checks ControlPlaneClassMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // +optional + Remediation ControlPlaneClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` +} + +// ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneClassMachineHealthCheckChecks struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + + // unhealthyNodeConditions contains a list of 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. + // + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` +} + +// ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneClassMachineHealthCheckRemediation struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + // +optional + TriggerIf ControlPlaneClassMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + // +optional + TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` +} + +// ControlPlaneClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// +kubebuilder:validation:MinProperties=1 +type ControlPlaneClassMachineHealthCheckRemediationTriggerIf struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + // + // +optional + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + // + // +optional + // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=32 + UnhealthyInRange string `json:"unhealthyInRange,omitempty"` +} + // ControlPlaneClassMachineDeletionSpec contains configuration options for Machine deletion. // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassMachineDeletionSpec struct { @@ -303,9 +385,9 @@ type MachineDeploymentClass struct { // +required Infrastructure MachineDeploymentClassInfrastructureTemplate `json:"infrastructure"` - // machineHealthCheck defines a MachineHealthCheck for this MachineDeploymentClass. + // healthCheck defines a MachineHealthCheck for this MachineDeploymentClass. // +optional - MachineHealthCheck *MachineHealthCheckClass `json:"machineHealthCheck,omitempty"` + HealthCheck *MachineDeploymentClassMachineHealthCheck `json:"healthCheck,omitempty"` // failureDomain is the failure domain the machines will be created in. // Must match the name of a FailureDomain from the Cluster status. @@ -353,6 +435,90 @@ type MachineDeploymentClass struct { Strategy MachineDeploymentStrategy `json:"strategy,omitempty,omitzero"` } +// MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentClassMachineHealthCheck struct { + // checks are the checks that are used to evaluate if a Machine is healthy. + // +optional + Checks MachineDeploymentClassMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + + // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // +optional + Remediation MachineDeploymentClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` +} + +// MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentClassMachineHealthCheckChecks struct { + // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + // to consider a Machine unhealthy if a corresponding Node isn't associated + // through a `Spec.ProviderID` field. + // + // The duration set in this field is compared to the greatest of: + // - Cluster's infrastructure ready condition timestamp (if and when available) + // - Control Plane's initialized condition timestamp (if and when available) + // - Machine's infrastructure ready condition timestamp (if and when available) + // - Machine's metadata creation timestamp + // + // Defaults to 10 minutes. + // If you wish to disable this feature, set the value explicitly to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` + + // unhealthyNodeConditions contains a list of 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. + // + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` +} + +// MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentClassMachineHealthCheckRemediation struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + // +optional + TriggerIf MachineDeploymentClassMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + + // templateRef is a reference to a remediation template + // provided by an infrastructure provider. + // + // This field is completely optional, when filled, the MachineHealthCheck controller + // creates a new object from the template referenced and hands off remediation of the machine to + // a controller that lives outside of Cluster API. + // +optional + TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` +} + +// MachineDeploymentClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// +kubebuilder:validation:MinProperties=1 +type MachineDeploymentClassMachineHealthCheckRemediationTriggerIf struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + // + // +optional + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + // + // +optional + // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=32 + UnhealthyInRange string `json:"unhealthyInRange,omitempty"` +} + // MachineDeploymentClassMachineDeletionSpec contains configuration options for Machine deletion. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassMachineDeletionSpec struct { @@ -396,63 +562,6 @@ type MachineDeploymentClassNamingStrategy struct { Template string `json:"template,omitempty"` } -// MachineHealthCheckClass defines a MachineHealthCheck for a group of Machines. -// +kubebuilder:validation:MinProperties=1 -type MachineHealthCheckClass struct { - // unhealthyNodeConditions contains a list of 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. - // - // +optional - // +listType=atomic - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=100 - UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` - - // maxUnhealthy specifies the maximum number of unhealthy machines allowed. - // Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - // "selector" are not healthy. - // +optional - MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"` - - // unhealthyRange specifies the range of unhealthy machines allowed. - // Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - // is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - // Eg. "[3-5]" - This means that remediation will be allowed only when: - // (a) there are at least 3 unhealthy machines (and) - // (b) there are at most 5 unhealthy machines - // +optional - // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=32 - UnhealthyRange string `json:"unhealthyRange,omitempty"` - - // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - // to consider a Machine unhealthy if a corresponding Node isn't associated - // through a `Spec.ProviderID` field. - // - // The duration set in this field is compared to the greatest of: - // - Cluster's infrastructure ready condition timestamp (if and when available) - // - Control Plane's initialized condition timestamp (if and when available) - // - Machine's infrastructure ready condition timestamp (if and when available) - // - Machine's metadata creation timestamp - // - // Defaults to 10 minutes. - // If you wish to disable this feature, set the value explicitly to 0. - // +optional - // +kubebuilder:validation:Minimum=0 - NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` - - // remediationTemplate is a reference to a remediation template - // provided by an infrastructure provider. - // - // This field is completely optional, when filled, the MachineHealthCheck controller - // creates a new object from the template referenced and hands off remediation of the machine to - // a controller that lives outside of Cluster API. - // +optional - RemediationTemplate *MachineHealthCheckRemediationTemplateReference `json:"remediationTemplate,omitempty"` -} - // MachinePoolClass serves as a template to define a pool of worker nodes of the cluster // provisioned using `ClusterClass`. type MachinePoolClass struct { @@ -550,11 +659,6 @@ type MachinePoolClassNamingStrategy struct { Template string `json:"template,omitempty"` } -// IsZero returns true if none of the values of MachineHealthCheckClass are defined. -func (m MachineHealthCheckClass) IsZero() bool { - return reflect.ValueOf(m).IsZero() -} - // ClusterClassVariable defines a variable which can // be configured in the Cluster topology and used in patches. type ClusterClassVariable struct { diff --git a/api/core/v1beta2/machinehealthcheck_types.go b/api/core/v1beta2/machinehealthcheck_types.go index 2278495e1731..82d95e95e34c 100644 --- a/api/core/v1beta2/machinehealthcheck_types.go +++ b/api/core/v1beta2/machinehealthcheck_types.go @@ -60,40 +60,18 @@ type MachineHealthCheckSpec struct { // +required Selector metav1.LabelSelector `json:"selector"` - // unhealthyNodeConditions contains a list of 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. - // + // checks are the checks that are used to evaluate if a Machine is healthy. // +optional - // +listType=atomic - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=100 - UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` + Checks MachineHealthCheckChecks `json:"checks,omitempty,omitzero"` - // maxUnhealthy specifies the maximum number of unhealthy machines allowed. - // Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - // "selector" are not healthy. - // - // Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details. - // + // remediation configures if and how remediations are triggered if a Machine is unhealthy. // +optional - MaxUnhealthy *intstr.IntOrString `json:"maxUnhealthy,omitempty"` - - // unhealthyRange specifies the range of unhealthy machines allowed. - // Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - // is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - // Eg. "[3-5]" - This means that remediation will be allowed only when: - // (a) there are at least 3 unhealthy machines (and) - // (b) there are at most 5 unhealthy machines - // - // Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details. - // - // +optional - // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=32 - UnhealthyRange string `json:"unhealthyRange,omitempty"` + Remediation MachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` +} +// MachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// +kubebuilder:validation:MinProperties=1 +type MachineHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck // to consider a Machine unhealthy if a corresponding Node isn't associated // through a `Spec.ProviderID` field. @@ -110,14 +88,57 @@ type MachineHealthCheckSpec struct { // +kubebuilder:validation:Minimum=0 NodeStartupTimeoutSeconds *int32 `json:"nodeStartupTimeoutSeconds,omitempty"` - // remediationTemplate is a reference to a remediation template + // unhealthyNodeConditions contains a list of 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. + // + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` +} + +// MachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// +kubebuilder:validation:MinProperties=1 +type MachineHealthCheckRemediation struct { + // triggerIf configures if remediations are triggered. + // If this field is not set, remediations are always triggered. + // +optional + TriggerIf MachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + + // templateRef is a reference to a remediation template // provided by an infrastructure provider. // // This field is completely optional, when filled, the MachineHealthCheck controller // creates a new object from the template referenced and hands off remediation of the machine to // a controller that lives outside of Cluster API. // +optional - RemediationTemplate *MachineHealthCheckRemediationTemplateReference `json:"remediationTemplate,omitempty"` + TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` +} + +// MachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// +kubebuilder:validation:MinProperties=1 +type MachineHealthCheckRemediationTriggerIf struct { + // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + // unhealthy Machines is less than or equal to the configured value. + // unhealthyInRange takes precedence if set. + // + // +optional + UnhealthyLessThanOrEqualTo *intstr.IntOrString `json:"unhealthyLessThanOrEqualTo,omitempty"` + + // unhealthyInRange specifies that remediations are only triggered if the number of + // unhealthy Machines is in the configured range. + // Takes precedence over unhealthyLessThanOrEqualTo. + // Eg. "[3-5]" - This means that remediation will be allowed only when: + // (a) there are at least 3 unhealthy Machines (and) + // (b) there are at most 5 unhealthy Machines + // + // +optional + // +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$ + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=32 + UnhealthyInRange string `json:"unhealthyInRange,omitempty"` } // MachineHealthCheckRemediationTemplateReference is a reference to a remediation template. @@ -271,7 +292,7 @@ type MachineHealthCheckV1Beta1DeprecatedStatus struct { // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.clusterName",description="Cluster" // +kubebuilder:printcolumn:name="ExpectedMachines",type="integer",JSONPath=".status.expectedMachines",description="Number of machines currently monitored" -// +kubebuilder:printcolumn:name="MaxUnhealthy",type="string",JSONPath=".spec.maxUnhealthy",description="Maximum number of unhealthy machines allowed" +// +kubebuilder:printcolumn:name="UnhealthyLessThanOrEqualTo",type="string",JSONPath=".spec.remediation.triggerIf.unhealthyLessThanOrEqualTo",description="Maximum number of unhealthy machines allowed" // +kubebuilder:printcolumn:name="CurrentHealthy",type="integer",JSONPath=".status.currentHealthy",description="Current observed healthy machines" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachineHealthCheck" diff --git a/api/core/v1beta2/zz_generated.deepcopy.go b/api/core/v1beta2/zz_generated.deepcopy.go index 89132145520f..22dab2bbe36d 100644 --- a/api/core/v1beta2/zz_generated.deepcopy.go +++ b/api/core/v1beta2/zz_generated.deepcopy.go @@ -761,9 +761,9 @@ func (in *ControlPlaneClass) DeepCopyInto(out *ControlPlaneClass) { *out = new(ControlPlaneClassMachineInfrastructureTemplate) **out = **in } - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckClass) + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(ControlPlaneClassMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.NamingStrategy != nil { @@ -819,6 +819,89 @@ func (in *ControlPlaneClassMachineDeletionSpec) DeepCopy() *ControlPlaneClassMac return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneClassMachineHealthCheck) DeepCopyInto(out *ControlPlaneClassMachineHealthCheck) { + *out = *in + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheck. +func (in *ControlPlaneClassMachineHealthCheck) DeepCopy() *ControlPlaneClassMachineHealthCheck { + if in == nil { + return nil + } + out := new(ControlPlaneClassMachineHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneClassMachineHealthCheckChecks) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckChecks) { + *out = *in + if in.NodeStartupTimeoutSeconds != nil { + in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckChecks. +func (in *ControlPlaneClassMachineHealthCheckChecks) DeepCopy() *ControlPlaneClassMachineHealthCheckChecks { + if in == nil { + return nil + } + out := new(ControlPlaneClassMachineHealthCheckChecks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneClassMachineHealthCheckRemediation) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckRemediation) { + *out = *in + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckRemediation. +func (in *ControlPlaneClassMachineHealthCheckRemediation) DeepCopy() *ControlPlaneClassMachineHealthCheckRemediation { + if in == nil { + return nil + } + out := new(ControlPlaneClassMachineHealthCheckRemediation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) { + *out = *in + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo + *out = new(intstr.IntOrString) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckRemediationTriggerIf. +func (in *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneClassMachineHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(ControlPlaneClassMachineHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControlPlaneClassMachineInfrastructureTemplate) DeepCopyInto(out *ControlPlaneClassMachineInfrastructureTemplate) { *out = *in @@ -859,9 +942,9 @@ func (in *ControlPlaneTopology) DeepCopyInto(out *ControlPlaneTopology) { *out = new(int32) **out = **in } - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckTopology) + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(ControlPlaneTopologyMachineHealthCheck) (*in).DeepCopyInto(*out) } in.Deletion.DeepCopyInto(&out.Deletion) @@ -913,6 +996,94 @@ func (in *ControlPlaneTopologyMachineDeletionSpec) DeepCopy() *ControlPlaneTopol return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneTopologyMachineHealthCheck) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheck) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheck. +func (in *ControlPlaneTopologyMachineHealthCheck) DeepCopy() *ControlPlaneTopologyMachineHealthCheck { + if in == nil { + return nil + } + out := new(ControlPlaneTopologyMachineHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneTopologyMachineHealthCheckChecks) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckChecks) { + *out = *in + if in.NodeStartupTimeoutSeconds != nil { + in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckChecks. +func (in *ControlPlaneTopologyMachineHealthCheckChecks) DeepCopy() *ControlPlaneTopologyMachineHealthCheckChecks { + if in == nil { + return nil + } + out := new(ControlPlaneTopologyMachineHealthCheckChecks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneTopologyMachineHealthCheckRemediation) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckRemediation) { + *out = *in + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckRemediation. +func (in *ControlPlaneTopologyMachineHealthCheckRemediation) DeepCopy() *ControlPlaneTopologyMachineHealthCheckRemediation { + if in == nil { + return nil + } + out := new(ControlPlaneTopologyMachineHealthCheckRemediation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) { + *out = *in + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo + *out = new(intstr.IntOrString) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf. +func (in *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ControlPlaneVariables) DeepCopyInto(out *ControlPlaneVariables) { *out = *in @@ -1362,9 +1533,9 @@ func (in *MachineDeploymentClass) DeepCopyInto(out *MachineDeploymentClass) { in.Metadata.DeepCopyInto(&out.Metadata) out.Bootstrap = in.Bootstrap out.Infrastructure = in.Infrastructure - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckClass) + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(MachineDeploymentClassMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.NamingStrategy != nil { @@ -1458,6 +1629,89 @@ func (in *MachineDeploymentClassMachineDeletionSpec) DeepCopy() *MachineDeployme return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentClassMachineHealthCheck) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheck) { + *out = *in + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheck. +func (in *MachineDeploymentClassMachineHealthCheck) DeepCopy() *MachineDeploymentClassMachineHealthCheck { + if in == nil { + return nil + } + out := new(MachineDeploymentClassMachineHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentClassMachineHealthCheckChecks) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckChecks) { + *out = *in + if in.NodeStartupTimeoutSeconds != nil { + in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckChecks. +func (in *MachineDeploymentClassMachineHealthCheckChecks) DeepCopy() *MachineDeploymentClassMachineHealthCheckChecks { + if in == nil { + return nil + } + out := new(MachineDeploymentClassMachineHealthCheckChecks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentClassMachineHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckRemediation) { + *out = *in + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckRemediation. +func (in *MachineDeploymentClassMachineHealthCheckRemediation) DeepCopy() *MachineDeploymentClassMachineHealthCheckRemediation { + if in == nil { + return nil + } + out := new(MachineDeploymentClassMachineHealthCheckRemediation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) { + *out = *in + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo + *out = new(intstr.IntOrString) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckRemediationTriggerIf. +func (in *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineDeploymentClassNamingStrategy) DeepCopyInto(out *MachineDeploymentClassNamingStrategy) { *out = *in @@ -1660,9 +1914,9 @@ func (in *MachineDeploymentTopology) DeepCopyInto(out *MachineDeploymentTopology *out = new(int32) **out = **in } - if in.MachineHealthCheck != nil { - in, out := &in.MachineHealthCheck, &out.MachineHealthCheck - *out = new(MachineHealthCheckTopology) + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(MachineDeploymentTopologyMachineHealthCheck) (*in).DeepCopyInto(*out) } in.Deletion.DeepCopyInto(&out.Deletion) @@ -1720,6 +1974,94 @@ func (in *MachineDeploymentTopologyMachineDeletionSpec) DeepCopy() *MachineDeplo return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentTopologyMachineHealthCheck) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheck) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheck. +func (in *MachineDeploymentTopologyMachineHealthCheck) DeepCopy() *MachineDeploymentTopologyMachineHealthCheck { + if in == nil { + return nil + } + out := new(MachineDeploymentTopologyMachineHealthCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentTopologyMachineHealthCheckChecks) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckChecks) { + *out = *in + if in.NodeStartupTimeoutSeconds != nil { + in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckChecks. +func (in *MachineDeploymentTopologyMachineHealthCheckChecks) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckChecks { + if in == nil { + return nil + } + out := new(MachineDeploymentTopologyMachineHealthCheckChecks) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentTopologyMachineHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckRemediation) { + *out = *in + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckRemediation. +func (in *MachineDeploymentTopologyMachineHealthCheckRemediation) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckRemediation { + if in == nil { + return nil + } + out := new(MachineDeploymentTopologyMachineHealthCheckRemediation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) { + *out = *in + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo + *out = new(intstr.IntOrString) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf. +func (in *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineDeploymentV1Beta1DeprecatedStatus) DeepCopyInto(out *MachineDeploymentV1Beta1DeprecatedStatus) { *out = *in @@ -1970,36 +2312,26 @@ func (in *MachineHealthCheck) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineHealthCheckClass) DeepCopyInto(out *MachineHealthCheckClass) { +func (in *MachineHealthCheckChecks) DeepCopyInto(out *MachineHealthCheckChecks) { *out = *in - if in.UnhealthyNodeConditions != nil { - in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions - *out = make([]UnhealthyNodeCondition, len(*in)) - copy(*out, *in) - } - if in.MaxUnhealthy != nil { - in, out := &in.MaxUnhealthy, &out.MaxUnhealthy - *out = new(intstr.IntOrString) - **out = **in - } if in.NodeStartupTimeoutSeconds != nil { in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds *out = new(int32) **out = **in } - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(MachineHealthCheckRemediationTemplateReference) - **out = **in + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckClass. -func (in *MachineHealthCheckClass) DeepCopy() *MachineHealthCheckClass { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckChecks. +func (in *MachineHealthCheckChecks) DeepCopy() *MachineHealthCheckChecks { if in == nil { return nil } - out := new(MachineHealthCheckClass) + out := new(MachineHealthCheckChecks) in.DeepCopyInto(out) return out } @@ -2056,6 +2388,27 @@ func (in *MachineHealthCheckList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineHealthCheckRemediation) DeepCopyInto(out *MachineHealthCheckRemediation) { + *out = *in + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckRemediation. +func (in *MachineHealthCheckRemediation) DeepCopy() *MachineHealthCheckRemediation { + if in == nil { + return nil + } + out := new(MachineHealthCheckRemediation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineHealthCheckRemediationTemplateReference) DeepCopyInto(out *MachineHealthCheckRemediationTemplateReference) { *out = *in @@ -2072,29 +2425,31 @@ func (in *MachineHealthCheckRemediationTemplateReference) DeepCopy() *MachineHea } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineHealthCheckSpec) DeepCopyInto(out *MachineHealthCheckSpec) { +func (in *MachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineHealthCheckRemediationTriggerIf) { *out = *in - in.Selector.DeepCopyInto(&out.Selector) - if in.UnhealthyNodeConditions != nil { - in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions - *out = make([]UnhealthyNodeCondition, len(*in)) - copy(*out, *in) - } - if in.MaxUnhealthy != nil { - in, out := &in.MaxUnhealthy, &out.MaxUnhealthy + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo *out = new(intstr.IntOrString) **out = **in } - if in.NodeStartupTimeoutSeconds != nil { - in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(MachineHealthCheckRemediationTemplateReference) - **out = **in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckRemediationTriggerIf. +func (in *MachineHealthCheckRemediationTriggerIf) DeepCopy() *MachineHealthCheckRemediationTriggerIf { + if in == nil { + return nil } + out := new(MachineHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + +// 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) + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckSpec. @@ -2154,27 +2509,6 @@ func (in *MachineHealthCheckStatus) DeepCopy() *MachineHealthCheckStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineHealthCheckTopology) DeepCopyInto(out *MachineHealthCheckTopology) { - *out = *in - if in.Enable != nil { - in, out := &in.Enable, &out.Enable - *out = new(bool) - **out = **in - } - in.MachineHealthCheckClass.DeepCopyInto(&out.MachineHealthCheckClass) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckTopology. -func (in *MachineHealthCheckTopology) DeepCopy() *MachineHealthCheckTopology { - if in == nil { - return nil - } - out := new(MachineHealthCheckTopology) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineHealthCheckV1Beta1DeprecatedStatus) DeepCopyInto(out *MachineHealthCheckV1Beta1DeprecatedStatus) { *out = *in diff --git a/api/core/v1beta2/zz_generated.openapi.go b/api/core/v1beta2/zz_generated.openapi.go index 3b1d54fded4a..6b70c3ce9390 100644 --- a/api/core/v1beta2/zz_generated.openapi.go +++ b/api/core/v1beta2/zz_generated.openapi.go @@ -28,130 +28,147 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.APIEndpoint": schema_cluster_api_api_core_v1beta2_APIEndpoint(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Bootstrap": schema_cluster_api_api_core_v1beta2_Bootstrap(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Cluster": schema_cluster_api_api_core_v1beta2_Cluster(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterAvailabilityGate": schema_cluster_api_api_core_v1beta2_ClusterAvailabilityGate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClass": schema_cluster_api_api_core_v1beta2_ClusterClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassList": schema_cluster_api_api_core_v1beta2_ClusterClassList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassPatch": schema_cluster_api_api_core_v1beta2_ClusterClassPatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassRef": schema_cluster_api_api_core_v1beta2_ClusterClassRef(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassSpec": schema_cluster_api_api_core_v1beta2_ClusterClassSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatus": schema_cluster_api_api_core_v1beta2_ClusterClassStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariable": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariableDefinition": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariableDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference": schema_cluster_api_api_core_v1beta2_ClusterClassTemplateReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariable": schema_cluster_api_api_core_v1beta2_ClusterClassVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariableMetadata": schema_cluster_api_api_core_v1beta2_ClusterClassVariableMetadata(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterControlPlaneStatus": schema_cluster_api_api_core_v1beta2_ClusterControlPlaneStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterInitializationStatus": schema_cluster_api_api_core_v1beta2_ClusterInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterList": schema_cluster_api_api_core_v1beta2_ClusterList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterNetwork": schema_cluster_api_api_core_v1beta2_ClusterNetwork(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterSpec": schema_cluster_api_api_core_v1beta2_ClusterSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterStatus": schema_cluster_api_api_core_v1beta2_ClusterStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterVariable": schema_cluster_api_api_core_v1beta2_ClusterVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Condition": schema_cluster_api_api_core_v1beta2_Condition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ContractVersionedObjectReference": schema_cluster_api_api_core_v1beta2_ContractVersionedObjectReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClass": schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy": schema_cluster_api_api_core_v1beta2_ControlPlaneClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopology": schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables": schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ExternalPatchDefinition": schema_cluster_api_api_core_v1beta2_ExternalPatchDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.FailureDomain": schema_cluster_api_api_core_v1beta2_FailureDomain(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClass": schema_cluster_api_api_core_v1beta2_InfrastructureClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClassNamingStrategy": schema_cluster_api_api_core_v1beta2_InfrastructureClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatch": schema_cluster_api_api_core_v1beta2_JSONPatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatchValue": schema_cluster_api_api_core_v1beta2_JSONPatchValue(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONSchemaProps": schema_cluster_api_api_core_v1beta2_JSONSchemaProps(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Machine": schema_cluster_api_api_core_v1beta2_Machine(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineAddress": schema_cluster_api_api_core_v1beta2_MachineAddress(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionStatus": schema_cluster_api_api_core_v1beta2_MachineDeletionStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeployment": schema_cluster_api_api_core_v1beta2_MachineDeployment(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClass": schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassBootstrapTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentList": schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategyRollingUpdate": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategyRollingUpdate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopology": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables": schema_cluster_api_api_core_v1beta2_MachineDeploymentVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRule": schema_cluster_api_api_core_v1beta2_MachineDrainRule(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleDrainConfig": schema_cluster_api_api_core_v1beta2_MachineDrainRuleDrainConfig(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleList": schema_cluster_api_api_core_v1beta2_MachineDrainRuleList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleMachineSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRuleMachineSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRulePodSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRulePodSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleSpec": schema_cluster_api_api_core_v1beta2_MachineDrainRuleSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckClass": schema_cluster_api_api_core_v1beta2_MachineHealthCheckClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckList": schema_cluster_api_api_core_v1beta2_MachineHealthCheckList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckSpec": schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckTopology": schema_cluster_api_api_core_v1beta2_MachineHealthCheckTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineInitializationStatus": schema_cluster_api_api_core_v1beta2_MachineInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineList": schema_cluster_api_api_core_v1beta2_MachineList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNodeReference": schema_cluster_api_api_core_v1beta2_MachineNodeReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePool": schema_cluster_api_api_core_v1beta2_MachinePool(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClass": schema_cluster_api_api_core_v1beta2_MachinePoolClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassBootstrapTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachinePoolClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolInitializationStatus": schema_cluster_api_api_core_v1beta2_MachinePoolInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolList": schema_cluster_api_api_core_v1beta2_MachinePoolList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolSpec": schema_cluster_api_api_core_v1beta2_MachinePoolSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolStatus": schema_cluster_api_api_core_v1beta2_MachinePoolStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopology": schema_cluster_api_api_core_v1beta2_MachinePoolTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolVariables": schema_cluster_api_api_core_v1beta2_MachinePoolVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate": schema_cluster_api_api_core_v1beta2_MachineReadinessGate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSet": schema_cluster_api_api_core_v1beta2_MachineSet(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetList": schema_cluster_api_api_core_v1beta2_MachineSetList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetSpec": schema_cluster_api_api_core_v1beta2_MachineSetSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetStatus": schema_cluster_api_api_core_v1beta2_MachineSetStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSpec": schema_cluster_api_api_core_v1beta2_MachineSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineStatus": schema_cluster_api_api_core_v1beta2_MachineStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineTemplateSpec": schema_cluster_api_api_core_v1beta2_MachineTemplateSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.NetworkRanges": schema_cluster_api_api_core_v1beta2_NetworkRanges(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta": schema_cluster_api_api_core_v1beta2_ObjectMeta(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchDefinition": schema_cluster_api_api_core_v1beta2_PatchDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelector": schema_cluster_api_api_core_v1beta2_PatchSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatch": schema_cluster_api_api_core_v1beta2_PatchSelectorMatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachineDeploymentClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachineDeploymentClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachinePoolClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachinePoolClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.RemediationStrategy": schema_cluster_api_api_core_v1beta2_RemediationStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Topology": schema_cluster_api_api_core_v1beta2_Topology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition": schema_cluster_api_api_core_v1beta2_UnhealthyNodeCondition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ValidationRule": schema_cluster_api_api_core_v1beta2_ValidationRule(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchema": schema_cluster_api_api_core_v1beta2_VariableSchema(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchemaMetadata": schema_cluster_api_api_core_v1beta2_VariableSchemaMetadata(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersClass": schema_cluster_api_api_core_v1beta2_WorkersClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersStatus": schema_cluster_api_api_core_v1beta2_WorkersStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersTopology": schema_cluster_api_api_core_v1beta2_WorkersTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.APIEndpoint": schema_cluster_api_api_core_v1beta2_APIEndpoint(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Bootstrap": schema_cluster_api_api_core_v1beta2_Bootstrap(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Cluster": schema_cluster_api_api_core_v1beta2_Cluster(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterAvailabilityGate": schema_cluster_api_api_core_v1beta2_ClusterAvailabilityGate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClass": schema_cluster_api_api_core_v1beta2_ClusterClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassList": schema_cluster_api_api_core_v1beta2_ClusterClassList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassPatch": schema_cluster_api_api_core_v1beta2_ClusterClassPatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassRef": schema_cluster_api_api_core_v1beta2_ClusterClassRef(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassSpec": schema_cluster_api_api_core_v1beta2_ClusterClassSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatus": schema_cluster_api_api_core_v1beta2_ClusterClassStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariable": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariableDefinition": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariableDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference": schema_cluster_api_api_core_v1beta2_ClusterClassTemplateReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariable": schema_cluster_api_api_core_v1beta2_ClusterClassVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariableMetadata": schema_cluster_api_api_core_v1beta2_ClusterClassVariableMetadata(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterControlPlaneStatus": schema_cluster_api_api_core_v1beta2_ClusterControlPlaneStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterInitializationStatus": schema_cluster_api_api_core_v1beta2_ClusterInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterList": schema_cluster_api_api_core_v1beta2_ClusterList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterNetwork": schema_cluster_api_api_core_v1beta2_ClusterNetwork(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterSpec": schema_cluster_api_api_core_v1beta2_ClusterSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterStatus": schema_cluster_api_api_core_v1beta2_ClusterStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterVariable": schema_cluster_api_api_core_v1beta2_ClusterVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Condition": schema_cluster_api_api_core_v1beta2_Condition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ContractVersionedObjectReference": schema_cluster_api_api_core_v1beta2_ContractVersionedObjectReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClass": schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy": schema_cluster_api_api_core_v1beta2_ControlPlaneClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopology": schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables": schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ExternalPatchDefinition": schema_cluster_api_api_core_v1beta2_ExternalPatchDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.FailureDomain": schema_cluster_api_api_core_v1beta2_FailureDomain(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClass": schema_cluster_api_api_core_v1beta2_InfrastructureClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClassNamingStrategy": schema_cluster_api_api_core_v1beta2_InfrastructureClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatch": schema_cluster_api_api_core_v1beta2_JSONPatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatchValue": schema_cluster_api_api_core_v1beta2_JSONPatchValue(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONSchemaProps": schema_cluster_api_api_core_v1beta2_JSONSchemaProps(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Machine": schema_cluster_api_api_core_v1beta2_Machine(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineAddress": schema_cluster_api_api_core_v1beta2_MachineAddress(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionStatus": schema_cluster_api_api_core_v1beta2_MachineDeletionStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeployment": schema_cluster_api_api_core_v1beta2_MachineDeployment(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClass": schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassBootstrapTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentList": schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategyRollingUpdate": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategyRollingUpdate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopology": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables": schema_cluster_api_api_core_v1beta2_MachineDeploymentVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRule": schema_cluster_api_api_core_v1beta2_MachineDrainRule(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleDrainConfig": schema_cluster_api_api_core_v1beta2_MachineDrainRuleDrainConfig(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleList": schema_cluster_api_api_core_v1beta2_MachineDrainRuleList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleMachineSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRuleMachineSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRulePodSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRulePodSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleSpec": schema_cluster_api_api_core_v1beta2_MachineDrainRuleSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckList": schema_cluster_api_api_core_v1beta2_MachineHealthCheckList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckSpec": schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineInitializationStatus": schema_cluster_api_api_core_v1beta2_MachineInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineList": schema_cluster_api_api_core_v1beta2_MachineList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNodeReference": schema_cluster_api_api_core_v1beta2_MachineNodeReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePool": schema_cluster_api_api_core_v1beta2_MachinePool(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClass": schema_cluster_api_api_core_v1beta2_MachinePoolClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassBootstrapTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachinePoolClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolInitializationStatus": schema_cluster_api_api_core_v1beta2_MachinePoolInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolList": schema_cluster_api_api_core_v1beta2_MachinePoolList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolSpec": schema_cluster_api_api_core_v1beta2_MachinePoolSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolStatus": schema_cluster_api_api_core_v1beta2_MachinePoolStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopology": schema_cluster_api_api_core_v1beta2_MachinePoolTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolVariables": schema_cluster_api_api_core_v1beta2_MachinePoolVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate": schema_cluster_api_api_core_v1beta2_MachineReadinessGate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSet": schema_cluster_api_api_core_v1beta2_MachineSet(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetList": schema_cluster_api_api_core_v1beta2_MachineSetList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetSpec": schema_cluster_api_api_core_v1beta2_MachineSetSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetStatus": schema_cluster_api_api_core_v1beta2_MachineSetStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSpec": schema_cluster_api_api_core_v1beta2_MachineSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineStatus": schema_cluster_api_api_core_v1beta2_MachineStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineTemplateSpec": schema_cluster_api_api_core_v1beta2_MachineTemplateSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.NetworkRanges": schema_cluster_api_api_core_v1beta2_NetworkRanges(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta": schema_cluster_api_api_core_v1beta2_ObjectMeta(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchDefinition": schema_cluster_api_api_core_v1beta2_PatchDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelector": schema_cluster_api_api_core_v1beta2_PatchSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatch": schema_cluster_api_api_core_v1beta2_PatchSelectorMatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachineDeploymentClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachineDeploymentClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachinePoolClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachinePoolClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.RemediationStrategy": schema_cluster_api_api_core_v1beta2_RemediationStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Topology": schema_cluster_api_api_core_v1beta2_Topology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition": schema_cluster_api_api_core_v1beta2_UnhealthyNodeCondition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ValidationRule": schema_cluster_api_api_core_v1beta2_ValidationRule(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchema": schema_cluster_api_api_core_v1beta2_VariableSchema(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchemaMetadata": schema_cluster_api_api_core_v1beta2_VariableSchemaMetadata(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersClass": schema_cluster_api_api_core_v1beta2_WorkersClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersStatus": schema_cluster_api_api_core_v1beta2_WorkersStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersTopology": schema_cluster_api_api_core_v1beta2_WorkersTopology(ref), } } @@ -1486,10 +1503,10 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref common.ReferenceC Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate"), }, }, - "machineHealthCheck": { + "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "machineHealthCheck defines a MachineHealthCheck for this ControlPlaneClass. This field is supported if and only if the ControlPlane provider template referenced above is Machine based and supports setting replicas.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckClass"), + Description: "healthCheck defines a MachineHealthCheck for this ControlPlaneClass. This field is supported if and only if the ControlPlane provider template referenced above is Machine based and supports setting replicas.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck"), }, }, "namingStrategy": { @@ -1532,7 +1549,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref common.ReferenceC }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckClass", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } @@ -1570,6 +1587,132 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(re } } +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "checks": { + SchemaProps: spec.SchemaProps{ + Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks"), + }, + }, + "remediation": { + SchemaProps: spec.SchemaProps{ + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeStartupTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unhealthyNodeConditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "unhealthyNodeConditions contains a list of 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.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "triggerIf": { + SchemaProps: spec.SchemaProps{ + Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf"), + }, + }, + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "unhealthyLessThanOrEqualTo": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of unhealthy Machines is less than or equal to the configured value. unhealthyInRange takes precedence if set.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "unhealthyInRange": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyInRange specifies that remediations are only triggered if the number of unhealthy Machines is in the configured range. Takes precedence over unhealthyLessThanOrEqualTo. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy Machines (and) (b) there are at most 5 unhealthy Machines", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1634,10 +1777,10 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref common.Referen Format: "int32", }, }, - "machineHealthCheck": { + "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "machineHealthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this control plane.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckTopology"), + Description: "healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this control plane.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck"), }, }, "deletion": { @@ -1680,7 +1823,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref common.Referen }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckTopology", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } @@ -1718,6 +1861,139 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec } } +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Description: "enabled controls if a MachineHealthCheck should be created for the target machines.\n\nIf false: No MachineHealthCheck will be created.\n\nIf not set(default): A MachineHealthCheck will be created if it is defined here or\n in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.\n\nIf true: A MachineHealthCheck is guaranteed to be created. Cluster validation will block if `enable` is true and no MachineHealthCheck definition is available.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "checks": { + SchemaProps: spec.SchemaProps{ + Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks"), + }, + }, + "remediation": { + SchemaProps: spec.SchemaProps{ + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeStartupTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unhealthyNodeConditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "unhealthyNodeConditions contains a list of 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.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "triggerIf": { + SchemaProps: spec.SchemaProps{ + Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf"), + }, + }, + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + } +} + +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "unhealthyLessThanOrEqualTo": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of unhealthy Machines is less than or equal to the configured value. unhealthyInRange takes precedence if set.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "unhealthyInRange": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyInRange specifies that remediations are only triggered if the number of unhealthy Machines is in the configured range. Takes precedence over unhealthyLessThanOrEqualTo. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy Machines (and) (b) there are at most 5 unhealthy Machines", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + func schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2486,10 +2762,10 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref common.Refer Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate"), }, }, - "machineHealthCheck": { + "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "machineHealthCheck defines a MachineHealthCheck for this MachineDeploymentClass.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckClass"), + Description: "healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck"), }, }, "failureDomain": { @@ -2553,7 +2829,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref common.Refer }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckClass", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } @@ -2637,58 +2913,184 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSp } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassNamingStrategy defines the naming strategy for machine deployment objects.", + Description: "MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for a group of machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "template": { + "checks": { SchemaProps: spec.SchemaProps{ - Description: "template defines the template to use for generating the name of the MachineDeployment object. If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`. If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will get concatenated with a random suffix of length 5. The templating mechanism provides the following arguments: * `.cluster.name`: The name of the cluster object. * `.random`: A random alphanumeric string, without vowels, of length 5. * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).", - Type: []string{"string"}, - Format: "", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks"), + }, + }, + "remediation": { + SchemaProps: spec.SchemaProps{ + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation"), }, }, }, }, }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Description: "MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "v1beta1": { + "nodeStartupTimeoutSeconds": { SchemaProps: spec.SchemaProps{ - Description: "v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus"), + Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unhealthyNodeConditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "unhealthyNodeConditions contains a list of 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.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), + }, + }, + }, }, }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentList contains a list of MachineDeployment.", + Description: "MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "kind": { + "triggerIf": { SchemaProps: spec.SchemaProps{ - 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{"string"}, + Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf"), + }, + }, + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "unhealthyLessThanOrEqualTo": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of unhealthy Machines is less than or equal to the configured value. unhealthyInRange takes precedence if set.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "unhealthyInRange": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyInRange specifies that remediations are only triggered if the number of unhealthy Machines is in the configured range. Takes precedence over unhealthyLessThanOrEqualTo. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy Machines (and) (b) there are at most 5 unhealthy Machines", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentClassNamingStrategy defines the naming strategy for machine deployment objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "template": { + SchemaProps: spec.SchemaProps{ + Description: "template defines the template to use for generating the name of the MachineDeployment object. If not defined, it will fallback to `{{ .cluster.name }}-{{ .machineDeployment.topologyName }}-{{ .random }}`. If the templated string exceeds 63 characters, it will be trimmed to 58 characters and will get concatenated with a random suffix of length 5. The templating mechanism provides the following arguments: * `.cluster.name`: The name of the cluster object. * `.random`: A random alphanumeric string, without vowels, of length 5. * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "v1beta1": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentList contains a list of MachineDeployment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, Format: "", }, }, @@ -3006,10 +3408,10 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref common.Re Format: "int32", }, }, - "machineHealthCheck": { + "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "machineHealthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckTopology"), + Description: "healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck"), }, }, "deletion": { @@ -3067,7 +3469,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref common.Re }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckTopology", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } @@ -3105,6 +3507,139 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletio } } +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "enabled": { + SchemaProps: spec.SchemaProps{ + Description: "enabled controls if a MachineHealthCheck should be created for the target machines.\n\nIf false: No MachineHealthCheck will be created.\n\nIf not set(default): A MachineHealthCheck will be created if it is defined here or\n in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.\n\nIf true: A MachineHealthCheck is guaranteed to be created. Cluster validation will block if `enable` is true and no MachineHealthCheck definition is available.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "checks": { + SchemaProps: spec.SchemaProps{ + Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks"), + }, + }, + "remediation": { + SchemaProps: spec.SchemaProps{ + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeStartupTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "unhealthyNodeConditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "unhealthyNodeConditions contains a list of 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.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "triggerIf": { + SchemaProps: spec.SchemaProps{ + Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf"), + }, + }, + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "unhealthyLessThanOrEqualTo": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of unhealthy Machines is less than or equal to the configured value. unhealthyInRange takes precedence if set.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "unhealthyInRange": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyInRange specifies that remediations are only triggered if the number of unhealthy Machines is in the configured range. Takes precedence over unhealthyLessThanOrEqualTo. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy Machines (and) (b) there are at most 5 unhealthy Machines", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + func schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3514,13 +4049,20 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheck(ref common.Reference } } -func schema_cluster_api_api_core_v1beta2_MachineHealthCheckClass(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineHealthCheckClass defines a MachineHealthCheck for a group of Machines.", + Description: "MachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "nodeStartupTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", + Type: []string{"integer"}, + Format: "int32", + }, + }, "unhealthyNodeConditions": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -3540,37 +4082,11 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckClass(ref common.Refe }, }, }, - "maxUnhealthy": { - SchemaProps: spec.SchemaProps{ - Description: "maxUnhealthy specifies the maximum number of unhealthy machines allowed. Any further remediation is only allowed if at most \"maxUnhealthy\" machines selected by \"selector\" are not healthy.", - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - "unhealthyRange": { - SchemaProps: spec.SchemaProps{ - Description: "unhealthyRange specifies the range of unhealthy machines allowed. Any further remediation is only allowed if the number of machines selected by \"selector\" as not healthy is within the range of \"unhealthyRange\". Takes precedence over maxUnhealthy. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy machines (and) (b) there are at most 5 unhealthy machines", - Type: []string{"string"}, - Format: "", - }, - }, - "nodeStartupTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "remediationTemplate": { - SchemaProps: spec.SchemaProps{ - Description: "remediationTemplate is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), - }, - }, }, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/util/intstr.IntOrString", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, } } @@ -3646,6 +4162,34 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckList(ref common.Refer } } +func schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "triggerIf": { + SchemaProps: spec.SchemaProps{ + Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTriggerIf"), + }, + }, + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTriggerIf"}, + } +} + func schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateReference(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3684,6 +4228,34 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateRe } } +func schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "unhealthyLessThanOrEqualTo": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of unhealthy Machines is less than or equal to the configured value. unhealthyInRange takes precedence if set.", + Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), + }, + }, + "unhealthyInRange": { + SchemaProps: spec.SchemaProps{ + Description: "unhealthyInRange specifies that remediations are only triggered if the number of unhealthy Machines is in the configured range. Takes precedence over unhealthyLessThanOrEqualTo. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy Machines (and) (b) there are at most 5 unhealthy Machines", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/util/intstr.IntOrString"}, + } +} + func schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3706,49 +4278,18 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref common.Refer Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), }, }, - "unhealthyNodeConditions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-type": "atomic", - }, - }, + "checks": { SchemaProps: spec.SchemaProps{ - Description: "unhealthyNodeConditions contains a list of 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.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), - }, - }, - }, - }, - }, - "maxUnhealthy": { - SchemaProps: spec.SchemaProps{ - Description: "maxUnhealthy specifies the maximum number of unhealthy machines allowed. Any further remediation is only allowed if at most \"maxUnhealthy\" machines selected by \"selector\" are not healthy.\n\nDeprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details.", - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - "unhealthyRange": { - SchemaProps: spec.SchemaProps{ - Description: "unhealthyRange specifies the range of unhealthy machines allowed. Any further remediation is only allowed if the number of machines selected by \"selector\" as not healthy is within the range of \"unhealthyRange\". Takes precedence over maxUnhealthy. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy machines (and) (b) there are at most 5 unhealthy machines\n\nDeprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details.", - Type: []string{"string"}, - Format: "", - }, - }, - "nodeStartupTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", - Type: []string{"integer"}, - Format: "int32", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks"), }, }, - "remediationTemplate": { + "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediationTemplate is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation"), }, }, }, @@ -3756,7 +4297,7 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref common.Refer }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "k8s.io/apimachinery/pkg/util/intstr.IntOrString", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation"}, } } @@ -3851,73 +4392,6 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckStatus(ref common.Ref } } -func schema_cluster_api_api_core_v1beta2_MachineHealthCheckTopology(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MachineHealthCheckTopology defines a MachineHealthCheck for a group of machines.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "enable": { - SchemaProps: spec.SchemaProps{ - Description: "enable controls if a MachineHealthCheck should be created for the target machines.\n\nIf false: No MachineHealthCheck will be created.\n\nIf not set(default): A MachineHealthCheck will be created if it is defined here or\n in the associated ClusterClass. If no MachineHealthCheck is defined then none will be created.\n\nIf true: A MachineHealthCheck is guaranteed to be created. Cluster validation will block if `enable` is true and no MachineHealthCheck definition is available.", - Type: []string{"boolean"}, - Format: "", - }, - }, - "unhealthyNodeConditions": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-type": "atomic", - }, - }, - SchemaProps: spec.SchemaProps{ - Description: "unhealthyNodeConditions contains a list of 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.", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"), - }, - }, - }, - }, - }, - "maxUnhealthy": { - SchemaProps: spec.SchemaProps{ - Description: "maxUnhealthy specifies the maximum number of unhealthy machines allowed. Any further remediation is only allowed if at most \"maxUnhealthy\" machines selected by \"selector\" are not healthy.", - Ref: ref("k8s.io/apimachinery/pkg/util/intstr.IntOrString"), - }, - }, - "unhealthyRange": { - SchemaProps: spec.SchemaProps{ - Description: "unhealthyRange specifies the range of unhealthy machines allowed. Any further remediation is only allowed if the number of machines selected by \"selector\" as not healthy is within the range of \"unhealthyRange\". Takes precedence over maxUnhealthy. Eg. \"[3-5]\" - This means that remediation will be allowed only when: (a) there are at least 3 unhealthy machines (and) (b) there are at most 5 unhealthy machines", - Type: []string{"string"}, - Format: "", - }, - }, - "nodeStartupTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck to consider a Machine unhealthy if a corresponding Node isn't associated through a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of: - Cluster's infrastructure ready condition timestamp (if and when available) - Control Plane's initialized condition timestamp (if and when available) - Machine's infrastructure ready condition timestamp (if and when available) - Machine's metadata creation timestamp\n\nDefaults to 10 minutes. If you wish to disable this feature, set the value explicitly to 0.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "remediationTemplate": { - SchemaProps: spec.SchemaProps{ - Description: "remediationTemplate is a reference to a remediation template provided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller creates a new object from the template referenced and hands off remediation of the machine to a controller that lives outside of Cluster API.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"), - }, - }, - }, - }, - }, - Dependencies: []string{ - "k8s.io/apimachinery/pkg/util/intstr.IntOrString", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition"}, - } -} - func schema_cluster_api_api_core_v1beta2_MachineHealthCheckV1Beta1DeprecatedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml index 22c406789ea5..f202b8bf1815 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml @@ -2924,128 +2924,147 @@ spec: minimum: 0 type: integer type: object - machineHealthCheck: + healthCheck: description: |- - machineHealthCheck defines a MachineHealthCheck for this ControlPlaneClass. + healthCheck defines a MachineHealthCheck for this ControlPlaneClass. This field is supported if and only if the ControlPlane provider template referenced above is Machine based and supports setting replicas. minProperties: 1 properties: - maxUnhealthy: - anyOf: - - type: integer - - type: string - description: |- - maxUnhealthy specifies the maximum number of unhealthy machines allowed. - Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - "selector" are not healthy. - x-kubernetes-int-or-string: true - nodeStartupTimeoutSeconds: - description: |- - nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - to consider a Machine unhealthy if a corresponding Node isn't associated - through a `Spec.ProviderID` field. - - The duration set in this field is compared to the greatest of: - - Cluster's infrastructure ready condition timestamp (if and when available) - - Control Plane's initialized condition timestamp (if and when available) - - Machine's infrastructure ready condition timestamp (if and when available) - - Machine's metadata creation timestamp + checks: + description: checks are the checks that are used to evaluate + if a Machine is healthy. + minProperties: 1 + properties: + nodeStartupTimeoutSeconds: + description: |- + nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + to consider a Machine unhealthy if a corresponding Node isn't associated + through a `Spec.ProviderID` field. - Defaults to 10 minutes. - If you wish to disable this feature, set the value explicitly to 0. - format: int32 - minimum: 0 - type: integer - remediationTemplate: - description: |- - remediationTemplate is a reference to a remediation template - provided by an infrastructure provider. + The duration set in this field is compared to the greatest of: + - Cluster's infrastructure ready condition timestamp (if and when available) + - Control Plane's initialized condition timestamp (if and when available) + - Machine's infrastructure ready condition timestamp (if and when available) + - Machine's metadata creation timestamp - This field is completely optional, when filled, the MachineHealthCheck controller - creates a new object from the template referenced and hands off remediation of the machine to - a controller that lives outside of Cluster API. - properties: - apiVersion: + Defaults to 10 minutes. + If you wish to disable this feature, set the value explicitly to 0. + format: int32 + minimum: 0 + type: integer + unhealthyNodeConditions: description: |- - apiVersion of the remediation template. - apiVersion must be fully qualified domain name followed by / and a version. - NOTE: This field must be kept in sync with the APIVersion of the remediation template. - maxLength: 317 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: + unhealthyNodeConditions contains a list of 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: |- + UnhealthyNodeCondition 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: + description: status of the condition, one of True, + False, Unknown. + minLength: 1 + type: string + timeoutSeconds: + description: |- + timeoutSeconds is the duration that a node must be in a given status for, + after which the node is considered unhealthy. + For example, with a value of "1h", the node must match the status + for at least 1 hour before being considered unhealthy. + format: int32 + minimum: 0 + type: integer + type: + description: type of Node condition + minLength: 1 + type: string + required: + - status + - timeoutSeconds + - type + type: object + maxItems: 100 + minItems: 1 + type: array + x-kubernetes-list-type: atomic + type: object + remediation: + description: remediation configures if and how remediations + are triggered if a Machine is unhealthy. + minProperties: 1 + properties: + templateRef: description: |- - kind of the remediation template. - kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: + templateRef is a reference to a remediation template + provided by an infrastructure provider. + + This field is completely optional, when filled, the MachineHealthCheck controller + creates a new object from the template referenced and hands off remediation of the machine to + a controller that lives outside of Cluster API. + properties: + apiVersion: + description: |- + apiVersion of the remediation template. + apiVersion must be fully qualified domain name followed by / and a version. + NOTE: This field must be kept in sync with the APIVersion of the remediation template. + maxLength: 317 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ + type: string + kind: + description: |- + kind of the remediation template. + kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + name of the remediation template. + name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - apiVersion + - kind + - name + type: object + triggerIf: description: |- - name of the remediation template. - name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - apiVersion - - kind - - name + triggerIf configures if remediations are triggered. + If this field is not set, remediations are always triggered. + minProperties: 1 + properties: + unhealthyInRange: + description: |- + unhealthyInRange specifies that remediations are only triggered if the number of + unhealthy Machines is in the configured range. + Takes precedence over unhealthyLessThanOrEqualTo. + Eg. "[3-5]" - This means that remediation will be allowed only when: + (a) there are at least 3 unhealthy Machines (and) + (b) there are at most 5 unhealthy Machines + maxLength: 32 + minLength: 1 + pattern: ^\[[0-9]+-[0-9]+\]$ + type: string + unhealthyLessThanOrEqualTo: + anyOf: + - type: integer + - type: string + description: |- + unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + unhealthy Machines is less than or equal to the configured value. + unhealthyInRange takes precedence if set. + x-kubernetes-int-or-string: true + type: object type: object - unhealthyNodeConditions: - description: |- - unhealthyNodeConditions contains a list of 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: |- - UnhealthyNodeCondition 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: - description: status of the condition, one of True, False, - Unknown. - minLength: 1 - type: string - timeoutSeconds: - description: |- - timeoutSeconds is the duration that a node must be in a given status for, - after which the node is considered unhealthy. - For example, with a value of "1h", the node must match the status - for at least 1 hour before being considered unhealthy. - format: int32 - minimum: 0 - type: integer - type: - description: type of Node condition - minLength: 1 - type: string - required: - - status - - timeoutSeconds - - type - type: object - maxItems: 100 - minItems: 1 - type: array - x-kubernetes-list-type: atomic - unhealthyRange: - description: |- - unhealthyRange specifies the range of unhealthy machines allowed. - Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - Eg. "[3-5]" - This means that remediation will be allowed only when: - (a) there are at least 3 unhealthy machines (and) - (b) there are at most 5 unhealthy machines - maxLength: 32 - minLength: 1 - pattern: ^\[[0-9]+-[0-9]+\]$ - type: string type: object machineInfrastructure: description: |- @@ -4019,6 +4038,146 @@ spec: maxLength: 256 minLength: 1 type: string + healthCheck: + description: healthCheck defines a MachineHealthCheck for + this MachineDeploymentClass. + minProperties: 1 + properties: + checks: + description: checks are the checks that are used to + evaluate if a Machine is healthy. + minProperties: 1 + properties: + nodeStartupTimeoutSeconds: + description: |- + nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + to consider a Machine unhealthy if a corresponding Node isn't associated + through a `Spec.ProviderID` field. + + The duration set in this field is compared to the greatest of: + - Cluster's infrastructure ready condition timestamp (if and when available) + - Control Plane's initialized condition timestamp (if and when available) + - Machine's infrastructure ready condition timestamp (if and when available) + - Machine's metadata creation timestamp + + Defaults to 10 minutes. + If you wish to disable this feature, set the value explicitly to 0. + format: int32 + minimum: 0 + type: integer + unhealthyNodeConditions: + description: |- + unhealthyNodeConditions contains a list of 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: |- + UnhealthyNodeCondition 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: + description: status of the condition, one + of True, False, Unknown. + minLength: 1 + type: string + timeoutSeconds: + description: |- + timeoutSeconds is the duration that a node must be in a given status for, + after which the node is considered unhealthy. + For example, with a value of "1h", the node must match the status + for at least 1 hour before being considered unhealthy. + format: int32 + minimum: 0 + type: integer + type: + description: type of Node condition + minLength: 1 + type: string + required: + - status + - timeoutSeconds + - type + type: object + maxItems: 100 + minItems: 1 + type: array + x-kubernetes-list-type: atomic + type: object + remediation: + description: remediation configures if and how remediations + are triggered if a Machine is unhealthy. + minProperties: 1 + properties: + templateRef: + description: |- + templateRef is a reference to a remediation template + provided by an infrastructure provider. + + This field is completely optional, when filled, the MachineHealthCheck controller + creates a new object from the template referenced and hands off remediation of the machine to + a controller that lives outside of Cluster API. + properties: + apiVersion: + description: |- + apiVersion of the remediation template. + apiVersion must be fully qualified domain name followed by / and a version. + NOTE: This field must be kept in sync with the APIVersion of the remediation template. + maxLength: 317 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ + type: string + kind: + description: |- + kind of the remediation template. + kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + name of the remediation template. + name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - apiVersion + - kind + - name + type: object + triggerIf: + description: |- + triggerIf configures if remediations are triggered. + If this field is not set, remediations are always triggered. + minProperties: 1 + properties: + unhealthyInRange: + description: |- + unhealthyInRange specifies that remediations are only triggered if the number of + unhealthy Machines is in the configured range. + Takes precedence over unhealthyLessThanOrEqualTo. + Eg. "[3-5]" - This means that remediation will be allowed only when: + (a) there are at least 3 unhealthy Machines (and) + (b) there are at most 5 unhealthy Machines + maxLength: 32 + minLength: 1 + pattern: ^\[[0-9]+-[0-9]+\]$ + type: string + unhealthyLessThanOrEqualTo: + anyOf: + - type: integer + - type: string + description: |- + unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + unhealthy Machines is less than or equal to the configured value. + unhealthyInRange takes precedence if set. + x-kubernetes-int-or-string: true + type: object + type: object + type: object infrastructure: description: |- infrastructure contains the infrastructure template reference to be used @@ -4060,127 +4219,6 @@ spec: required: - templateRef type: object - machineHealthCheck: - description: machineHealthCheck defines a MachineHealthCheck - for this MachineDeploymentClass. - minProperties: 1 - properties: - maxUnhealthy: - anyOf: - - type: integer - - type: string - description: |- - maxUnhealthy specifies the maximum number of unhealthy machines allowed. - Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - "selector" are not healthy. - x-kubernetes-int-or-string: true - nodeStartupTimeoutSeconds: - description: |- - nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - to consider a Machine unhealthy if a corresponding Node isn't associated - through a `Spec.ProviderID` field. - - The duration set in this field is compared to the greatest of: - - Cluster's infrastructure ready condition timestamp (if and when available) - - Control Plane's initialized condition timestamp (if and when available) - - Machine's infrastructure ready condition timestamp (if and when available) - - Machine's metadata creation timestamp - - Defaults to 10 minutes. - If you wish to disable this feature, set the value explicitly to 0. - format: int32 - minimum: 0 - type: integer - remediationTemplate: - description: |- - remediationTemplate is a reference to a remediation template - provided by an infrastructure provider. - - This field is completely optional, when filled, the MachineHealthCheck controller - creates a new object from the template referenced and hands off remediation of the machine to - a controller that lives outside of Cluster API. - properties: - apiVersion: - description: |- - apiVersion of the remediation template. - apiVersion must be fully qualified domain name followed by / and a version. - NOTE: This field must be kept in sync with the APIVersion of the remediation template. - maxLength: 317 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: - description: |- - kind of the remediation template. - kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: - description: |- - name of the remediation template. - name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - apiVersion - - kind - - name - type: object - unhealthyNodeConditions: - description: |- - unhealthyNodeConditions contains a list of 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: |- - UnhealthyNodeCondition 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: - description: status of the condition, one of True, - False, Unknown. - minLength: 1 - type: string - timeoutSeconds: - description: |- - timeoutSeconds is the duration that a node must be in a given status for, - after which the node is considered unhealthy. - For example, with a value of "1h", the node must match the status - for at least 1 hour before being considered unhealthy. - format: int32 - minimum: 0 - type: integer - type: - description: type of Node condition - minLength: 1 - type: string - required: - - status - - timeoutSeconds - - type - type: object - maxItems: 100 - minItems: 1 - type: array - x-kubernetes-list-type: atomic - unhealthyRange: - description: |- - unhealthyRange specifies the range of unhealthy machines allowed. - Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - Eg. "[3-5]" - This means that remediation will be allowed only when: - (a) there are at least 3 unhealthy machines (and) - (b) there are at most 5 unhealthy machines - maxLength: 32 - minLength: 1 - pattern: ^\[[0-9]+-[0-9]+\]$ - type: string - type: object metadata: description: |- metadata is the metadata applied to the MachineDeployment and the machines of the MachineDeployment. diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index 19c66fdfb867..a4789525b8d4 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -2440,17 +2440,76 @@ spec: minimum: 0 type: integer type: object - machineHealthCheck: - allOf: - - minProperties: 1 - - minProperties: 1 + healthCheck: description: |- - machineHealthCheck allows to enable, disable and override + healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this control plane. + minProperties: 1 properties: - enable: + checks: + description: checks are the checks that are used to evaluate + if a Machine is healthy. + minProperties: 1 + properties: + nodeStartupTimeoutSeconds: + description: |- + nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + to consider a Machine unhealthy if a corresponding Node isn't associated + through a `Spec.ProviderID` field. + + The duration set in this field is compared to the greatest of: + - Cluster's infrastructure ready condition timestamp (if and when available) + - Control Plane's initialized condition timestamp (if and when available) + - Machine's infrastructure ready condition timestamp (if and when available) + - Machine's metadata creation timestamp + + Defaults to 10 minutes. + If you wish to disable this feature, set the value explicitly to 0. + format: int32 + minimum: 0 + type: integer + unhealthyNodeConditions: + description: |- + unhealthyNodeConditions contains a list of 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: |- + UnhealthyNodeCondition 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: + description: status of the condition, one of + True, False, Unknown. + minLength: 1 + type: string + timeoutSeconds: + description: |- + timeoutSeconds is the duration that a node must be in a given status for, + after which the node is considered unhealthy. + For example, with a value of "1h", the node must match the status + for at least 1 hour before being considered unhealthy. + format: int32 + minimum: 0 + type: integer + type: + description: type of Node condition + minLength: 1 + type: string + required: + - status + - timeoutSeconds + - type + type: object + maxItems: 100 + minItems: 1 + type: array + x-kubernetes-list-type: atomic + type: object + enabled: description: |- - enable controls if a MachineHealthCheck should be created for the target machines. + enabled controls if a MachineHealthCheck should be created for the target machines. If false: No MachineHealthCheck will be created. @@ -2460,121 +2519,79 @@ spec: If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will block if `enable` is true and no MachineHealthCheck definition is available. type: boolean - maxUnhealthy: - anyOf: - - type: integer - - type: string - description: |- - maxUnhealthy specifies the maximum number of unhealthy machines allowed. - Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - "selector" are not healthy. - x-kubernetes-int-or-string: true - nodeStartupTimeoutSeconds: - description: |- - nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - to consider a Machine unhealthy if a corresponding Node isn't associated - through a `Spec.ProviderID` field. - - The duration set in this field is compared to the greatest of: - - Cluster's infrastructure ready condition timestamp (if and when available) - - Control Plane's initialized condition timestamp (if and when available) - - Machine's infrastructure ready condition timestamp (if and when available) - - Machine's metadata creation timestamp - - Defaults to 10 minutes. - If you wish to disable this feature, set the value explicitly to 0. - format: int32 - minimum: 0 - type: integer - remediationTemplate: - description: |- - remediationTemplate is a reference to a remediation template - provided by an infrastructure provider. - - This field is completely optional, when filled, the MachineHealthCheck controller - creates a new object from the template referenced and hands off remediation of the machine to - a controller that lives outside of Cluster API. + remediation: + description: remediation configures if and how remediations + are triggered if a Machine is unhealthy. + minProperties: 1 properties: - apiVersion: - description: |- - apiVersion of the remediation template. - apiVersion must be fully qualified domain name followed by / and a version. - NOTE: This field must be kept in sync with the APIVersion of the remediation template. - maxLength: 317 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: + templateRef: description: |- - kind of the remediation template. - kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: + templateRef is a reference to a remediation template + provided by an infrastructure provider. + + This field is completely optional, when filled, the MachineHealthCheck controller + creates a new object from the template referenced and hands off remediation of the machine to + a controller that lives outside of Cluster API. + properties: + apiVersion: + description: |- + apiVersion of the remediation template. + apiVersion must be fully qualified domain name followed by / and a version. + NOTE: This field must be kept in sync with the APIVersion of the remediation template. + maxLength: 317 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ + type: string + kind: + description: |- + kind of the remediation template. + kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + name of the remediation template. + name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - apiVersion + - kind + - name + type: object + triggerIf: description: |- - name of the remediation template. - name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - apiVersion - - kind - - name + triggerIf configures if remediations are triggered. + If this field is not set, remediations are always triggered. + minProperties: 1 + properties: + unhealthyInRange: + description: |- + unhealthyInRange specifies that remediations are only triggered if the number of + unhealthy Machines is in the configured range. + Takes precedence over unhealthyLessThanOrEqualTo. + Eg. "[3-5]" - This means that remediation will be allowed only when: + (a) there are at least 3 unhealthy Machines (and) + (b) there are at most 5 unhealthy Machines + maxLength: 32 + minLength: 1 + pattern: ^\[[0-9]+-[0-9]+\]$ + type: string + unhealthyLessThanOrEqualTo: + anyOf: + - type: integer + - type: string + description: |- + unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + unhealthy Machines is less than or equal to the configured value. + unhealthyInRange takes precedence if set. + x-kubernetes-int-or-string: true + type: object type: object - unhealthyNodeConditions: - description: |- - unhealthyNodeConditions contains a list of 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: |- - UnhealthyNodeCondition 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: - description: status of the condition, one of True, - False, Unknown. - minLength: 1 - type: string - timeoutSeconds: - description: |- - timeoutSeconds is the duration that a node must be in a given status for, - after which the node is considered unhealthy. - For example, with a value of "1h", the node must match the status - for at least 1 hour before being considered unhealthy. - format: int32 - minimum: 0 - type: integer - type: - description: type of Node condition - minLength: 1 - type: string - required: - - status - - timeoutSeconds - - type - type: object - maxItems: 100 - minItems: 1 - type: array - x-kubernetes-list-type: atomic - unhealthyRange: - description: |- - unhealthyRange specifies the range of unhealthy machines allowed. - Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - Eg. "[3-5]" - This means that remediation will be allowed only when: - (a) there are at least 3 unhealthy machines (and) - (b) there are at most 5 unhealthy machines - maxLength: 32 - minLength: 1 - pattern: ^\[[0-9]+-[0-9]+\]$ - type: string type: object metadata: description: |- @@ -2793,17 +2810,76 @@ spec: maxLength: 256 minLength: 1 type: string - machineHealthCheck: - allOf: - - minProperties: 1 - - minProperties: 1 + healthCheck: description: |- - machineHealthCheck allows to enable, disable and override + healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment. + minProperties: 1 properties: - enable: + checks: + description: checks are the checks that are used + to evaluate if a Machine is healthy. + minProperties: 1 + properties: + nodeStartupTimeoutSeconds: + description: |- + nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + to consider a Machine unhealthy if a corresponding Node isn't associated + through a `Spec.ProviderID` field. + + The duration set in this field is compared to the greatest of: + - Cluster's infrastructure ready condition timestamp (if and when available) + - Control Plane's initialized condition timestamp (if and when available) + - Machine's infrastructure ready condition timestamp (if and when available) + - Machine's metadata creation timestamp + + Defaults to 10 minutes. + If you wish to disable this feature, set the value explicitly to 0. + format: int32 + minimum: 0 + type: integer + unhealthyNodeConditions: + description: |- + unhealthyNodeConditions contains a list of 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: |- + UnhealthyNodeCondition 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: + description: status of the condition, + one of True, False, Unknown. + minLength: 1 + type: string + timeoutSeconds: + description: |- + timeoutSeconds is the duration that a node must be in a given status for, + after which the node is considered unhealthy. + For example, with a value of "1h", the node must match the status + for at least 1 hour before being considered unhealthy. + format: int32 + minimum: 0 + type: integer + type: + description: type of Node condition + minLength: 1 + type: string + required: + - status + - timeoutSeconds + - type + type: object + maxItems: 100 + minItems: 1 + type: array + x-kubernetes-list-type: atomic + type: object + enabled: description: |- - enable controls if a MachineHealthCheck should be created for the target machines. + enabled controls if a MachineHealthCheck should be created for the target machines. If false: No MachineHealthCheck will be created. @@ -2813,121 +2889,79 @@ spec: If true: A MachineHealthCheck is guaranteed to be created. Cluster validation will block if `enable` is true and no MachineHealthCheck definition is available. type: boolean - maxUnhealthy: - anyOf: - - type: integer - - type: string - description: |- - maxUnhealthy specifies the maximum number of unhealthy machines allowed. - Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - "selector" are not healthy. - x-kubernetes-int-or-string: true - nodeStartupTimeoutSeconds: - description: |- - nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - to consider a Machine unhealthy if a corresponding Node isn't associated - through a `Spec.ProviderID` field. - - The duration set in this field is compared to the greatest of: - - Cluster's infrastructure ready condition timestamp (if and when available) - - Control Plane's initialized condition timestamp (if and when available) - - Machine's infrastructure ready condition timestamp (if and when available) - - Machine's metadata creation timestamp - - Defaults to 10 minutes. - If you wish to disable this feature, set the value explicitly to 0. - format: int32 - minimum: 0 - type: integer - remediationTemplate: - description: |- - remediationTemplate is a reference to a remediation template - provided by an infrastructure provider. - - This field is completely optional, when filled, the MachineHealthCheck controller - creates a new object from the template referenced and hands off remediation of the machine to - a controller that lives outside of Cluster API. + remediation: + description: remediation configures if and how remediations + are triggered if a Machine is unhealthy. + minProperties: 1 properties: - apiVersion: - description: |- - apiVersion of the remediation template. - apiVersion must be fully qualified domain name followed by / and a version. - NOTE: This field must be kept in sync with the APIVersion of the remediation template. - maxLength: 317 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: + templateRef: description: |- - kind of the remediation template. - kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: + templateRef is a reference to a remediation template + provided by an infrastructure provider. + + This field is completely optional, when filled, the MachineHealthCheck controller + creates a new object from the template referenced and hands off remediation of the machine to + a controller that lives outside of Cluster API. + properties: + apiVersion: + description: |- + apiVersion of the remediation template. + apiVersion must be fully qualified domain name followed by / and a version. + NOTE: This field must be kept in sync with the APIVersion of the remediation template. + maxLength: 317 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ + type: string + kind: + description: |- + kind of the remediation template. + kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + name of the remediation template. + name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - apiVersion + - kind + - name + type: object + triggerIf: description: |- - name of the remediation template. - name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - apiVersion - - kind - - name + triggerIf configures if remediations are triggered. + If this field is not set, remediations are always triggered. + minProperties: 1 + properties: + unhealthyInRange: + description: |- + unhealthyInRange specifies that remediations are only triggered if the number of + unhealthy Machines is in the configured range. + Takes precedence over unhealthyLessThanOrEqualTo. + Eg. "[3-5]" - This means that remediation will be allowed only when: + (a) there are at least 3 unhealthy Machines (and) + (b) there are at most 5 unhealthy Machines + maxLength: 32 + minLength: 1 + pattern: ^\[[0-9]+-[0-9]+\]$ + type: string + unhealthyLessThanOrEqualTo: + anyOf: + - type: integer + - type: string + description: |- + unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + unhealthy Machines is less than or equal to the configured value. + unhealthyInRange takes precedence if set. + x-kubernetes-int-or-string: true + type: object type: object - unhealthyNodeConditions: - description: |- - unhealthyNodeConditions contains a list of 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: |- - UnhealthyNodeCondition 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: - description: status of the condition, one - of True, False, Unknown. - minLength: 1 - type: string - timeoutSeconds: - description: |- - timeoutSeconds is the duration that a node must be in a given status for, - after which the node is considered unhealthy. - For example, with a value of "1h", the node must match the status - for at least 1 hour before being considered unhealthy. - format: int32 - minimum: 0 - type: integer - type: - description: type of Node condition - minLength: 1 - type: string - required: - - status - - timeoutSeconds - - type - type: object - maxItems: 100 - minItems: 1 - type: array - x-kubernetes-list-type: atomic - unhealthyRange: - description: |- - unhealthyRange specifies the range of unhealthy machines allowed. - Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - Eg. "[3-5]" - This means that remediation will be allowed only when: - (a) there are at least 3 unhealthy machines (and) - (b) there are at most 5 unhealthy machines - maxLength: 32 - minLength: 1 - pattern: ^\[[0-9]+-[0-9]+\]$ - type: string type: object metadata: description: |- diff --git a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml index 144343a72beb..6172f68b0731 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml @@ -998,8 +998,8 @@ spec: name: ExpectedMachines type: integer - description: Maximum number of unhealthy machines allowed - jsonPath: .spec.maxUnhealthy - name: MaxUnhealthy + jsonPath: .spec.remediation.triggerIf.unhealthyLessThanOrEqualTo + name: UnhealthyLessThanOrEqualTo type: string - description: Current observed healthy machines jsonPath: .status.currentHealthy @@ -1035,78 +1035,145 @@ spec: spec: description: spec is the specification of machine health check policy properties: + checks: + description: checks are the checks that are used to evaluate if a + Machine is healthy. + minProperties: 1 + properties: + nodeStartupTimeoutSeconds: + description: |- + nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck + to consider a Machine unhealthy if a corresponding Node isn't associated + through a `Spec.ProviderID` field. + + The duration set in this field is compared to the greatest of: + - Cluster's infrastructure ready condition timestamp (if and when available) + - Control Plane's initialized condition timestamp (if and when available) + - Machine's infrastructure ready condition timestamp (if and when available) + - Machine's metadata creation timestamp + + Defaults to 10 minutes. + If you wish to disable this feature, set the value explicitly to 0. + format: int32 + minimum: 0 + type: integer + unhealthyNodeConditions: + description: |- + unhealthyNodeConditions contains a list of 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: |- + UnhealthyNodeCondition 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: + description: status of the condition, one of True, False, + Unknown. + minLength: 1 + type: string + timeoutSeconds: + description: |- + timeoutSeconds is the duration that a node must be in a given status for, + after which the node is considered unhealthy. + For example, with a value of "1h", the node must match the status + for at least 1 hour before being considered unhealthy. + format: int32 + minimum: 0 + type: integer + type: + description: type of Node condition + minLength: 1 + type: string + required: + - status + - timeoutSeconds + - type + type: object + maxItems: 100 + minItems: 1 + type: array + x-kubernetes-list-type: atomic + type: object clusterName: description: clusterName is the name of the Cluster this object belongs to. maxLength: 63 minLength: 1 type: string - maxUnhealthy: - anyOf: - - type: integer - - type: string - description: |- - maxUnhealthy specifies the maximum number of unhealthy machines allowed. - Any further remediation is only allowed if at most "maxUnhealthy" machines selected by - "selector" are not healthy. - - Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details. - x-kubernetes-int-or-string: true - nodeStartupTimeoutSeconds: - description: |- - nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck - to consider a Machine unhealthy if a corresponding Node isn't associated - through a `Spec.ProviderID` field. - - The duration set in this field is compared to the greatest of: - - Cluster's infrastructure ready condition timestamp (if and when available) - - Control Plane's initialized condition timestamp (if and when available) - - Machine's infrastructure ready condition timestamp (if and when available) - - Machine's metadata creation timestamp - - Defaults to 10 minutes. - If you wish to disable this feature, set the value explicitly to 0. - format: int32 - minimum: 0 - type: integer - remediationTemplate: - description: |- - remediationTemplate is a reference to a remediation template - provided by an infrastructure provider. - - This field is completely optional, when filled, the MachineHealthCheck controller - creates a new object from the template referenced and hands off remediation of the machine to - a controller that lives outside of Cluster API. + remediation: + description: remediation configures if and how remediations are triggered + if a Machine is unhealthy. + minProperties: 1 properties: - apiVersion: - description: |- - apiVersion of the remediation template. - apiVersion must be fully qualified domain name followed by / and a version. - NOTE: This field must be kept in sync with the APIVersion of the remediation template. - maxLength: 317 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ - type: string - kind: + templateRef: description: |- - kind of the remediation template. - kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. - maxLength: 63 - minLength: 1 - pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ - type: string - name: + templateRef is a reference to a remediation template + provided by an infrastructure provider. + + This field is completely optional, when filled, the MachineHealthCheck controller + creates a new object from the template referenced and hands off remediation of the machine to + a controller that lives outside of Cluster API. + properties: + apiVersion: + description: |- + apiVersion of the remediation template. + apiVersion must be fully qualified domain name followed by / and a version. + NOTE: This field must be kept in sync with the APIVersion of the remediation template. + maxLength: 317 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[a-z]([-a-z0-9]*[a-z0-9])?$ + type: string + kind: + description: |- + kind of the remediation template. + kind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: |- + name of the remediation template. + name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - apiVersion + - kind + - name + type: object + triggerIf: description: |- - name of the remediation template. - name must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character. - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ - type: string - required: - - apiVersion - - kind - - name + triggerIf configures if remediations are triggered. + If this field is not set, remediations are always triggered. + minProperties: 1 + properties: + unhealthyInRange: + description: |- + unhealthyInRange specifies that remediations are only triggered if the number of + unhealthy Machines is in the configured range. + Takes precedence over unhealthyLessThanOrEqualTo. + Eg. "[3-5]" - This means that remediation will be allowed only when: + (a) there are at least 3 unhealthy Machines (and) + (b) there are at most 5 unhealthy Machines + maxLength: 32 + minLength: 1 + pattern: ^\[[0-9]+-[0-9]+\]$ + type: string + unhealthyLessThanOrEqualTo: + anyOf: + - type: integer + - type: string + description: |- + unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of + unhealthy Machines is less than or equal to the configured value. + unhealthyInRange takes precedence if set. + x-kubernetes-int-or-string: true + type: object type: object selector: description: selector is a label selector to match machines whose @@ -1155,57 +1222,6 @@ spec: type: object type: object x-kubernetes-map-type: atomic - unhealthyNodeConditions: - description: |- - unhealthyNodeConditions contains a list of 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: |- - UnhealthyNodeCondition 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: - description: status of the condition, one of True, False, Unknown. - minLength: 1 - type: string - timeoutSeconds: - description: |- - timeoutSeconds is the duration that a node must be in a given status for, - after which the node is considered unhealthy. - For example, with a value of "1h", the node must match the status - for at least 1 hour before being considered unhealthy. - format: int32 - minimum: 0 - type: integer - type: - description: type of Node condition - minLength: 1 - type: string - required: - - status - - timeoutSeconds - - type - type: object - maxItems: 100 - minItems: 1 - type: array - x-kubernetes-list-type: atomic - unhealthyRange: - description: |- - unhealthyRange specifies the range of unhealthy machines allowed. - Any further remediation is only allowed if the number of machines selected by "selector" as not healthy - is within the range of "unhealthyRange". Takes precedence over maxUnhealthy. - Eg. "[3-5]" - This means that remediation will be allowed only when: - (a) there are at least 3 unhealthy machines (and) - (b) there are at most 5 unhealthy machines - - Deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/issues/10722 for more details. - maxLength: 32 - minLength: 1 - pattern: ^\[[0-9]+-[0-9]+\]$ - type: string required: - clusterName - selector diff --git a/exp/topology/desiredstate/desired_state.go b/exp/topology/desiredstate/desired_state.go index d07b18f6da50..c8b1fe972973 100644 --- a/exp/topology/desiredstate/desired_state.go +++ b/exp/topology/desiredstate/desired_state.go @@ -145,12 +145,13 @@ func (g *generator) Generate(ctx context.Context, s *scope.Scope) (*scope.Cluste // Compute the desired state of the ControlPlane MachineHealthCheck if defined. // The MachineHealthCheck will have the same name as the ControlPlane Object and a selector for the ControlPlane InfrastructureMachines. if s.Blueprint.IsControlPlaneMachineHealthCheckEnabled() { + checks, remediation := s.Blueprint.ControlPlaneMachineHealthCheckClass() desiredState.ControlPlane.MachineHealthCheck = computeMachineHealthCheck( ctx, desiredState.ControlPlane.Object, selectors.ForControlPlaneMHC(), s.Current.Cluster, - s.Blueprint.ControlPlaneMachineHealthCheckClass()) + checks, remediation) } // Compute the desired state for the Cluster object adding a reference to the @@ -917,12 +918,13 @@ func (g *generator) computeMachineDeployment(ctx context.Context, s *scope.Scope // If the ClusterClass defines a MachineHealthCheck for the MachineDeployment add it to the desired state. if s.Blueprint.IsMachineDeploymentMachineHealthCheckEnabled(&machineDeploymentTopology) { // Note: The MHC is going to use a selector that provides a minimal set of labels which are common to all MachineSets belonging to the MachineDeployment. + checks, remediation := s.Blueprint.MachineDeploymentMachineHealthCheckClass(&machineDeploymentTopology) desiredMachineDeployment.MachineHealthCheck = computeMachineHealthCheck( ctx, desiredMachineDeploymentObj, selectors.ForMachineDeploymentMHC(desiredMachineDeploymentObj), s.Current.Cluster, - s.Blueprint.MachineDeploymentMachineHealthCheckClass(&machineDeploymentTopology)) + checks, remediation) } return desiredMachineDeployment, nil } @@ -1438,7 +1440,7 @@ func templateToTemplate(in templateToInput) (*unstructured.Unstructured, error) return template, nil } -func computeMachineHealthCheck(ctx context.Context, healthCheckTarget client.Object, selector *metav1.LabelSelector, cluster *clusterv1.Cluster, check *clusterv1.MachineHealthCheckClass) *clusterv1.MachineHealthCheck { +func computeMachineHealthCheck(ctx context.Context, healthCheckTarget client.Object, selector *metav1.LabelSelector, cluster *clusterv1.Cluster, mhcChecks clusterv1.MachineHealthCheckChecks, mhcRemediation clusterv1.MachineHealthCheckRemediation) *clusterv1.MachineHealthCheck { // Create a MachineHealthCheck with the spec given in the ClusterClass. mhc := &clusterv1.MachineHealthCheck{ TypeMeta: metav1.TypeMeta{ @@ -1458,13 +1460,10 @@ func computeMachineHealthCheck(ctx context.Context, healthCheckTarget client.Obj }, }, Spec: clusterv1.MachineHealthCheckSpec{ - ClusterName: cluster.Name, - Selector: *selector, - UnhealthyNodeConditions: check.UnhealthyNodeConditions, - MaxUnhealthy: check.MaxUnhealthy, - UnhealthyRange: check.UnhealthyRange, - NodeStartupTimeoutSeconds: check.NodeStartupTimeoutSeconds, - RemediationTemplate: check.RemediationTemplate, + ClusterName: cluster.Name, + Selector: *selector, + Checks: mhcChecks, + Remediation: mhcRemediation, }, } diff --git a/exp/topology/desiredstate/desired_state_test.go b/exp/topology/desiredstate/desired_state_test.go index 991523b57f50..0ef3e649e853 100644 --- a/exp/topology/desiredstate/desired_state_test.go +++ b/exp/topology/desiredstate/desired_state_test.go @@ -1733,9 +1733,11 @@ func TestComputeMachineDeployment(t *testing.T) { WithAnnotations(annotations). WithInfrastructureTemplate(workerInfrastructureMachineTemplate). WithBootstrapTemplate(workerBootstrapTemplate). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: unhealthyNodeConditions, - NodeStartupTimeoutSeconds: nodeTimeoutDuration, + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: unhealthyNodeConditions, + NodeStartupTimeoutSeconds: nodeTimeoutDuration, + }, }). WithReadinessGates(clusterClassReadinessGates). WithFailureDomain(clusterClassFailureDomain). @@ -1774,9 +1776,11 @@ func TestComputeMachineDeployment(t *testing.T) { }, BootstrapTemplate: workerBootstrapTemplate, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, - MachineHealthCheck: &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: unhealthyNodeConditions, - NodeStartupTimeoutSeconds: ptr.To(int32(1)), + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: unhealthyNodeConditions, + NodeStartupTimeoutSeconds: ptr.To(int32(1)), + }, }, }, }, @@ -1934,9 +1938,11 @@ func TestComputeMachineDeployment(t *testing.T) { }, BootstrapTemplate: workerBootstrapTemplate, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, - MachineHealthCheck: &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: unhealthyNodeConditions, - NodeStartupTimeoutSeconds: ptr.To(int32(1)), + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: unhealthyNodeConditions, + NodeStartupTimeoutSeconds: ptr.To(int32(1)), + }, }, }, }, @@ -2191,10 +2197,10 @@ func TestComputeMachineDeployment(t *testing.T) { }})) // Check that the NodeStartupTime is set as expected. - g.Expect(actual.MachineHealthCheck.Spec.NodeStartupTimeoutSeconds).To(Equal(nodeTimeoutDuration)) + g.Expect(actual.MachineHealthCheck.Spec.Checks.NodeStartupTimeoutSeconds).To(Equal(nodeTimeoutDuration)) // Check that UnhealthyNodeConditions are set as expected. - g.Expect(actual.MachineHealthCheck.Spec.UnhealthyNodeConditions).To(BeComparableTo(unhealthyNodeConditions)) + g.Expect(actual.MachineHealthCheck.Spec.Checks.UnhealthyNodeConditions).To(BeComparableTo(unhealthyNodeConditions)) }) } @@ -3346,7 +3352,7 @@ func TestMergeMap(t *testing.T) { } func Test_computeMachineHealthCheck(t *testing.T) { - mhcSpec := &clusterv1.MachineHealthCheckClass{ + mhcChecks := clusterv1.MachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -3388,26 +3394,28 @@ func Test_computeMachineHealthCheck(t *testing.T) { Selector: metav1.LabelSelector{MatchLabels: map[string]string{ "foo": "bar", }}, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, - }, - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: 5 * 60, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 5 * 60, + }, }, + NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, - NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, } t.Run("set all fields correctly", func(t *testing.T) { g := NewWithT(t) - got := computeMachineHealthCheck(ctx, healthCheckTarget, selector, cluster, mhcSpec) + got := computeMachineHealthCheck(ctx, healthCheckTarget, selector, cluster, mhcChecks, clusterv1.MachineHealthCheckRemediation{}) g.Expect(got).To(BeComparableTo(want), cmp.Diff(got, want)) }) diff --git a/exp/topology/scope/blueprint.go b/exp/topology/scope/blueprint.go index 402ae827af62..a9912ba4d632 100644 --- a/exp/topology/scope/blueprint.go +++ b/exp/topology/scope/blueprint.go @@ -54,7 +54,7 @@ type ControlPlaneBlueprint struct { // MachineHealthCheck holds the MachineHealthCheckClass for this ControlPlane. // +optional - MachineHealthCheck *clusterv1.MachineHealthCheckClass + MachineHealthCheck *clusterv1.ControlPlaneClassMachineHealthCheck } // MachineDeploymentBlueprint holds the templates required for computing the desired state of a managed MachineDeployment; @@ -73,7 +73,7 @@ type MachineDeploymentBlueprint struct { // MachineHealthCheck holds the MachineHealthCheckClass for this MachineDeployment. // +optional - MachineHealthCheck *clusterv1.MachineHealthCheckClass + MachineHealthCheck *clusterv1.MachineDeploymentClassMachineHealthCheck } // MachinePoolBlueprint holds the templates required for computing the desired state of a managed MachinePool; @@ -103,52 +103,98 @@ func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool { return false } // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. - if b.ClusterClass.Spec.ControlPlane.MachineHealthCheck == nil && - (b.Topology.ControlPlane.MachineHealthCheck == nil || b.Topology.ControlPlane.MachineHealthCheck.IsZero()) { + if b.ClusterClass.Spec.ControlPlane.HealthCheck == nil && + (b.Topology.ControlPlane.HealthCheck == nil || b.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. - if b.Topology.ControlPlane.MachineHealthCheck == nil || b.Topology.ControlPlane.MachineHealthCheck.Enable == nil { + if b.Topology.ControlPlane.HealthCheck == nil || b.Topology.ControlPlane.HealthCheck.Enabled == nil { return true } // If `enable` is explicitly set, use the value. - return *b.Topology.ControlPlane.MachineHealthCheck.Enable + return *b.Topology.ControlPlane.HealthCheck.Enabled } // ControlPlaneMachineHealthCheckClass returns the MachineHealthCheckClass that should be used to create the MachineHealthCheck object. -func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() *clusterv1.MachineHealthCheckClass { - if b.Topology.ControlPlane.MachineHealthCheck != nil && !b.Topology.ControlPlane.MachineHealthCheck.IsZero() { - return &b.Topology.ControlPlane.MachineHealthCheck.MachineHealthCheckClass +func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() (clusterv1.MachineHealthCheckChecks, clusterv1.MachineHealthCheckRemediation) { + if b.Topology.ControlPlane.HealthCheck == nil && b.ControlPlane.MachineHealthCheck == nil { + return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - return b.ControlPlane.MachineHealthCheck + + if b.Topology.ControlPlane.HealthCheck != nil && !b.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { + return clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: b.Topology.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: b.Topology.ControlPlane.HealthCheck.Checks.UnhealthyNodeConditions, + }, clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: b.Topology.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: b.Topology.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyInRange, + }, + TemplateRef: b.Topology.ControlPlane.HealthCheck.Remediation.TemplateRef, + } + } + + return clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: b.ControlPlane.MachineHealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: b.ControlPlane.MachineHealthCheck.Checks.UnhealthyNodeConditions, + }, clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: b.ControlPlane.MachineHealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: b.ControlPlane.MachineHealthCheck.Remediation.TriggerIf.UnhealthyInRange, + }, + TemplateRef: b.ControlPlane.MachineHealthCheck.Remediation.TemplateRef, + } } // HasControlPlaneMachineHealthCheck returns true if the ControlPlaneClass has both MachineInfrastructure and a MachineHealthCheck defined. func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool { - return b.HasControlPlaneInfrastructureMachine() && b.ClusterClass.Spec.ControlPlane.MachineHealthCheck != nil + return b.HasControlPlaneInfrastructureMachine() && b.ClusterClass.Spec.ControlPlane.HealthCheck != nil } // IsMachineDeploymentMachineHealthCheckEnabled returns true if a MachineHealthCheck should be created for the MachineDeployment. // Returns false otherwise. func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool { // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. - if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.MachineHealthCheck == nil || md.MachineHealthCheck.IsZero()) { + if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || md.HealthCheck.IsHealthCheckConfigZero()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. - if md.MachineHealthCheck == nil || md.MachineHealthCheck.Enable == nil { + if md.HealthCheck == nil || md.HealthCheck.Enabled == nil { return true } // If `enable` is explicitly set, use the value. - return *md.MachineHealthCheck.Enable + return *md.HealthCheck.Enabled } // MachineDeploymentMachineHealthCheckClass return the MachineHealthCheckClass that should be used to create the MachineHealthCheck object. -func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv1.MachineDeploymentTopology) *clusterv1.MachineHealthCheckClass { - if md.MachineHealthCheck != nil && !md.MachineHealthCheck.IsZero() { - return &md.MachineHealthCheck.MachineHealthCheckClass +func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv1.MachineDeploymentTopology) (clusterv1.MachineHealthCheckChecks, clusterv1.MachineHealthCheckRemediation) { + if md.HealthCheck == nil && b.MachineDeployments[md.Class].MachineHealthCheck == nil { + return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - return b.MachineDeployments[md.Class].MachineHealthCheck + + if md.HealthCheck != nil && !md.HealthCheck.IsHealthCheckConfigZero() { + return clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: md.HealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: md.HealthCheck.Checks.UnhealthyNodeConditions, + }, clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: md.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: md.HealthCheck.Remediation.TriggerIf.UnhealthyInRange, + }, + TemplateRef: md.HealthCheck.Remediation.TemplateRef, + } + } + + return clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: b.MachineDeployments[md.Class].MachineHealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: b.MachineDeployments[md.Class].MachineHealthCheck.Checks.UnhealthyNodeConditions, + }, clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TriggerIf.UnhealthyInRange, + }, + TemplateRef: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TemplateRef, + } } // HasMachineDeployments checks whether the topology has MachineDeployments. diff --git a/exp/topology/scope/blueprint_test.go b/exp/topology/scope/blueprint_test.go index f2a30d921c48..f26f379e71da 100644 --- a/exp/topology/scope/blueprint_test.go +++ b/exp/topology/scope/blueprint_test.go @@ -61,7 +61,7 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). @@ -74,12 +74,12 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(false), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(false), }). Build(), }, @@ -90,12 +90,12 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build(), }, @@ -109,8 +109,8 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -132,9 +132,9 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(false), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(false), + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -156,9 +156,9 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -183,65 +183,101 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { } func TestControlPlaneMachineHealthCheckClass(t *testing.T) { - mhcInClusterClass := &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: 10 * 60, - }, - }, - } - - percent50 := intstr.FromString("50%") - mhcInClusterTopology := &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: 20 * 60, - }, - }, - MaxUnhealthy: &percent50, - } - tests := []struct { - name string - blueprint *ClusterBlueprint - want *clusterv1.MachineHealthCheckClass + name string + blueprint *ClusterBlueprint + wantChecks clusterv1.MachineHealthCheckChecks + wantRemediation clusterv1.MachineHealthCheckRemediation }{ { name: "should return the MachineHealthCheck from cluster topology if defined - should take precedence over MachineHealthCheck in ClusterClass", blueprint: &ClusterBlueprint{ Topology: builder.ClusterTopology(). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: *mhcInClusterTopology, + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 20 * 60, + }, + }, + }, + Remediation: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediation{ + TriggerIf: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), + }, + }, }). Build(), ControlPlane: &ControlPlaneBlueprint{ - MachineHealthCheck: mhcInClusterClass, + MachineHealthCheck: &clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, + }, + }, + }, + }, + wantChecks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 20 * 60, + }, + }, + }, + wantRemediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), }, }, - want: mhcInClusterTopology, }, { name: "should return the MachineHealthCheck from ClusterClass if no MachineHealthCheck is defined in cluster topology", blueprint: &ClusterBlueprint{ Topology: builder.ClusterTopology(). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{}). Build(), ControlPlane: &ControlPlaneBlueprint{ - MachineHealthCheck: mhcInClusterClass, + MachineHealthCheck: &clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, + }, + }, }, }, - want: mhcInClusterClass, + wantChecks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, + }, + wantRemediation: clusterv1.MachineHealthCheckRemediation{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { g := NewWithT(t) - g.Expect(tt.blueprint.ControlPlaneMachineHealthCheckClass()).To(BeComparableTo(tt.want)) + gotChecks, gotRemediation := tt.blueprint.ControlPlaneMachineHealthCheckClass() + g.Expect(gotChecks).To(BeComparableTo(tt.wantChecks)) + g.Expect(gotRemediation).To(BeComparableTo(tt.wantRemediation)) }) } } @@ -270,7 +306,7 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineHealthCheckClass{}, + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, }, }, }, @@ -284,14 +320,14 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineHealthCheckClass{}, + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(false), + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(false), }, }, want: false, @@ -301,14 +337,14 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineHealthCheckClass{}, + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }, }, want: true, @@ -322,8 +358,8 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -345,9 +381,9 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(false), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(false), + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -369,9 +405,9 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -395,72 +431,108 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { } func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { - mhcInClusterClass := &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: 10 * 60, - }, - }, - } - - percent50 := intstr.FromString("50%") - mhcInClusterTopology := &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: 20 * 60, - }, - }, - MaxUnhealthy: &percent50, - } - tests := []struct { - name string - blueprint *ClusterBlueprint - mdTopology *clusterv1.MachineDeploymentTopology - want *clusterv1.MachineHealthCheckClass + name string + blueprint *ClusterBlueprint + mdTopology *clusterv1.MachineDeploymentTopology + wantChecks clusterv1.MachineHealthCheckChecks + wantRemediation clusterv1.MachineHealthCheckRemediation }{ { name: "should return the MachineHealthCheck from cluster topology if defined - should take precedence over MachineHealthCheck in ClusterClass", blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: mhcInClusterClass, + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, + }, + }, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: *mhcInClusterTopology, + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 20 * 60, + }, + }, + }, + Remediation: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), + }, + }, + }, + }, + wantChecks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 20 * 60, + }, + }, + }, + wantRemediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), }, }, - want: mhcInClusterTopology, }, { name: "should return the MachineHealthCheck from ClusterClass if no MachineHealthCheck is defined in cluster topology", blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: mhcInClusterClass, + MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, + }, + }, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ - Class: "worker-class", - MachineHealthCheck: &clusterv1.MachineHealthCheckTopology{}, + Class: "worker-class", + HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{}, + }, + wantChecks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: 10 * 60, + }, + }, }, - want: mhcInClusterClass, + wantRemediation: clusterv1.MachineHealthCheckRemediation{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { g := NewWithT(t) - g.Expect(tt.blueprint.MachineDeploymentMachineHealthCheckClass(tt.mdTopology)).To(BeComparableTo(tt.want)) + gotChecks, gotRemediation := tt.blueprint.MachineDeploymentMachineHealthCheckClass(tt.mdTopology) + g.Expect(gotChecks).To(BeComparableTo(tt.wantChecks)) + g.Expect(gotRemediation).To(BeComparableTo(tt.wantRemediation)) }) } } diff --git a/internal/api/core/v1alpha3/conversion.go b/internal/api/core/v1alpha3/conversion.go index d749d75e28da..52d07b3e7d63 100644 --- a/internal/api/core/v1alpha3/conversion.go +++ b/internal/api/core/v1alpha3/conversion.go @@ -33,6 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/conversion" + clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" v1beta1conditions "sigs.k8s.io/cluster-api/util/conditions/deprecated/v1beta1" utilconversion "sigs.k8s.io/cluster-api/util/conversion" @@ -519,8 +520,8 @@ func (src *MachineHealthCheck) ConvertTo(dstRaw conversion.Hub) error { return nil } - if restored.Spec.UnhealthyRange != "" { - dst.Spec.UnhealthyRange = restored.Spec.UnhealthyRange + if restored.Spec.Remediation.TriggerIf.UnhealthyInRange != "" { + dst.Spec.Remediation.TriggerIf.UnhealthyInRange = restored.Spec.Remediation.TriggerIf.UnhealthyInRange } dst.Status.Conditions = restored.Status.Conditions @@ -791,13 +792,20 @@ func Convert_v1alpha3_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSpec(i } for _, c := range in.UnhealthyConditions { - out.UnhealthyNodeConditions = append(out.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + out.Checks.UnhealthyNodeConditions = append(out.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ Type: c.Type, Status: c.Status, TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), }) } - out.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MaxUnhealthy + if in.RemediationTemplate != nil { + out.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := clusterv1beta1.Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.RemediationTemplate, out.Remediation.TemplateRef, s); err != nil { + return err + } + } return nil } @@ -807,14 +815,21 @@ func Convert_v1beta2_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(i return err } - for _, c := range in.UnhealthyNodeConditions { + for _, c := range in.Checks.UnhealthyNodeConditions { out.UnhealthyConditions = append(out.UnhealthyConditions, UnhealthyCondition{ Type: c.Type, Status: c.Status, Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), }) } - out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.NodeStartupTimeoutSeconds) + out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.Checks.NodeStartupTimeoutSeconds) + out.MaxUnhealthy = in.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.Remediation.TemplateRef != nil { + out.RemediationTemplate = &corev1.ObjectReference{} + if err := clusterv1beta1.Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.Remediation.TemplateRef, out.RemediationTemplate, s); err != nil { + return err + } + } return nil } diff --git a/internal/api/core/v1alpha3/zz_generated.conversion.go b/internal/api/core/v1alpha3/zz_generated.conversion.go index 6b290ee6b785..f12efc184c8c 100644 --- a/internal/api/core/v1alpha3/zz_generated.conversion.go +++ b/internal/api/core/v1alpha3/zz_generated.conversion.go @@ -28,7 +28,6 @@ import ( v1 "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" v1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" v1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" ) @@ -967,36 +966,17 @@ func autoConvert_v1alpha3_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSp out.ClusterName = in.ClusterName out.Selector = in.Selector // WARNING: in.UnhealthyConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) + // WARNING: in.MaxUnhealthy requires manual conversion: does not exist in peer-type // WARNING: in.NodeStartupTimeout requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(v1beta2.MachineHealthCheckRemediationTemplateReference) - if err := v1beta1.Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.RemediationTemplate requires manual conversion: does not exist in peer-type return nil } func autoConvert_v1beta2_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(in *v1beta2.MachineHealthCheckSpec, out *MachineHealthCheckSpec, s conversion.Scope) error { out.ClusterName = in.ClusterName out.Selector = in.Selector - // WARNING: in.UnhealthyNodeConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - // WARNING: in.UnhealthyRange requires manual conversion: does not exist in peer-type - // WARNING: in.NodeStartupTimeoutSeconds requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(corev1.ObjectReference) - if err := v1beta1.Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.Checks requires manual conversion: does not exist in peer-type + // WARNING: in.Remediation requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/api/core/v1alpha4/conversion.go b/internal/api/core/v1alpha4/conversion.go index a301d1d680de..104cea044535 100644 --- a/internal/api/core/v1alpha4/conversion.go +++ b/internal/api/core/v1alpha4/conversion.go @@ -32,6 +32,7 @@ import ( "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/conversion" + clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" utilconversion "sigs.k8s.io/cluster-api/util/conversion" ) @@ -130,8 +131,8 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Topology.Variables = restored.Spec.Topology.Variables dst.Spec.Topology.ControlPlane.Variables = restored.Spec.Topology.ControlPlane.Variables - if restored.Spec.Topology.ControlPlane.MachineHealthCheck != nil { - dst.Spec.Topology.ControlPlane.MachineHealthCheck = restored.Spec.Topology.ControlPlane.MachineHealthCheck + if restored.Spec.Topology.ControlPlane.HealthCheck != nil { + dst.Spec.Topology.ControlPlane.HealthCheck = restored.Spec.Topology.ControlPlane.HealthCheck } if restored.Spec.Topology.ControlPlane.Deletion.NodeDrainTimeoutSeconds != nil { @@ -156,7 +157,7 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Topology.Workers.MachineDeployments[i].Deletion.NodeDeletionTimeoutSeconds = restored.Spec.Topology.Workers.MachineDeployments[i].Deletion.NodeDeletionTimeoutSeconds dst.Spec.Topology.Workers.MachineDeployments[i].MinReadySeconds = restored.Spec.Topology.Workers.MachineDeployments[i].MinReadySeconds dst.Spec.Topology.Workers.MachineDeployments[i].Strategy = restored.Spec.Topology.Workers.MachineDeployments[i].Strategy - dst.Spec.Topology.Workers.MachineDeployments[i].MachineHealthCheck = restored.Spec.Topology.Workers.MachineDeployments[i].MachineHealthCheck + dst.Spec.Topology.Workers.MachineDeployments[i].HealthCheck = restored.Spec.Topology.Workers.MachineDeployments[i].HealthCheck } dst.Spec.Topology.Workers.MachinePools = restored.Spec.Topology.Workers.MachinePools @@ -244,7 +245,7 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Patches = restored.Spec.Patches dst.Spec.Variables = restored.Spec.Variables dst.Spec.AvailabilityGates = restored.Spec.AvailabilityGates - dst.Spec.ControlPlane.MachineHealthCheck = restored.Spec.ControlPlane.MachineHealthCheck + dst.Spec.ControlPlane.HealthCheck = restored.Spec.ControlPlane.HealthCheck dst.Spec.ControlPlane.ReadinessGates = restored.Spec.ControlPlane.ReadinessGates dst.Spec.ControlPlane.NamingStrategy = restored.Spec.ControlPlane.NamingStrategy dst.Spec.Infrastructure.NamingStrategy = restored.Spec.Infrastructure.NamingStrategy @@ -254,7 +255,7 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Workers.MachinePools = restored.Spec.Workers.MachinePools for i := range restored.Spec.Workers.MachineDeployments { - dst.Spec.Workers.MachineDeployments[i].MachineHealthCheck = restored.Spec.Workers.MachineDeployments[i].MachineHealthCheck + dst.Spec.Workers.MachineDeployments[i].HealthCheck = restored.Spec.Workers.MachineDeployments[i].HealthCheck dst.Spec.Workers.MachineDeployments[i].ReadinessGates = restored.Spec.Workers.MachineDeployments[i].ReadinessGates dst.Spec.Workers.MachineDeployments[i].FailureDomain = restored.Spec.Workers.MachineDeployments[i].FailureDomain dst.Spec.Workers.MachineDeployments[i].NamingStrategy = restored.Spec.Workers.MachineDeployments[i].NamingStrategy @@ -638,8 +639,6 @@ func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { dst.Spec.RemediationTemplate.Namespace = src.Namespace } - dropEmptyStringsMachineHealthCheck(dst) - // Preserve Hub data on down-conversion except for metadata return utilconversion.MarshalData(src, dst) } @@ -1065,13 +1064,21 @@ func Convert_v1alpha4_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSpec(i } for _, c := range in.UnhealthyConditions { - out.UnhealthyNodeConditions = append(out.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ + out.Checks.UnhealthyNodeConditions = append(out.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ Type: c.Type, Status: c.Status, TimeoutSeconds: ptr.Deref(clusterv1.ConvertToSeconds(&c.Timeout), 0), }) } - out.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Checks.NodeStartupTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeStartupTimeout) + out.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = in.MaxUnhealthy + out.Remediation.TriggerIf.UnhealthyInRange = ptr.Deref(in.UnhealthyRange, "") + if in.RemediationTemplate != nil { + out.Remediation.TemplateRef = &clusterv1.MachineHealthCheckRemediationTemplateReference{} + if err := clusterv1beta1.Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(in.RemediationTemplate, out.Remediation.TemplateRef, s); err != nil { + return err + } + } return nil } @@ -1081,14 +1088,24 @@ func Convert_v1beta2_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(i return err } - for _, c := range in.UnhealthyNodeConditions { + for _, c := range in.Checks.UnhealthyNodeConditions { out.UnhealthyConditions = append(out.UnhealthyConditions, UnhealthyCondition{ Type: c.Type, Status: c.Status, Timeout: ptr.Deref(clusterv1.ConvertFromSeconds(&c.TimeoutSeconds), metav1.Duration{}), }) } - out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.NodeStartupTimeoutSeconds) + out.NodeStartupTimeout = clusterv1.ConvertFromSeconds(in.Checks.NodeStartupTimeoutSeconds) + out.MaxUnhealthy = in.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo + if in.Remediation.TriggerIf.UnhealthyInRange != "" { + out.UnhealthyRange = ptr.To(in.Remediation.TriggerIf.UnhealthyInRange) + } + if in.Remediation.TemplateRef != nil { + out.RemediationTemplate = &corev1.ObjectReference{} + if err := clusterv1beta1.Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(in.Remediation.TemplateRef, out.RemediationTemplate, s); err != nil { + return err + } + } return nil } @@ -1338,10 +1355,6 @@ func dropEmptyStringsMachineSpec(spec *MachineSpec) { dropEmptyString(&spec.FailureDomain) } -func dropEmptyStringsMachineHealthCheck(dst *MachineHealthCheck) { - dropEmptyString(&dst.Spec.UnhealthyRange) -} - func dropEmptyString(s **string) { if *s != nil && **s == "" { *s = nil diff --git a/internal/api/core/v1alpha4/conversion_test.go b/internal/api/core/v1alpha4/conversion_test.go index c138ca560bbc..11deb8e9c52a 100644 --- a/internal/api/core/v1alpha4/conversion_test.go +++ b/internal/api/core/v1alpha4/conversion_test.go @@ -501,7 +501,7 @@ func spokeMachineHealthCheck(in *MachineHealthCheck, c randfill.Continue) { in.Namespace = "foo" - dropEmptyStringsMachineHealthCheck(in) + dropEmptyString(&in.Spec.UnhealthyRange) } func spokeObjectReference(in *corev1.ObjectReference, c randfill.Continue) { diff --git a/internal/api/core/v1alpha4/zz_generated.conversion.go b/internal/api/core/v1alpha4/zz_generated.conversion.go index ac30c3e2ed2f..aac08636eb23 100644 --- a/internal/api/core/v1alpha4/zz_generated.conversion.go +++ b/internal/api/core/v1alpha4/zz_generated.conversion.go @@ -28,7 +28,6 @@ import ( v1 "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" v1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" v1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" ) @@ -967,7 +966,7 @@ func autoConvert_v1beta2_ControlPlaneClass_To_v1alpha4_ControlPlaneClass(in *v1b } else { out.MachineInfrastructure = nil } - // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.NamingStrategy requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type // WARNING: in.ReadinessGates requires manual conversion: does not exist in peer-type @@ -992,7 +991,7 @@ func autoConvert_v1beta2_ControlPlaneTopology_To_v1alpha4_ControlPlaneTopology(i return err } out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type // WARNING: in.ReadinessGates requires manual conversion: does not exist in peer-type // WARNING: in.Variables requires manual conversion: does not exist in peer-type @@ -1096,7 +1095,7 @@ func autoConvert_v1beta2_MachineDeploymentClass_To_v1alpha4_MachineDeploymentCla out.Class = in.Class // WARNING: in.Bootstrap requires manual conversion: does not exist in peer-type // WARNING: in.Infrastructure requires manual conversion: does not exist in peer-type - // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.FailureDomain requires manual conversion: does not exist in peer-type // WARNING: in.NamingStrategy requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type @@ -1275,7 +1274,7 @@ func autoConvert_v1beta2_MachineDeploymentTopology_To_v1alpha4_MachineDeployment out.Name = in.Name // WARNING: in.FailureDomain requires manual conversion: does not exist in peer-type out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) - // WARNING: in.MachineHealthCheck requires manual conversion: does not exist in peer-type + // WARNING: in.HealthCheck requires manual conversion: does not exist in peer-type // WARNING: in.Deletion requires manual conversion: does not exist in peer-type // WARNING: in.MinReadySeconds requires manual conversion: does not exist in peer-type // WARNING: in.ReadinessGates requires manual conversion: does not exist in peer-type @@ -1362,41 +1361,18 @@ func autoConvert_v1alpha4_MachineHealthCheckSpec_To_v1beta2_MachineHealthCheckSp out.ClusterName = in.ClusterName out.Selector = in.Selector // WARNING: in.UnhealthyConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_Pointer_string_To_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } + // WARNING: in.MaxUnhealthy requires manual conversion: does not exist in peer-type + // WARNING: in.UnhealthyRange requires manual conversion: does not exist in peer-type // WARNING: in.NodeStartupTimeout requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(v1beta2.MachineHealthCheckRemediationTemplateReference) - if err := v1beta1.Convert_v1_ObjectReference_To_v1beta2_MachineHealthCheckRemediationTemplateReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.RemediationTemplate requires manual conversion: does not exist in peer-type return nil } func autoConvert_v1beta2_MachineHealthCheckSpec_To_v1alpha4_MachineHealthCheckSpec(in *v1beta2.MachineHealthCheckSpec, out *MachineHealthCheckSpec, s conversion.Scope) error { out.ClusterName = in.ClusterName out.Selector = in.Selector - // WARNING: in.UnhealthyNodeConditions requires manual conversion: does not exist in peer-type - out.MaxUnhealthy = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnhealthy)) - if err := v1.Convert_string_To_Pointer_string(&in.UnhealthyRange, &out.UnhealthyRange, s); err != nil { - return err - } - // WARNING: in.NodeStartupTimeoutSeconds requires manual conversion: does not exist in peer-type - if in.RemediationTemplate != nil { - in, out := &in.RemediationTemplate, &out.RemediationTemplate - *out = new(corev1.ObjectReference) - if err := v1beta1.Convert_v1beta2_MachineHealthCheckRemediationTemplateReference_To_v1_ObjectReference(*in, *out, s); err != nil { - return err - } - } else { - out.RemediationTemplate = nil - } + // WARNING: in.Checks requires manual conversion: does not exist in peer-type + // WARNING: in.Remediation requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go b/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go index 6508022814d0..1ab4436f3263 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go @@ -236,7 +236,7 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster // do sort to avoid keep changing m.Status as the returned machines are not in order sort.Strings(m.Status.Targets) - nodeStartupTimeout := m.Spec.NodeStartupTimeoutSeconds + nodeStartupTimeout := m.Spec.Checks.NodeStartupTimeoutSeconds if nodeStartupTimeout == nil { nodeStartupTimeout = &clusterv1.DefaultNodeStartupTimeoutSeconds } @@ -245,7 +245,7 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster healthy, unhealthy, nextCheckTimes := r.healthCheckTargets(targets, logger, metav1.Duration{Duration: time.Duration(*nodeStartupTimeout) * time.Second}) m.Status.CurrentHealthy = ptr.To(int32(len(healthy))) - // check MHC current health against MaxUnhealthy + // check MHC current health against UnhealthyLessThanOrEqualTo remediationAllowed, remediationCount, err := isAllowedRemediation(m) if err != nil { return ctrl.Result{}, errors.Wrapf(err, "error checking if remediation is allowed") @@ -254,8 +254,8 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster if !remediationAllowed { var message string - if m.Spec.UnhealthyRange == "" { - maxUnhealthyValue := ptr.To(ptr.Deref(m.Spec.MaxUnhealthy, defaultMaxUnhealthy)).String() + if m.Spec.Remediation.TriggerIf.UnhealthyInRange == "" { + maxUnhealthyValue := ptr.To(ptr.Deref(m.Spec.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, defaultMaxUnhealthy)).String() logger.V(3).Info( "Short-circuiting remediation", totalTargetKeyLog, totalTargets, @@ -270,13 +270,13 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster logger.V(3).Info( "Short-circuiting remediation", totalTargetKeyLog, totalTargets, - unhealthyRangeKeyLog, m.Spec.UnhealthyRange, + unhealthyRangeKeyLog, m.Spec.Remediation.TriggerIf.UnhealthyInRange, unhealthyTargetsKeyLog, len(unhealthy), ) message = fmt.Sprintf("Remediation is not allowed, the number of not started or unhealthy machines does not fall within the range (total: %v, unhealthy: %v, unhealthyRange: %v)", totalTargets, len(unhealthy), - m.Spec.UnhealthyRange) + m.Spec.Remediation.TriggerIf.UnhealthyInRange) } // Remediation not allowed, the number of not started or unhealthy machines either exceeds maxUnhealthy (or) not within unhealthyRange @@ -329,18 +329,18 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster return reconcile.Result{Requeue: true}, nil } - if m.Spec.UnhealthyRange == "" { + if m.Spec.Remediation.TriggerIf.UnhealthyInRange == "" { logger.V(3).Info( "Remediations are allowed", totalTargetKeyLog, totalTargets, - maxUnhealthyKeyLog, ptr.To(ptr.Deref(m.Spec.MaxUnhealthy, defaultMaxUnhealthy)).String(), + maxUnhealthyKeyLog, ptr.To(ptr.Deref(m.Spec.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, defaultMaxUnhealthy)).String(), unhealthyTargetsKeyLog, len(unhealthy), ) } else { logger.V(3).Info( "Remediations are allowed", totalTargetKeyLog, totalTargets, - unhealthyRangeKeyLog, m.Spec.UnhealthyRange, + unhealthyRangeKeyLog, m.Spec.Remediation.TriggerIf.UnhealthyInRange, unhealthyTargetsKeyLog, len(unhealthy), ) } @@ -378,7 +378,7 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster func (r *Reconciler) patchHealthyTargets(ctx context.Context, logger logr.Logger, healthy []healthCheckTarget, m *clusterv1.MachineHealthCheck) []error { errList := []error{} for _, t := range healthy { - if m.Spec.RemediationTemplate != nil { + if m.Spec.Remediation.TemplateRef != nil { // Get remediation request object obj, err := r.getExternalRemediationRequest(ctx, m, t.Machine.Name) if err != nil { @@ -428,7 +428,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg if annotations.IsPaused(cluster, t.Machine) { logger.Info("Machine has failed health check, but machine is paused so skipping remediation", "reason", condition.Reason, "message", condition.Message) } else { - if m.Spec.RemediationTemplate != nil { + if m.Spec.Remediation.TemplateRef != nil { // If external remediation request already exists, // return early if r.externalRemediationRequestExists(ctx, m, t.Machine.Name) { @@ -442,7 +442,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg UID: t.Machine.UID, } - from, err := external.Get(ctx, r.Client, m.Spec.RemediationTemplate.ToObjectReference(m.Namespace)) + from, err := external.Get(ctx, r.Client, m.Spec.Remediation.TemplateRef.ToObjectReference(m.Namespace)) if err != nil { v1beta1conditions.MarkFalse(m, clusterv1.ExternalRemediationTemplateAvailableV1Beta1Condition, clusterv1.ExternalRemediationTemplateNotFoundV1Beta1Reason, clusterv1.ConditionSeverityError, "%s", err.Error()) @@ -450,22 +450,22 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg Type: clusterv1.MachineExternallyRemediatedCondition, Status: metav1.ConditionFalse, Reason: clusterv1.MachineExternallyRemediatedRemediationTemplateNotFoundReason, - Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(m.Namespace, m.Spec.RemediationTemplate.Name)), + Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.Remediation.TemplateRef.Kind, klog.KRef(m.Namespace, m.Spec.Remediation.TemplateRef.Name)), }) - errList = append(errList, errors.Wrapf(err, "error retrieving remediation template %v %q for machine %q in namespace %q within cluster %q", m.Spec.RemediationTemplate.GroupVersionKind(), m.Spec.RemediationTemplate.Name, t.Machine.Name, t.Machine.Namespace, m.Spec.ClusterName)) + errList = append(errList, errors.Wrapf(err, "error retrieving remediation template %v %q for machine %q in namespace %q within cluster %q", m.Spec.Remediation.TemplateRef.GroupVersionKind(), m.Spec.Remediation.TemplateRef.Name, t.Machine.Name, t.Machine.Namespace, m.Spec.ClusterName)) return errList } generateTemplateInput := &external.GenerateTemplateInput{ Template: from, - TemplateRef: m.Spec.RemediationTemplate.ToObjectReference(m.Namespace), + TemplateRef: m.Spec.Remediation.TemplateRef.ToObjectReference(m.Namespace), Namespace: t.Machine.Namespace, ClusterName: t.Machine.Spec.ClusterName, OwnerRef: cloneOwnerRef, } to, err := external.GenerateTemplate(generateTemplateInput) if err != nil { - errList = append(errList, errors.Wrapf(err, "failed to create template for remediation request %v %q for machine %q in namespace %q within cluster %q", m.Spec.RemediationTemplate.GroupVersionKind(), m.Spec.RemediationTemplate.Name, t.Machine.Name, t.Machine.Namespace, m.Spec.ClusterName)) + errList = append(errList, errors.Wrapf(err, "failed to create template for remediation request %v %q for machine %q in namespace %q within cluster %q", m.Spec.Remediation.TemplateRef.GroupVersionKind(), m.Spec.Remediation.TemplateRef.Name, t.Machine.Name, t.Machine.Namespace, m.Spec.ClusterName)) return errList } @@ -657,12 +657,12 @@ func machineNames(machines []*clusterv1.Machine) []string { return result } -// isAllowedRemediation checks the value of the MaxUnhealthy field to determine +// isAllowedRemediation checks the value of the UnhealthyLessThanOrEqualTo field to determine // returns whether remediation should be allowed or not, the remediation count, and error if any. func isAllowedRemediation(mhc *clusterv1.MachineHealthCheck) (bool, int32, error) { var remediationAllowed bool var remediationCount int32 - if mhc.Spec.UnhealthyRange != "" { + if mhc.Spec.Remediation.TriggerIf.UnhealthyInRange != "" { minVal, maxVal, err := getUnhealthyRange(mhc) if err != nil { return false, 0, err @@ -689,7 +689,7 @@ func isAllowedRemediation(mhc *clusterv1.MachineHealthCheck) (bool, int32, error // Eg. [2-5] will return (2,5,nil). func getUnhealthyRange(mhc *clusterv1.MachineHealthCheck) (int, int, error) { // remove '[' and ']' - unhealthyRange := (mhc.Spec.UnhealthyRange)[1 : len(mhc.Spec.UnhealthyRange)-1] + unhealthyRange := (mhc.Spec.Remediation.TriggerIf.UnhealthyInRange)[1 : len(mhc.Spec.Remediation.TriggerIf.UnhealthyInRange)-1] parts := strings.Split(unhealthyRange, "-") @@ -711,7 +711,7 @@ func getUnhealthyRange(mhc *clusterv1.MachineHealthCheck) (int, int, error) { } func getMaxUnhealthy(mhc *clusterv1.MachineHealthCheck) (int, error) { - maxUnhealthy, err := intstr.GetScaledValueFromIntOrPercent(ptr.To(ptr.Deref(mhc.Spec.MaxUnhealthy, defaultMaxUnhealthy)), int(ptr.Deref[int32](mhc.Status.ExpectedMachines, 0)), false) + maxUnhealthy, err := intstr.GetScaledValueFromIntOrPercent(ptr.To(ptr.Deref(mhc.Spec.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, defaultMaxUnhealthy)), int(ptr.Deref[int32](mhc.Status.ExpectedMachines, 0)), false) if err != nil { return 0, err } @@ -727,8 +727,8 @@ func unhealthyMachineCount(mhc *clusterv1.MachineHealthCheck) int { // getExternalRemediationRequest gets reference to External Remediation Request, unstructured object. func (r *Reconciler) getExternalRemediationRequest(ctx context.Context, m *clusterv1.MachineHealthCheck, machineName string) (*unstructured.Unstructured, error) { remediationRef := &corev1.ObjectReference{ - APIVersion: m.Spec.RemediationTemplate.APIVersion, - Kind: strings.TrimSuffix(m.Spec.RemediationTemplate.Kind, clusterv1.TemplateSuffix), + APIVersion: m.Spec.Remediation.TemplateRef.APIVersion, + Kind: strings.TrimSuffix(m.Spec.Remediation.TemplateRef.Kind, clusterv1.TemplateSuffix), Name: machineName, Namespace: m.Namespace, } diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go b/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go index 15dbb53429b2..fe78b1e5760f 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go @@ -697,13 +697,13 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { }).Should(Equal(1)) }) - t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines exceed MaxUnhealthy", func(t *testing.T) { + t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines exceed UnhealthyLessThanOrEqualTo", func(t *testing.T) { g := NewWithT(t) cluster := createCluster(g, ns.Name) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) maxUnhealthy := intstr.Parse("40%") - mhc.Spec.MaxUnhealthy = &maxUnhealthy + mhc.Spec.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo = &maxUnhealthy g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -780,7 +780,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) unhealthyRange := "[1-3]" - mhc.Spec.UnhealthyRange = unhealthyRange + mhc.Spec.Remediation.TriggerIf.UnhealthyInRange = unhealthyRange g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -847,13 +847,13 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { assertMachinesOwnerRemediated(g, mhc, 1) }) - t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines is not within UnhealthyRange", func(t *testing.T) { + t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines is not within UnhealthyInRange", func(t *testing.T) { g := NewWithT(t) cluster := createCluster(g, ns.Name) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) unhealthyRange := "[3-5]" - mhc.Spec.UnhealthyRange = unhealthyRange + mhc.Spec.Remediation.TriggerIf.UnhealthyInRange = unhealthyRange g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -937,7 +937,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { g.Expect(patchHelper.Patch(ctx, cluster)).To(Succeed()) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.NodeStartupTimeoutSeconds = ptr.To(int32(5 * 60 * 60)) + mhc.Spec.Checks.NodeStartupTimeoutSeconds = ptr.To(int32(5 * 60 * 60)) g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -1009,7 +1009,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { cluster := createCluster(g, ns.Name) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.NodeStartupTimeoutSeconds = ptr.To(int32(10)) + mhc.Spec.Checks.NodeStartupTimeoutSeconds = ptr.To(int32(10)) g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -1084,7 +1084,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { cluster := createCluster(g, ns.Name) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.NodeStartupTimeoutSeconds = ptr.To(int32(10)) + mhc.Spec.Checks.NodeStartupTimeoutSeconds = ptr.To(int32(10)) g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -1156,7 +1156,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { cluster := createCluster(g, ns.Name) mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.UnhealthyNodeConditions = nil + mhc.Spec.Checks.UnhealthyNodeConditions = nil g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { @@ -1406,7 +1406,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { }, timeout, 100*time.Millisecond).Should(Equal(1)) // Create the MachineHealthCheck instance. - mhc.Spec.NodeStartupTimeoutSeconds = ptr.To(int32(1)) + mhc.Spec.Checks.NodeStartupTimeoutSeconds = ptr.To(int32(1)) g.Expect(env.Create(ctx, mhc)).To(Succeed()) // defer cleanup for all the objects that have been created @@ -1598,7 +1598,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { } mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.RemediationTemplate = remediationTemplate + mhc.Spec.Remediation.TemplateRef = remediationTemplate g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { g.Expect(env.Cleanup(ctx, do...)).To(Succeed()) @@ -1756,7 +1756,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { } mhc := newMachineHealthCheck(cluster.Namespace, cluster.Name) - mhc.Spec.RemediationTemplate = remediationTemplate + mhc.Spec.Remediation.TemplateRef = remediationTemplate g.Expect(env.Create(ctx, mhc)).To(Succeed()) defer func(do ...client.Object) { g.Expect(env.Cleanup(ctx, do...)).To(Succeed()) @@ -2338,8 +2338,14 @@ func TestIsAllowedRemediation(t *testing.T) { mhc := &clusterv1.MachineHealthCheck{ Spec: clusterv1.MachineHealthCheckSpec{ - MaxUnhealthy: tc.maxUnhealthy, - NodeStartupTimeoutSeconds: ptr.To(int32(0)), + Checks: clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(0)), + }, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: tc.maxUnhealthy, + }, + }, }, Status: clusterv1.MachineHealthCheckStatus{ ExpectedMachines: ptr.To(tc.expectedMachines), @@ -2404,7 +2410,11 @@ func TestGetMaxUnhealthy(t *testing.T) { mhc := &clusterv1.MachineHealthCheck{ Spec: clusterv1.MachineHealthCheckSpec{ - MaxUnhealthy: tc.maxUnhealthy, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: tc.maxUnhealthy, + }, + }, }, Status: clusterv1.MachineHealthCheckStatus{ ExpectedMachines: ptr.To(tc.actualMachineCount), @@ -2751,13 +2761,19 @@ func newMachineHealthCheck(namespace, clusterName string) *clusterv1.MachineHeal "selector": string(uuid.NewUUID()), }, }, - MaxUnhealthy: &maxUnhealthy, - NodeStartupTimeoutSeconds: ptr.To(int32(1)), - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + Checks: clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(1)), + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, + }, + }, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: &maxUnhealthy, }, }, }, diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go b/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go index f866365d0899..63529ecacb28 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_targets.go @@ -181,7 +181,7 @@ func (t *healthCheckTarget) needsRemediation(logger logr.Logger, timeoutForMachi } // check conditions - for _, c := range t.MHC.Spec.UnhealthyNodeConditions { + for _, c := range t.MHC.Spec.Checks.UnhealthyNodeConditions { nodeCondition := getNodeCondition(t.Node, c.Type) // Skip when current node condition is different from the one reported diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_targets_test.go b/internal/controllers/machinehealthcheck/machinehealthcheck_targets_test.go index 3b86b72d4afe..03e2540e8077 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_targets_test.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_targets_test.go @@ -63,11 +63,13 @@ func TestGetTargetsFromMHC(t *testing.T) { Selector: metav1.LabelSelector{ MatchLabels: mhcSelector, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, }, }, @@ -225,16 +227,18 @@ func TestHealthCheckTargets(t *testing.T) { MatchLabels: mhcSelector, }, ClusterName: clusterName, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: timeoutForUnhealthyNodeConditions, - }, - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, - TimeoutSeconds: timeoutForUnhealthyNodeConditions, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: timeoutForUnhealthyNodeConditions, + }, + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + TimeoutSeconds: timeoutForUnhealthyNodeConditions, + }, }, }, }, diff --git a/internal/controllers/topology/cluster/blueprint.go b/internal/controllers/topology/cluster/blueprint.go index 5a00369eeded..84e9a09af206 100644 --- a/internal/controllers/topology/cluster/blueprint.go +++ b/internal/controllers/topology/cluster/blueprint.go @@ -61,7 +61,7 @@ func (r *Reconciler) getBlueprint(ctx context.Context, cluster *clusterv1.Cluste // If the clusterClass defines a valid MachineHealthCheck (including a defined MachineInfrastructure) set the blueprint MachineHealthCheck. if blueprint.HasControlPlaneMachineHealthCheck() { - blueprint.ControlPlane.MachineHealthCheck = blueprint.ClusterClass.Spec.ControlPlane.MachineHealthCheck + blueprint.ControlPlane.MachineHealthCheck = blueprint.ClusterClass.Spec.ControlPlane.HealthCheck } // Loop over the machine deployments classes in ClusterClass @@ -87,8 +87,8 @@ func (r *Reconciler) getBlueprint(ctx context.Context, cluster *clusterv1.Cluste } // If the machineDeploymentClass defines a MachineHealthCheck add it to the blueprint. - if machineDeploymentClass.MachineHealthCheck != nil { - machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.MachineHealthCheck + if machineDeploymentClass.HealthCheck != nil { + machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.HealthCheck } blueprint.MachineDeployments[machineDeploymentClass.Class] = machineDeploymentBlueprint } diff --git a/internal/controllers/topology/cluster/blueprint_test.go b/internal/controllers/topology/cluster/blueprint_test.go index 4fa745b41597..bd2b0d23fd75 100644 --- a/internal/controllers/topology/cluster/blueprint_test.go +++ b/internal/controllers/topology/cluster/blueprint_test.go @@ -61,8 +61,15 @@ func TestGetBlueprint(t *testing.T) { Build() workerBootstrapTemplate := builder.BootstrapTemplate(metav1.NamespaceDefault, "workerbootstraptemplate1"). Build() - machineHealthCheck := &clusterv1.MachineHealthCheckClass{ - NodeStartupTimeoutSeconds: ptr.To(int32(1)), + cpMachineHealthCheck := &clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(1)), + }, + } + mdMachineHealthCheck := &clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(1)), + }, } machineDeployment := builder.MachineDeploymentClass("workerclass1"). @@ -70,7 +77,7 @@ func TestGetBlueprint(t *testing.T) { WithAnnotations(map[string]string{"a": "b"}). WithInfrastructureTemplate(workerInfrastructureMachineTemplate). WithBootstrapTemplate(workerBootstrapTemplate). - WithMachineHealthCheckClass(machineHealthCheck). + WithMachineHealthCheckClass(mdMachineHealthCheck). Build() mds := []clusterv1.MachineDeploymentClass{*machineDeployment} @@ -226,7 +233,7 @@ func TestGetBlueprint(t *testing.T) { }, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, BootstrapTemplate: workerBootstrapTemplate, - MachineHealthCheck: machineHealthCheck, + MachineHealthCheck: mdMachineHealthCheck, }, }, MachinePools: map[string]*scope.MachinePoolBlueprint{}, @@ -268,7 +275,7 @@ func TestGetBlueprint(t *testing.T) { WithInfrastructureClusterTemplate(infraClusterTemplate). WithControlPlaneTemplate(controlPlaneTemplate). WithControlPlaneInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate). - WithControlPlaneMachineHealthCheck(machineHealthCheck). + WithControlPlaneMachineHealthCheck(cpMachineHealthCheck). Build(), objects: []client.Object{ infraClusterTemplate, @@ -280,13 +287,13 @@ func TestGetBlueprint(t *testing.T) { WithInfrastructureClusterTemplate(infraClusterTemplate). WithControlPlaneTemplate(controlPlaneTemplate). WithControlPlaneInfrastructureMachineTemplate(controlPlaneInfrastructureMachineTemplate). - WithControlPlaneMachineHealthCheck(machineHealthCheck). + WithControlPlaneMachineHealthCheck(cpMachineHealthCheck). Build(), InfrastructureClusterTemplate: infraClusterTemplate, ControlPlane: &scope.ControlPlaneBlueprint{ Template: controlPlaneTemplate, InfrastructureMachineTemplate: controlPlaneInfrastructureMachineTemplate, - MachineHealthCheck: machineHealthCheck, + MachineHealthCheck: cpMachineHealthCheck, }, MachineDeployments: map[string]*scope.MachineDeploymentBlueprint{}, MachinePools: map[string]*scope.MachinePoolBlueprint{}, diff --git a/internal/controllers/topology/cluster/reconcile_state_test.go b/internal/controllers/topology/cluster/reconcile_state_test.go index b4e58e47e3d2..d5e6366e171c 100644 --- a/internal/controllers/topology/cluster/reconcile_state_test.go +++ b/internal/controllers/topology/cluster/reconcile_state_test.go @@ -1836,12 +1836,14 @@ func TestReconcileControlPlaneMachineHealthCheck(t *testing.T) { // Create InfrastructureMachineTemplates for test cases infrastructureMachineTemplate := builder.TestInfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build() - mhcClass := &clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + mhcClass := &clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, }, } @@ -1862,7 +1864,7 @@ func TestReconcileControlPlaneMachineHealthCheck(t *testing.T) { mhcBuilder := builder.MachineHealthCheck(metav1.NamespaceDefault, "cp1"). WithSelector(*selectors.ForControlPlaneMHC()). - WithUnhealthyNodeConditions(mhcClass.UnhealthyNodeConditions). + WithUnhealthyNodeConditions(mhcClass.Checks.UnhealthyNodeConditions). WithClusterName("cluster1") tests := []struct { diff --git a/internal/webhooks/cluster.go b/internal/webhooks/cluster.go index ddd984f28ba2..1b51a472613e 100644 --- a/internal/webhooks/cluster.go +++ b/internal/webhooks/cluster.go @@ -636,11 +636,11 @@ func validateTopologyMachinePoolVersions(ctx context.Context, ctrlClient client. func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clusterv1.ClusterClass) field.ErrorList { var allErrs field.ErrorList - if cluster.Spec.Topology.ControlPlane.MachineHealthCheck != nil { + if cluster.Spec.Topology.ControlPlane.HealthCheck != nil { fldPath := field.NewPath("spec", "topology", "controlPlane", "machineHealthCheck") // Validate ControlPlane MachineHealthCheck if defined. - if !cluster.Spec.Topology.ControlPlane.MachineHealthCheck.IsZero() { + if !cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { // Ensure ControlPlane does not define a MachineHealthCheck if the ClusterClass does not define MachineInfrastructure. if clusterClass.Spec.ControlPlane.MachineInfrastructure == nil { allErrs = append(allErrs, field.Forbidden( @@ -648,8 +648,8 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust "can be set only if spec.controlPlane.machineInfrastructure is set in ClusterClass", )) } - allErrs = append(allErrs, validateMachineHealthCheckClass(fldPath, cluster.Namespace, - &cluster.Spec.Topology.ControlPlane.MachineHealthCheck.MachineHealthCheckClass)...) + allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, cluster.Spec.Topology.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) + allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, cluster.Spec.Topology.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) } // If MachineHealthCheck is explicitly enabled then make sure that a MachineHealthCheck definition is @@ -657,12 +657,12 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust // (One of these definitions will be used in the controller to create the MachineHealthCheck) // Check if the machineHealthCheck is explicitly enabled in the ControlPlaneTopology. - if cluster.Spec.Topology.ControlPlane.MachineHealthCheck.Enable != nil && *cluster.Spec.Topology.ControlPlane.MachineHealthCheck.Enable { + if cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the ControlPlaneTopology of the Cluster or the ControlPlaneClass of the ClusterClass. - if cluster.Spec.Topology.ControlPlane.MachineHealthCheck.IsZero() && clusterClass.Spec.ControlPlane.MachineHealthCheck == nil { + if cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() && clusterClass.Spec.ControlPlane.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), - fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *cluster.Spec.Topology.ControlPlane.MachineHealthCheck.Enable), + fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled), )) } } @@ -670,13 +670,13 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust for i := range cluster.Spec.Topology.Workers.MachineDeployments { md := cluster.Spec.Topology.Workers.MachineDeployments[i] - if md.MachineHealthCheck != nil { + if md.HealthCheck != nil { fldPath := field.NewPath("spec", "topology", "workers", "machineDeployments").Key(md.Name).Child("machineHealthCheck") // Validate the MachineDeployment MachineHealthCheck if defined. - if !md.MachineHealthCheck.IsZero() { - allErrs = append(allErrs, validateMachineHealthCheckClass(fldPath, cluster.Namespace, - &md.MachineHealthCheck.MachineHealthCheckClass)...) + if !md.HealthCheck.IsHealthCheckConfigZero() { + allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, md.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) + allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, md.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) } // If MachineHealthCheck is explicitly enabled then make sure that a MachineHealthCheck definition is @@ -685,12 +685,12 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust mdClass := machineDeploymentClassOfName(clusterClass, md.Class) if mdClass != nil { // Note: we skip handling the nil case here as it is already handled in previous validations. // Check if the machineHealthCheck is explicitly enabled in the machineDeploymentTopology. - if md.MachineHealthCheck.Enable != nil && *md.MachineHealthCheck.Enable { + if md.HealthCheck.Enabled != nil && *md.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the MachineDeploymentTopology of the Cluster or the MachineDeploymentClass of the ClusterClass. - if md.MachineHealthCheck.IsZero() && mdClass.MachineHealthCheck == nil { + if md.HealthCheck.IsHealthCheckConfigZero() && mdClass.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), - fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *md.MachineHealthCheck.Enable), + fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *md.HealthCheck.Enabled), )) } } diff --git a/internal/webhooks/cluster_test.go b/internal/webhooks/cluster_test.go index 7ec27b2a2662..4e725cd56203 100644 --- a/internal/webhooks/cluster_test.go +++ b/internal/webhooks/cluster_test.go @@ -57,17 +57,17 @@ func TestClusterTopologyDefaultNamespaces(t *testing.T) { WithTopology(builder.ClusterTopology(). WithClass("foo"). WithVersion("v1.19.1"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ - RemediationTemplate: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Remediation: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediation{ + TemplateRef: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, }, }). WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("aa"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ - RemediationTemplate: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Remediation: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediation{ + TemplateRef: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, }, }). Build()). @@ -2248,8 +2248,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build()). Build(), @@ -2266,8 +2266,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{}, }, }). @@ -2287,8 +2287,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2312,13 +2312,13 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build()). Build(), class: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), classReconciled: true, wantErr: false, @@ -2331,9 +2331,9 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2361,8 +2361,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build(), ). @@ -2387,8 +2387,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{}, }, }). @@ -2415,8 +2415,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build(), ). @@ -2425,7 +2425,7 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { class: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass"). WithWorkerMachineDeploymentClasses( *builder.MachineDeploymentClass("worker-class"). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). Build(), ). Build(), @@ -2443,9 +2443,9 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, diff --git a/internal/webhooks/clusterclass.go b/internal/webhooks/clusterclass.go index bf9685cfb59e..042fc0beb03a 100644 --- a/internal/webhooks/clusterclass.go +++ b/internal/webhooks/clusterclass.go @@ -23,7 +23,6 @@ import ( "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation" @@ -188,14 +187,14 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol var allErrs field.ErrorList // Check if the MachineHealthCheck for the control plane is dropped. - if oldClusterClass.Spec.ControlPlane.MachineHealthCheck != nil && newClusterClass.Spec.ControlPlane.MachineHealthCheck == nil { + if oldClusterClass.Spec.ControlPlane.HealthCheck != nil && newClusterClass.Spec.ControlPlane.HealthCheck == nil { // Make sure that none of the clusters are using this MachineHealthCheck. clustersUsingMHC := []string{} for _, cluster := range clusters { - if cluster.Spec.Topology.ControlPlane.MachineHealthCheck != nil && - cluster.Spec.Topology.ControlPlane.MachineHealthCheck.Enable != nil && - *cluster.Spec.Topology.ControlPlane.MachineHealthCheck.Enable && - cluster.Spec.Topology.ControlPlane.MachineHealthCheck.IsZero() { + if cluster.Spec.Topology.ControlPlane.HealthCheck != nil && + cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && + *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled && + cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) } } @@ -215,15 +214,15 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol continue } // If the MachineHealthCheck is dropped then check that no cluster is using it. - if oldMdClass.MachineHealthCheck != nil && newMdClass.MachineHealthCheck == nil { + if oldMdClass.HealthCheck != nil && newMdClass.HealthCheck == nil { clustersUsingMHC := []string{} for _, cluster := range clusters { for _, mdTopology := range cluster.Spec.Topology.Workers.MachineDeployments { if mdTopology.Class == newMdClass.Class { - if mdTopology.MachineHealthCheck != nil && - mdTopology.MachineHealthCheck.Enable != nil && - *mdTopology.MachineHealthCheck.Enable && - mdTopology.MachineHealthCheck.IsZero() { + if mdTopology.HealthCheck != nil && + mdTopology.HealthCheck.Enabled != nil && + *mdTopology.HealthCheck.Enabled && + mdTopology.HealthCheck.IsHealthCheckConfigZero() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) break } @@ -361,11 +360,11 @@ func validateMachineHealthCheckClasses(clusterClass *clusterv1.ClusterClass) fie var allErrs field.ErrorList // Validate ControlPlane MachineHealthCheck if defined. - if clusterClass.Spec.ControlPlane.MachineHealthCheck != nil { + if clusterClass.Spec.ControlPlane.HealthCheck != nil { fldPath := field.NewPath("spec", "controlPlane", "machineHealthCheck") - allErrs = append(allErrs, validateMachineHealthCheckClass(fldPath, clusterClass.Namespace, - clusterClass.Spec.ControlPlane.MachineHealthCheck)...) + allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, clusterClass.Spec.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) + allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, clusterClass.Spec.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) // Ensure ControlPlane does not define a MachineHealthCheck if it does not define MachineInfrastructure. if clusterClass.Spec.ControlPlane.MachineInfrastructure == nil { @@ -378,12 +377,13 @@ func validateMachineHealthCheckClasses(clusterClass *clusterv1.ClusterClass) fie // Validate MachineDeployment MachineHealthChecks. for _, md := range clusterClass.Spec.Workers.MachineDeployments { - if md.MachineHealthCheck == nil { + if md.HealthCheck == nil { continue } fldPath := field.NewPath("spec", "workers", "machineDeployments").Key(md.Class).Child("machineHealthCheck") - allErrs = append(allErrs, validateMachineHealthCheckClass(fldPath, clusterClass.Namespace, md.MachineHealthCheck)...) + allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, md.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) + allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, md.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) } return allErrs } @@ -468,23 +468,6 @@ func validateNamingStrategies(clusterClass *clusterv1.ClusterClass) field.ErrorL return allErrs } -// validateMachineHealthCheckClass validates the MachineHealthCheckSpec fields defined in a MachineHealthCheckClass. -func validateMachineHealthCheckClass(fldPath *field.Path, namespace string, m *clusterv1.MachineHealthCheckClass) field.ErrorList { - mhc := clusterv1.MachineHealthCheck{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: namespace, - }, - Spec: clusterv1.MachineHealthCheckSpec{ - NodeStartupTimeoutSeconds: m.NodeStartupTimeoutSeconds, - MaxUnhealthy: m.MaxUnhealthy, - UnhealthyNodeConditions: m.UnhealthyNodeConditions, - UnhealthyRange: m.UnhealthyRange, - RemediationTemplate: m.RemediationTemplate, - }} - - return (&MachineHealthCheck{}).validateCommonFields(&mhc, fldPath) -} - func validateClusterClassMetadata(clusterClass *clusterv1.ClusterClass) field.ErrorList { var allErrs field.ErrorList allErrs = append(allErrs, clusterClass.Spec.ControlPlane.Metadata.Validate(field.NewPath("spec", "controlPlane", "metadata"))...) diff --git a/internal/webhooks/clusterclass_test.go b/internal/webhooks/clusterclass_test.go index 6d1af42472de..0978d0e23d92 100644 --- a/internal/webhooks/clusterclass_test.go +++ b/internal/webhooks/clusterclass_test.go @@ -690,15 +690,17 @@ func TestClusterClassValidation(t *testing.T) { WithControlPlaneInfrastructureMachineTemplate( builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "cp-infra1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, + NodeStartupTimeoutSeconds: ptr.To(int32(60)), }, - NodeStartupTimeoutSeconds: ptr.To(int32(60)), }). Build(), }, @@ -711,8 +713,10 @@ func TestClusterClassValidation(t *testing.T) { builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). // No ControlPlaneMachineInfrastructure makes this an invalid creation request. - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{ - NodeStartupTimeoutSeconds: ptr.To(int32(60)), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(60)), + }, }). Build(), expectErr: true, @@ -728,8 +732,10 @@ func TestClusterClassValidation(t *testing.T) { WithControlPlaneInfrastructureMachineTemplate( builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "cp-infra1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{ - NodeStartupTimeoutSeconds: ptr.To(int32(60)), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(60)), + }, }). Build(), expectErr: false, @@ -748,15 +754,17 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, + NodeStartupTimeoutSeconds: ptr.To(int32(60)), }, - NodeStartupTimeoutSeconds: ptr.To(int32(60)), }). Build()). Build(), @@ -775,16 +783,18 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, + // nodeStartupTimeout is too short here. + NodeStartupTimeoutSeconds: ptr.To(int32(10)), }, - // nodeStartupTimeout is too short here. - NodeStartupTimeoutSeconds: ptr.To(int32(10)), }). Build()). Build(), @@ -804,8 +814,10 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{ - NodeStartupTimeoutSeconds: ptr.To(int32(60)), + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ + Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: ptr.To(int32(60)), + }, }). Build()). Build(), @@ -2072,8 +2084,8 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.Cluster(metav1.NamespaceDefault, "cluster1"). WithTopology(builder.ClusterTopology(). WithClass("clusterclass1"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build()). Build(), @@ -2084,12 +2096,14 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionUnknown, - TimeoutSeconds: 5 * 60, + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ + Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionUnknown, + TimeoutSeconds: 5 * 60, + }, }, }, }). @@ -2118,7 +2132,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), newClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1"). WithInfrastructureClusterTemplate( @@ -2135,9 +2149,9 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.Cluster(metav1.NamespaceDefault, "cluster1"). WithTopology(builder.ClusterTopology(). WithClass("clusterclass1"). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2156,7 +2170,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.MachineHealthCheckClass{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). Build(), newClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1"). WithInfrastructureClusterTemplate( @@ -2175,8 +2189,8 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithClass("clusterclass1"). WithMachineDeployment(builder.MachineDeploymentTopology("md1"). WithClass("mdclass1"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), }). Build()). Build()). @@ -2194,7 +2208,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). Build(), ). Build(), @@ -2239,7 +2253,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). Build(), ). Build(), @@ -2268,9 +2282,9 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithClass("clusterclass1"). WithMachineDeployment(builder.MachineDeploymentTopology("md1"). WithClass("mdclass1"). - WithMachineHealthCheck(&clusterv1.MachineHealthCheckTopology{ - Enable: ptr.To(true), - MachineHealthCheckClass: clusterv1.MachineHealthCheckClass{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + Enabled: ptr.To(true), + Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2296,7 +2310,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineHealthCheckClass{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). Build(), ). Build(), diff --git a/internal/webhooks/machinehealthcheck.go b/internal/webhooks/machinehealthcheck.go index 696eb626900e..5405bda94c7d 100644 --- a/internal/webhooks/machinehealthcheck.go +++ b/internal/webhooks/machinehealthcheck.go @@ -77,8 +77,8 @@ func (webhook *MachineHealthCheck) Default(_ context.Context, obj runtime.Object } m.Labels[clusterv1.ClusterNameLabel] = m.Spec.ClusterName - if m.Spec.NodeStartupTimeoutSeconds == nil { - m.Spec.NodeStartupTimeoutSeconds = &clusterv1.DefaultNodeStartupTimeoutSeconds + if m.Spec.Checks.NodeStartupTimeoutSeconds == nil { + m.Spec.Checks.NodeStartupTimeoutSeconds = &clusterv1.DefaultNodeStartupTimeoutSeconds } return nil @@ -147,7 +147,8 @@ func (webhook *MachineHealthCheck) validate(oldMHC, newMHC *clusterv1.MachineHea ) } - allErrs = append(allErrs, webhook.validateCommonFields(newMHC, specPath)...) + allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(specPath, newMHC.Spec.Checks.NodeStartupTimeoutSeconds)...) + allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(specPath, newMHC.Spec.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) if len(allErrs) == 0 { return nil @@ -155,27 +156,28 @@ func (webhook *MachineHealthCheck) validate(oldMHC, newMHC *clusterv1.MachineHea return apierrors.NewInvalid(clusterv1.GroupVersion.WithKind("MachineHealthCheck").GroupKind(), newMHC.Name, allErrs) } -// ValidateCommonFields validates NodeStartupTimeoutSeconds, MaxUnhealthy, and RemediationTemplate of the MHC. -// These are the fields in common with other types which define MachineHealthChecks such as MachineHealthCheckClass and MachineHealthCheckTopology. -func (webhook *MachineHealthCheck) validateCommonFields(m *clusterv1.MachineHealthCheck, fldPath *field.Path) field.ErrorList { +func validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath *field.Path, nodeStartupTimeoutSeconds *int32) field.ErrorList { var allErrs field.ErrorList - - if m.Spec.NodeStartupTimeoutSeconds != nil && - *m.Spec.NodeStartupTimeoutSeconds != disabledNodeStartupTimeoutSeconds && - *m.Spec.NodeStartupTimeoutSeconds < minNodeStartupTimeoutSeconds { + if nodeStartupTimeoutSeconds != nil && + *nodeStartupTimeoutSeconds != disabledNodeStartupTimeoutSeconds && + *nodeStartupTimeoutSeconds < minNodeStartupTimeoutSeconds { allErrs = append( allErrs, - field.Invalid(fldPath.Child("nodeStartupTimeoutSeconds"), *m.Spec.NodeStartupTimeoutSeconds, "must be at least 30s"), + field.Invalid(fldPath.Child("checks", "nodeStartupTimeoutSeconds"), *nodeStartupTimeoutSeconds, "must be at least 30s"), ) } - if m.Spec.MaxUnhealthy != nil { - if _, err := intstr.GetScaledValueFromIntOrPercent(m.Spec.MaxUnhealthy, 0, false); err != nil { + return allErrs +} + +func validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath *field.Path, unhealthyLessThanOrEqualTo *intstr.IntOrString) field.ErrorList { + var allErrs field.ErrorList + if unhealthyLessThanOrEqualTo != nil { + if _, err := intstr.GetScaledValueFromIntOrPercent(unhealthyLessThanOrEqualTo, 0, false); err != nil { allErrs = append( allErrs, - field.Invalid(fldPath.Child("maxUnhealthy"), m.Spec.MaxUnhealthy, fmt.Sprintf("must be either an int or a percentage: %v", err.Error())), + field.Invalid(fldPath.Child("remediation", "triggerIf", "unhealthyLessThanOrEqualTo"), unhealthyLessThanOrEqualTo, fmt.Sprintf("must be either an int or a percentage: %v", err.Error())), ) } } - return allErrs } diff --git a/internal/webhooks/machinehealthcheck_test.go b/internal/webhooks/machinehealthcheck_test.go index 989a9a2a9733..3ac7c2003d2a 100644 --- a/internal/webhooks/machinehealthcheck_test.go +++ b/internal/webhooks/machinehealthcheck_test.go @@ -23,6 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/ptr" clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/internal/webhooks/util" @@ -38,13 +39,17 @@ func TestMachineHealthCheckDefault(t *testing.T) { Selector: metav1.LabelSelector{ MatchLabels: map[string]string{"foo": "bar"}, }, - RemediationTemplate: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TemplateRef: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, + }, }, } webhook := &MachineHealthCheck{} @@ -53,8 +58,8 @@ func TestMachineHealthCheckDefault(t *testing.T) { g.Expect(webhook.Default(ctx, mhc)).To(Succeed()) g.Expect(mhc.Labels[clusterv1.ClusterNameLabel]).To(Equal(mhc.Spec.ClusterName)) - g.Expect(mhc.Spec.NodeStartupTimeoutSeconds).ToNot(BeNil()) - g.Expect(*mhc.Spec.NodeStartupTimeoutSeconds).To(Equal(int32(10 * 60))) + g.Expect(mhc.Spec.Checks.NodeStartupTimeoutSeconds).ToNot(BeNil()) + g.Expect(*mhc.Spec.Checks.NodeStartupTimeoutSeconds).To(Equal(int32(10 * 60))) } func TestMachineHealthCheckLabelSelectorAsSelectorValidation(t *testing.T) { @@ -83,10 +88,12 @@ func TestMachineHealthCheckLabelSelectorAsSelectorValidation(t *testing.T) { Selector: metav1.LabelSelector{ MatchLabels: tt.selectors, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, @@ -145,10 +152,12 @@ func TestMachineHealthCheckClusterNameImmutable(t *testing.T) { "test": "test", }, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, @@ -161,10 +170,12 @@ func TestMachineHealthCheckClusterNameImmutable(t *testing.T) { "test": "test", }, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, @@ -219,7 +230,9 @@ func TestMachineHealthCheckUnhealthyNodeConditions(t *testing.T) { "test": "test", }, }, - UnhealthyNodeConditions: tt.unhealthyNodeConditions, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: tt.unhealthyNodeConditions, + }, }, } webhook := &MachineHealthCheck{} @@ -292,16 +305,18 @@ func TestMachineHealthCheckNodeStartupTimeout(t *testing.T) { mhc := &clusterv1.MachineHealthCheck{ Spec: clusterv1.MachineHealthCheckSpec{ - NodeStartupTimeoutSeconds: tt.timeout, Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ "test": "test", }, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + NodeStartupTimeoutSeconds: tt.timeout, + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, @@ -357,19 +372,24 @@ func TestMachineHealthCheckMaxUnhealthy(t *testing.T) { for _, tt := range tests { g := NewWithT(t) - maxUnhealthy := tt.value mhc := &clusterv1.MachineHealthCheck{ Spec: clusterv1.MachineHealthCheckSpec{ - MaxUnhealthy: &maxUnhealthy, Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ "test": "test", }, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, + }, + }, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: ptr.To(tt.value), }, }, }, @@ -398,10 +418,12 @@ func TestMachineHealthCheckSelectorValidation(t *testing.T) { g := NewWithT(t) mhc := &clusterv1.MachineHealthCheck{ Spec: clusterv1.MachineHealthCheckSpec{ - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, @@ -424,10 +446,12 @@ func TestMachineHealthCheckClusterNameSelectorValidation(t *testing.T) { "baz": "qux", }, }, - UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ - { - Type: corev1.NodeReady, - Status: corev1.ConditionFalse, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ + { + Type: corev1.NodeReady, + Status: corev1.ConditionFalse, + }, }, }, }, diff --git a/test/e2e/data/infrastructure-docker/main/cluster-template-kcp-remediation/mhc.yaml b/test/e2e/data/infrastructure-docker/main/cluster-template-kcp-remediation/mhc.yaml index 653b44343125..3bd890e2f495 100644 --- a/test/e2e/data/infrastructure-docker/main/cluster-template-kcp-remediation/mhc.yaml +++ b/test/e2e/data/infrastructure-docker/main/cluster-template-kcp-remediation/mhc.yaml @@ -9,13 +9,16 @@ metadata: name: "${CLUSTER_NAME}-mhc-0" spec: clusterName: "${CLUSTER_NAME}" - maxUnhealthy: 100% selector: matchLabels: cluster.x-k8s.io/control-plane: "" mhc-test: "fail" - nodeStartupTimeoutSeconds: 30 - unhealthyNodeConditions: - - type: e2e.remediation.condition - status: "False" - timeoutSeconds: 10 + checks: + nodeStartupTimeoutSeconds: 30 + unhealthyNodeConditions: + - type: e2e.remediation.condition + status: "False" + timeoutSeconds: 10 + remediation: + triggerIf: + unhealthyLessThanOrEqualTo: 100% diff --git a/test/e2e/data/infrastructure-docker/main/cluster-template-md-remediation/mhc.yaml b/test/e2e/data/infrastructure-docker/main/cluster-template-md-remediation/mhc.yaml index a1209cf6270b..1c65f920dc68 100644 --- a/test/e2e/data/infrastructure-docker/main/cluster-template-md-remediation/mhc.yaml +++ b/test/e2e/data/infrastructure-docker/main/cluster-template-md-remediation/mhc.yaml @@ -8,11 +8,14 @@ metadata: name: "${CLUSTER_NAME}-mhc-0" spec: clusterName: "${CLUSTER_NAME}" - maxUnhealthy: 100% selector: matchLabels: e2e.remediation.label: "" - unhealthyNodeConditions: - - type: e2e.remediation.condition - status: "False" - timeoutSeconds: 10 + checks: + unhealthyNodeConditions: + - type: e2e.remediation.condition + status: "False" + timeoutSeconds: 10 + remediation: + triggerIf: + unhealthyLessThanOrEqualTo: 100% diff --git a/test/e2e/data/infrastructure-docker/main/clusterclass-in-memory.yaml b/test/e2e/data/infrastructure-docker/main/clusterclass-in-memory.yaml index 180664874e13..3e915c2f8f07 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-in-memory.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-in-memory.yaml @@ -87,14 +87,15 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta2 kind: KubeadmControlPlaneTemplate name: in-memory-control-plane - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: "Unknown" - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: "Unknown" + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 infrastructure: templateRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -113,14 +114,15 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DevMachineTemplate name: in-memory-default-worker-machinetemplate - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: "Unknown" - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: "Unknown" + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 patches: - name: test-patch external: diff --git a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml index 3eeae8d983d6..c5e0fe07834c 100644 --- a/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml +++ b/test/e2e/data/infrastructure-docker/main/clusterclass-quick-start.yaml @@ -18,11 +18,12 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachineTemplate name: quick-start-control-plane - machineHealthCheck: - unhealthyNodeConditions: - - type: e2e.remediation.condition - status: "False" - timeoutSeconds: 20 + healthCheck: + checks: + unhealthyNodeConditions: + - type: e2e.remediation.condition + status: "False" + timeoutSeconds: 20 infrastructure: templateRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 diff --git a/test/extension/handlers/topologymutation/handler_integration_test.go b/test/extension/handlers/topologymutation/handler_integration_test.go index 47f886030781..6fc67aeb5455 100644 --- a/test/extension/handlers/topologymutation/handler_integration_test.go +++ b/test/extension/handlers/topologymutation/handler_integration_test.go @@ -282,7 +282,7 @@ func getScope(cluster *clusterv1.Cluster, clusterClassFile string) (*scope.Scope s.Blueprint.ControlPlane.InfrastructureMachineTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, s.Blueprint.ClusterClass.Spec.ControlPlane.MachineInfrastructure.TemplateRef)) } if s.Blueprint.HasControlPlaneMachineHealthCheck() { - s.Blueprint.ControlPlane.MachineHealthCheck = s.Blueprint.ClusterClass.Spec.ControlPlane.MachineHealthCheck + s.Blueprint.ControlPlane.MachineHealthCheck = s.Blueprint.ClusterClass.Spec.ControlPlane.HealthCheck } // MachineDeployments. @@ -291,8 +291,8 @@ func getScope(cluster *clusterv1.Cluster, clusterClassFile string) (*scope.Scope machineDeploymentClass.Metadata.DeepCopyInto(&machineDeploymentBlueprint.Metadata) machineDeploymentBlueprint.InfrastructureMachineTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, machineDeploymentClass.Infrastructure.TemplateRef)) machineDeploymentBlueprint.BootstrapTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, machineDeploymentClass.Bootstrap.TemplateRef)) - if machineDeploymentClass.MachineHealthCheck != nil { - machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.MachineHealthCheck + if machineDeploymentClass.HealthCheck != nil { + machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.HealthCheck } s.Blueprint.MachineDeployments[machineDeploymentClass.Class] = machineDeploymentBlueprint } diff --git a/test/framework/machinehealthcheck_helpers.go b/test/framework/machinehealthcheck_helpers.go index a7ee204a585b..f17122a6eaf3 100644 --- a/test/framework/machinehealthcheck_helpers.go +++ b/test/framework/machinehealthcheck_helpers.go @@ -56,7 +56,7 @@ func DiscoverMachineHealthChecksAndWaitForRemediation(ctx context.Context, input Expect(machineHealthChecks).NotTo(BeEmpty()) for _, mhc := range machineHealthChecks { - Expect(mhc.Spec.UnhealthyNodeConditions).NotTo(BeEmpty()) + Expect(mhc.Spec.Checks.UnhealthyNodeConditions).NotTo(BeEmpty()) fmt.Fprintln(GinkgoWriter, "Ensuring there is at least 1 Machine that MachineHealthCheck is matching") machines := GetMachinesByMachineHealthCheck(ctx, GetMachinesByMachineHealthCheckInput{ @@ -69,8 +69,8 @@ func DiscoverMachineHealthChecksAndWaitForRemediation(ctx context.Context, input fmt.Fprintln(GinkgoWriter, "Patching MachineHealthCheck unhealthy condition to one of the nodes") unhealthyNodeCondition := corev1.NodeCondition{ - Type: mhc.Spec.UnhealthyNodeConditions[0].Type, - Status: mhc.Spec.UnhealthyNodeConditions[0].Status, + Type: mhc.Spec.Checks.UnhealthyNodeConditions[0].Type, + Status: mhc.Spec.Checks.UnhealthyNodeConditions[0].Status, LastTransitionTime: metav1.Time{Time: time.Now()}, } PatchNodeCondition(ctx, PatchNodeConditionInput{ @@ -170,7 +170,7 @@ func WaitForMachineHealthCheckToRemediateUnhealthyNodeCondition(ctx context.Cont // hasMatchingUnhealthyNodeConditions returns true if any node condition matches with machine health check unhealthy conditions. func hasMatchingUnhealthyNodeConditions(machineHealthCheck *clusterv1.MachineHealthCheck, nodeConditions []corev1.NodeCondition) bool { - for _, unhealthyNodeCondition := range machineHealthCheck.Spec.UnhealthyNodeConditions { + for _, unhealthyNodeCondition := range machineHealthCheck.Spec.Checks.UnhealthyNodeConditions { for _, nodeCondition := range nodeConditions { if nodeCondition.Type == unhealthyNodeCondition.Type && nodeCondition.Status == unhealthyNodeCondition.Status { return true diff --git a/test/infrastructure/docker/templates/clusterclass-in-memory.yaml b/test/infrastructure/docker/templates/clusterclass-in-memory.yaml index d0bb3f35e0be..5408c9f2be7f 100644 --- a/test/infrastructure/docker/templates/clusterclass-in-memory.yaml +++ b/test/infrastructure/docker/templates/clusterclass-in-memory.yaml @@ -117,14 +117,15 @@ spec: apiVersion: controlplane.cluster.x-k8s.io/v1beta2 kind: KubeadmControlPlaneTemplate name: in-memory-control-plane - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: Unknown - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: Unknown + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 infrastructure: templateRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -143,11 +144,12 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DevMachineTemplate name: in-memory-default-worker-machinetemplate - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: Unknown - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: Unknown + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 diff --git a/test/infrastructure/docker/templates/clusterclass-quick-start.yaml b/test/infrastructure/docker/templates/clusterclass-quick-start.yaml index 3a287efdeb37..ea82a08d06c5 100644 --- a/test/infrastructure/docker/templates/clusterclass-quick-start.yaml +++ b/test/infrastructure/docker/templates/clusterclass-quick-start.yaml @@ -13,14 +13,15 @@ spec: kind: DockerMachineTemplate apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 name: quick-start-control-plane - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: Unknown - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: Unknown + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 infrastructure: templateRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 @@ -39,14 +40,15 @@ spec: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: DockerMachineTemplate name: quick-start-default-worker-machinetemplate - machineHealthCheck: - unhealthyNodeConditions: - - type: Ready - status: Unknown - timeoutSeconds: 300 - - type: Ready - status: "False" - timeoutSeconds: 300 + healthCheck: + checks: + unhealthyNodeConditions: + - type: Ready + status: Unknown + timeoutSeconds: 300 + - type: Ready + status: "False" + timeoutSeconds: 300 machinePools: - class: default-worker bootstrap: diff --git a/util/test/builder/builders.go b/util/test/builder/builders.go index e8d20bff8eb2..af42ce85e30a 100644 --- a/util/test/builder/builders.go +++ b/util/test/builder/builders.go @@ -119,7 +119,7 @@ type ClusterTopologyBuilder struct { workers clusterv1.WorkersTopology version string controlPlaneReplicas int32 - controlPlaneMHC *clusterv1.MachineHealthCheckTopology + controlPlaneMHC *clusterv1.ControlPlaneTopologyMachineHealthCheck variables []clusterv1.ClusterVariable controlPlaneVariables []clusterv1.ClusterVariable } @@ -161,8 +161,8 @@ func (c *ClusterTopologyBuilder) WithControlPlaneVariables(variables ...clusterv return c } -// WithControlPlaneMachineHealthCheck adds MachineHealthCheckTopology used as the MachineHealthCheck value. -func (c *ClusterTopologyBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.MachineHealthCheckTopology) *ClusterTopologyBuilder { +// WithControlPlaneMachineHealthCheck adds ControlPlaneTopologyMachineHealthCheck used as the MachineHealthCheck value. +func (c *ClusterTopologyBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneTopologyMachineHealthCheck) *ClusterTopologyBuilder { c.controlPlaneMHC = mhc return c } @@ -195,8 +195,8 @@ func (c *ClusterTopologyBuilder) Build() *clusterv1.Topology { Workers: c.workers, Version: c.version, ControlPlane: clusterv1.ControlPlaneTopology{ - Replicas: &c.controlPlaneReplicas, - MachineHealthCheck: c.controlPlaneMHC, + Replicas: &c.controlPlaneReplicas, + HealthCheck: c.controlPlaneMHC, }, Variables: c.variables, } @@ -216,7 +216,7 @@ type MachineDeploymentTopologyBuilder struct { class string name string replicas *int32 - mhc *clusterv1.MachineHealthCheckTopology + mhc *clusterv1.MachineDeploymentTopologyMachineHealthCheck variables []clusterv1.ClusterVariable } @@ -251,8 +251,8 @@ func (m *MachineDeploymentTopologyBuilder) WithVariables(variables ...clusterv1. return m } -// WithMachineHealthCheck adds MachineHealthCheckTopology used as the MachineHealthCheck value. -func (m *MachineDeploymentTopologyBuilder) WithMachineHealthCheck(mhc *clusterv1.MachineHealthCheckTopology) *MachineDeploymentTopologyBuilder { +// WithMachineHealthCheck adds MachineDeploymentTopologyMachineHealthCheck used as the MachineHealthCheck value. +func (m *MachineDeploymentTopologyBuilder) WithMachineHealthCheck(mhc *clusterv1.MachineDeploymentTopologyMachineHealthCheck) *MachineDeploymentTopologyBuilder { m.mhc = mhc return m } @@ -263,10 +263,10 @@ func (m *MachineDeploymentTopologyBuilder) Build() clusterv1.MachineDeploymentTo Metadata: clusterv1.ObjectMeta{ Annotations: m.annotations, }, - Class: m.class, - Name: m.name, - Replicas: m.replicas, - MachineHealthCheck: m.mhc, + Class: m.class, + Name: m.name, + Replicas: m.replicas, + HealthCheck: m.mhc, } if len(m.variables) > 0 { @@ -345,7 +345,7 @@ type ClusterClassBuilder struct { controlPlaneReadinessGates []clusterv1.MachineReadinessGate controlPlaneTemplate *unstructured.Unstructured controlPlaneInfrastructureMachineTemplate *unstructured.Unstructured - controlPlaneMHC *clusterv1.MachineHealthCheckClass + controlPlaneMHC *clusterv1.ControlPlaneClassMachineHealthCheck controlPlaneNodeDrainTimeout *int32 controlPlaneNodeVolumeDetachTimeout *int32 controlPlaneNodeDeletionTimeout *int32 @@ -401,7 +401,7 @@ func (c *ClusterClassBuilder) WithControlPlaneInfrastructureMachineTemplate(t *u } // WithControlPlaneMachineHealthCheck adds a MachineHealthCheck for the ControlPlane to the ClusterClassBuilder. -func (c *ClusterClassBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.MachineHealthCheckClass) *ClusterClassBuilder { +func (c *ClusterClassBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneClassMachineHealthCheck) *ClusterClassBuilder { c.controlPlaneMHC = mhc return c } @@ -513,7 +513,7 @@ func (c *ClusterClassBuilder) Build() *clusterv1.ClusterClass { obj.Spec.ControlPlane.TemplateRef = objToClusterClassTemplateRef(c.controlPlaneTemplate) } if c.controlPlaneMHC != nil { - obj.Spec.ControlPlane.MachineHealthCheck = c.controlPlaneMHC + obj.Spec.ControlPlane.HealthCheck = c.controlPlaneMHC } if c.controlPlaneNodeDrainTimeout != nil { obj.Spec.ControlPlane.Deletion.NodeDrainTimeoutSeconds = c.controlPlaneNodeDrainTimeout @@ -548,7 +548,7 @@ type MachineDeploymentClassBuilder struct { bootstrapTemplate *unstructured.Unstructured labels map[string]string annotations map[string]string - machineHealthCheckClass *clusterv1.MachineHealthCheckClass + machineHealthCheckClass *clusterv1.MachineDeploymentClassMachineHealthCheck readinessGates []clusterv1.MachineReadinessGate failureDomain *string nodeDrainTimeout *int32 @@ -591,7 +591,7 @@ func (m *MachineDeploymentClassBuilder) WithAnnotations(annotations map[string]s } // WithMachineHealthCheckClass sets the MachineHealthCheckClass for the MachineDeploymentClassBuilder. -func (m *MachineDeploymentClassBuilder) WithMachineHealthCheckClass(mhc *clusterv1.MachineHealthCheckClass) *MachineDeploymentClassBuilder { +func (m *MachineDeploymentClassBuilder) WithMachineHealthCheckClass(mhc *clusterv1.MachineDeploymentClassMachineHealthCheck) *MachineDeploymentClassBuilder { m.machineHealthCheckClass = mhc return m } @@ -660,7 +660,7 @@ func (m *MachineDeploymentClassBuilder) Build() *clusterv1.MachineDeploymentClas obj.Infrastructure.TemplateRef = objToClusterClassTemplateRef(m.infrastructureMachineTemplate) } if m.machineHealthCheckClass != nil { - obj.MachineHealthCheck = m.machineHealthCheckClass + obj.HealthCheck = m.machineHealthCheckClass } if m.readinessGates != nil { obj.ReadinessGates = m.readinessGates @@ -2154,10 +2154,16 @@ func (m *MachineHealthCheckBuilder) Build() *clusterv1.MachineHealthCheck { OwnerReferences: m.ownerRefs, }, Spec: clusterv1.MachineHealthCheckSpec{ - ClusterName: m.clusterName, - Selector: m.selector, - UnhealthyNodeConditions: m.unhealthyNodeConditions, - MaxUnhealthy: m.maxUnhealthy, + ClusterName: m.clusterName, + Selector: m.selector, + Checks: clusterv1.MachineHealthCheckChecks{ + UnhealthyNodeConditions: m.unhealthyNodeConditions, + }, + Remediation: clusterv1.MachineHealthCheckRemediation{ + TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ + UnhealthyLessThanOrEqualTo: m.maxUnhealthy, + }, + }, }, } if m.clusterName != "" { diff --git a/util/test/builder/zz_generated.deepcopy.go b/util/test/builder/zz_generated.deepcopy.go index 4aa8b545c627..bf62c91d1427 100644 --- a/util/test/builder/zz_generated.deepcopy.go +++ b/util/test/builder/zz_generated.deepcopy.go @@ -135,7 +135,7 @@ func (in *ClusterClassBuilder) DeepCopyInto(out *ClusterClassBuilder) { } if in.controlPlaneMHC != nil { in, out := &in.controlPlaneMHC, &out.controlPlaneMHC - *out = new(v1beta2.MachineHealthCheckClass) + *out = new(v1beta2.ControlPlaneClassMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.controlPlaneNodeDrainTimeout != nil { @@ -223,7 +223,7 @@ func (in *ClusterTopologyBuilder) DeepCopyInto(out *ClusterTopologyBuilder) { in.workers.DeepCopyInto(&out.workers) if in.controlPlaneMHC != nil { in, out := &in.controlPlaneMHC, &out.controlPlaneMHC - *out = new(v1beta2.MachineHealthCheckTopology) + *out = new(v1beta2.ControlPlaneTopologyMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.variables != nil { @@ -533,7 +533,7 @@ func (in *MachineDeploymentClassBuilder) DeepCopyInto(out *MachineDeploymentClas } if in.machineHealthCheckClass != nil { in, out := &in.machineHealthCheckClass, &out.machineHealthCheckClass - *out = new(v1beta2.MachineHealthCheckClass) + *out = new(v1beta2.MachineDeploymentClassMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.readinessGates != nil { @@ -601,7 +601,7 @@ func (in *MachineDeploymentTopologyBuilder) DeepCopyInto(out *MachineDeploymentT } if in.mhc != nil { in, out := &in.mhc, &out.mhc - *out = new(v1beta2.MachineHealthCheckTopology) + *out = new(v1beta2.MachineDeploymentTopologyMachineHealthCheck) (*in).DeepCopyInto(*out) } if in.variables != nil { From 576a4a91895e00371bd4845bec4a53c962088645 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Fri, 18 Jul 2025 17:30:29 +0200 Subject: [PATCH 2/7] Fix review findings --- api/core/v1beta2/cluster_types.go | 28 +++++++++---------- api/core/v1beta2/clusterclass_types.go | 12 ++++---- api/core/v1beta2/zz_generated.openapi.go | 28 +++++++++---------- .../crd/bases/cluster.x-k8s.io_clusters.yaml | 8 +++--- exp/topology/scope/blueprint.go | 8 +++--- internal/webhooks/cluster.go | 8 +++--- internal/webhooks/clusterclass.go | 4 +-- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index 528c541e5a88..ebd9c62f78dd 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -611,8 +611,8 @@ type ControlPlaneTopology struct { // +optional Replicas *int32 `json:"replicas,omitempty"` - // healthCheck allows to enable, disable and override - // the MachineHealthCheck configuration in the ClusterClass for this control plane. + // healthCheck allows to enable, disable and override control plane health check + // configuration from the ClusterClass for this control plane. // +optional HealthCheck *ControlPlaneTopologyMachineHealthCheck `json:"healthCheck,omitempty"` @@ -641,7 +641,7 @@ type ControlPlaneTopology struct { Variables ControlPlaneVariables `json:"variables,omitempty,omitzero"` } -// ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for control plane machines. // +kubebuilder:validation:MinProperties=1 type ControlPlaneTopologyMachineHealthCheck struct { // enabled controls if a MachineHealthCheck should be created for the target machines. @@ -665,12 +665,12 @@ type ControlPlaneTopologyMachineHealthCheck struct { Remediation ControlPlaneTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// IsHealthCheckConfigZero returns true if both checks and remediation are zero. -func (m *ControlPlaneTopologyMachineHealthCheck) IsHealthCheckConfigZero() bool { +// IsDefined returns true if both checks and remediation are zero. +func (m *ControlPlaneTopologyMachineHealthCheck) IsDefined() bool { return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() } -// ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. // +kubebuilder:validation:MinProperties=1 type ControlPlaneTopologyMachineHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck @@ -700,7 +700,7 @@ type ControlPlaneTopologyMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 type ControlPlaneTopologyMachineHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. @@ -825,8 +825,8 @@ type MachineDeploymentTopology struct { // +optional Replicas *int32 `json:"replicas,omitempty"` - // healthCheck allows to enable, disable and override - // the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment. + // healthCheck allows to enable, disable and override MachineDeployment health check + // configuration from the ClusterClass for this MachineDeployment. // +optional HealthCheck *MachineDeploymentTopologyMachineHealthCheck `json:"healthCheck,omitempty"` @@ -866,7 +866,7 @@ type MachineDeploymentTopology struct { Variables MachineDeploymentVariables `json:"variables,omitempty,omitzero"` } -// MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentTopologyMachineHealthCheck struct { // enabled controls if a MachineHealthCheck should be created for the target machines. @@ -890,12 +890,12 @@ type MachineDeploymentTopologyMachineHealthCheck struct { Remediation MachineDeploymentTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// IsHealthCheckConfigZero returns true if both checks and remediation are zero. -func (m *MachineDeploymentTopologyMachineHealthCheck) IsHealthCheckConfigZero() bool { +// IsDefined returns true if both checks and remediation are zero. +func (m *MachineDeploymentTopologyMachineHealthCheck) IsDefined() bool { return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() } -// MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentTopologyMachineHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck @@ -925,7 +925,7 @@ type MachineDeploymentTopologyMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentTopologyMachineHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. diff --git a/api/core/v1beta2/clusterclass_types.go b/api/core/v1beta2/clusterclass_types.go index 893a53c7c75f..166314ae71f7 100644 --- a/api/core/v1beta2/clusterclass_types.go +++ b/api/core/v1beta2/clusterclass_types.go @@ -198,7 +198,7 @@ type ControlPlaneClass struct { ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"` } -// ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for control plane machines. // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassMachineHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. @@ -210,7 +210,7 @@ type ControlPlaneClassMachineHealthCheck struct { Remediation ControlPlaneClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassMachineHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck @@ -240,7 +240,7 @@ type ControlPlaneClassMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassMachineHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. @@ -435,7 +435,7 @@ type MachineDeploymentClass struct { Strategy MachineDeploymentStrategy `json:"strategy,omitempty,omitzero"` } -// MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for a group of machines. +// MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassMachineHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. @@ -447,7 +447,7 @@ type MachineDeploymentClassMachineHealthCheck struct { Remediation MachineDeploymentClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy. +// MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassMachineHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck @@ -477,7 +477,7 @@ type MachineDeploymentClassMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy. +// MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassMachineHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. diff --git a/api/core/v1beta2/zz_generated.openapi.go b/api/core/v1beta2/zz_generated.openapi.go index 6b70c3ce9390..8e08f2429d78 100644 --- a/api/core/v1beta2/zz_generated.openapi.go +++ b/api/core/v1beta2/zz_generated.openapi.go @@ -1591,7 +1591,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheck(ref return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Description: "ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for control plane machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "checks": { @@ -1620,7 +1620,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChec return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Description: "ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -1661,7 +1661,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckReme return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { @@ -1779,7 +1779,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref common.Referen }, "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this control plane.", + Description: "healthCheck allows to enable, disable and override control plane health check configuration from the ClusterClass for this control plane.", Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck"), }, }, @@ -1865,7 +1865,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck( return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Description: "ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for control plane machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "enabled": { @@ -1901,7 +1901,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckC return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Description: "ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -1942,7 +1942,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckR return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { @@ -2917,7 +2917,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Description: "MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "checks": { @@ -2946,7 +2946,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Description: "MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -2987,7 +2987,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { @@ -3410,7 +3410,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref common.Re }, "healthCheck": { SchemaProps: spec.SchemaProps{ - Description: "healthCheck allows to enable, disable and override the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment.", + Description: "healthCheck allows to enable, disable and override MachineDeployment health check configuration from the ClusterClass for this MachineDeployment.", Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck"), }, }, @@ -3511,7 +3511,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for a group of machines.", + Description: "MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "enabled": { @@ -3547,7 +3547,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a Machine is healthy.", + Description: "MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -3588,7 +3588,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index a4789525b8d4..7b865435b17a 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -2442,8 +2442,8 @@ spec: type: object healthCheck: description: |- - healthCheck allows to enable, disable and override - the MachineHealthCheck configuration in the ClusterClass for this control plane. + healthCheck allows to enable, disable and override control plane health check + configuration from the ClusterClass for this control plane. minProperties: 1 properties: checks: @@ -2812,8 +2812,8 @@ spec: type: string healthCheck: description: |- - healthCheck allows to enable, disable and override - the MachineHealthCheck configuration in the ClusterClass for this MachineDeployment. + healthCheck allows to enable, disable and override MachineDeployment health check + configuration from the ClusterClass for this MachineDeployment. minProperties: 1 properties: checks: diff --git a/exp/topology/scope/blueprint.go b/exp/topology/scope/blueprint.go index a9912ba4d632..f8fd6b52933d 100644 --- a/exp/topology/scope/blueprint.go +++ b/exp/topology/scope/blueprint.go @@ -104,7 +104,7 @@ func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool { } // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. if b.ClusterClass.Spec.ControlPlane.HealthCheck == nil && - (b.Topology.ControlPlane.HealthCheck == nil || b.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero()) { + (b.Topology.ControlPlane.HealthCheck == nil || b.Topology.ControlPlane.HealthCheck.IsDefined()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. @@ -121,7 +121,7 @@ func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() (clusterv1.Mach return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - if b.Topology.ControlPlane.HealthCheck != nil && !b.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { + if b.Topology.ControlPlane.HealthCheck != nil && !b.Topology.ControlPlane.HealthCheck.IsDefined() { return clusterv1.MachineHealthCheckChecks{ NodeStartupTimeoutSeconds: b.Topology.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds, UnhealthyNodeConditions: b.Topology.ControlPlane.HealthCheck.Checks.UnhealthyNodeConditions, @@ -155,7 +155,7 @@ func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool { // Returns false otherwise. func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool { // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. - if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || md.HealthCheck.IsHealthCheckConfigZero()) { + if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || md.HealthCheck.IsDefined()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. @@ -172,7 +172,7 @@ func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - if md.HealthCheck != nil && !md.HealthCheck.IsHealthCheckConfigZero() { + if md.HealthCheck != nil && !md.HealthCheck.IsDefined() { return clusterv1.MachineHealthCheckChecks{ NodeStartupTimeoutSeconds: md.HealthCheck.Checks.NodeStartupTimeoutSeconds, UnhealthyNodeConditions: md.HealthCheck.Checks.UnhealthyNodeConditions, diff --git a/internal/webhooks/cluster.go b/internal/webhooks/cluster.go index 1b51a472613e..ed886d47dedc 100644 --- a/internal/webhooks/cluster.go +++ b/internal/webhooks/cluster.go @@ -640,7 +640,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust fldPath := field.NewPath("spec", "topology", "controlPlane", "machineHealthCheck") // Validate ControlPlane MachineHealthCheck if defined. - if !cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { + if !cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { // Ensure ControlPlane does not define a MachineHealthCheck if the ClusterClass does not define MachineInfrastructure. if clusterClass.Spec.ControlPlane.MachineInfrastructure == nil { allErrs = append(allErrs, field.Forbidden( @@ -659,7 +659,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust // Check if the machineHealthCheck is explicitly enabled in the ControlPlaneTopology. if cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the ControlPlaneTopology of the Cluster or the ControlPlaneClass of the ClusterClass. - if cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() && clusterClass.Spec.ControlPlane.HealthCheck == nil { + if cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() && clusterClass.Spec.ControlPlane.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled), @@ -674,7 +674,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust fldPath := field.NewPath("spec", "topology", "workers", "machineDeployments").Key(md.Name).Child("machineHealthCheck") // Validate the MachineDeployment MachineHealthCheck if defined. - if !md.HealthCheck.IsHealthCheckConfigZero() { + if !md.HealthCheck.IsDefined() { allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, md.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, md.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) } @@ -687,7 +687,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust // Check if the machineHealthCheck is explicitly enabled in the machineDeploymentTopology. if md.HealthCheck.Enabled != nil && *md.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the MachineDeploymentTopology of the Cluster or the MachineDeploymentClass of the ClusterClass. - if md.HealthCheck.IsHealthCheckConfigZero() && mdClass.HealthCheck == nil { + if md.HealthCheck.IsDefined() && mdClass.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *md.HealthCheck.Enabled), diff --git a/internal/webhooks/clusterclass.go b/internal/webhooks/clusterclass.go index 042fc0beb03a..8470ebacf384 100644 --- a/internal/webhooks/clusterclass.go +++ b/internal/webhooks/clusterclass.go @@ -194,7 +194,7 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol if cluster.Spec.Topology.ControlPlane.HealthCheck != nil && cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled && - cluster.Spec.Topology.ControlPlane.HealthCheck.IsHealthCheckConfigZero() { + cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) } } @@ -222,7 +222,7 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol if mdTopology.HealthCheck != nil && mdTopology.HealthCheck.Enabled != nil && *mdTopology.HealthCheck.Enabled && - mdTopology.HealthCheck.IsHealthCheckConfigZero() { + mdTopology.HealthCheck.IsDefined() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) break } From 6090a63c0885b2e5105917504d90c1a390d0e90e Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Fri, 18 Jul 2025 18:00:50 +0200 Subject: [PATCH 3/7] Fix review findings --- api/core/v1beta2/cluster_types.go | 4 ++-- exp/topology/scope/blueprint.go | 8 ++++---- internal/webhooks/cluster.go | 8 ++++---- internal/webhooks/clusterclass.go | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index ebd9c62f78dd..0a181d1ee169 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -667,7 +667,7 @@ type ControlPlaneTopologyMachineHealthCheck struct { // IsDefined returns true if both checks and remediation are zero. func (m *ControlPlaneTopologyMachineHealthCheck) IsDefined() bool { - return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() + return !reflect.ValueOf(m.Checks).IsZero() || !reflect.ValueOf(m.Remediation).IsZero() } // ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. @@ -892,7 +892,7 @@ type MachineDeploymentTopologyMachineHealthCheck struct { // IsDefined returns true if both checks and remediation are zero. func (m *MachineDeploymentTopologyMachineHealthCheck) IsDefined() bool { - return reflect.ValueOf(m.Checks).IsZero() && reflect.ValueOf(m.Remediation).IsZero() + return !reflect.ValueOf(m.Checks).IsZero() || !reflect.ValueOf(m.Remediation).IsZero() } // MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. diff --git a/exp/topology/scope/blueprint.go b/exp/topology/scope/blueprint.go index f8fd6b52933d..aec6fe39aaa8 100644 --- a/exp/topology/scope/blueprint.go +++ b/exp/topology/scope/blueprint.go @@ -104,7 +104,7 @@ func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool { } // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. if b.ClusterClass.Spec.ControlPlane.HealthCheck == nil && - (b.Topology.ControlPlane.HealthCheck == nil || b.Topology.ControlPlane.HealthCheck.IsDefined()) { + (b.Topology.ControlPlane.HealthCheck == nil || !b.Topology.ControlPlane.HealthCheck.IsDefined()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. @@ -121,7 +121,7 @@ func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() (clusterv1.Mach return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - if b.Topology.ControlPlane.HealthCheck != nil && !b.Topology.ControlPlane.HealthCheck.IsDefined() { + if b.Topology.ControlPlane.HealthCheck != nil && b.Topology.ControlPlane.HealthCheck.IsDefined() { return clusterv1.MachineHealthCheckChecks{ NodeStartupTimeoutSeconds: b.Topology.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds, UnhealthyNodeConditions: b.Topology.ControlPlane.HealthCheck.Checks.UnhealthyNodeConditions, @@ -155,7 +155,7 @@ func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool { // Returns false otherwise. func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool { // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. - if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || md.HealthCheck.IsDefined()) { + if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || !md.HealthCheck.IsDefined()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. @@ -172,7 +172,7 @@ func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } - if md.HealthCheck != nil && !md.HealthCheck.IsDefined() { + if md.HealthCheck != nil && md.HealthCheck.IsDefined() { return clusterv1.MachineHealthCheckChecks{ NodeStartupTimeoutSeconds: md.HealthCheck.Checks.NodeStartupTimeoutSeconds, UnhealthyNodeConditions: md.HealthCheck.Checks.UnhealthyNodeConditions, diff --git a/internal/webhooks/cluster.go b/internal/webhooks/cluster.go index ed886d47dedc..899a86eb2ef1 100644 --- a/internal/webhooks/cluster.go +++ b/internal/webhooks/cluster.go @@ -640,7 +640,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust fldPath := field.NewPath("spec", "topology", "controlPlane", "machineHealthCheck") // Validate ControlPlane MachineHealthCheck if defined. - if !cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { + if cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { // Ensure ControlPlane does not define a MachineHealthCheck if the ClusterClass does not define MachineInfrastructure. if clusterClass.Spec.ControlPlane.MachineInfrastructure == nil { allErrs = append(allErrs, field.Forbidden( @@ -659,7 +659,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust // Check if the machineHealthCheck is explicitly enabled in the ControlPlaneTopology. if cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the ControlPlaneTopology of the Cluster or the ControlPlaneClass of the ClusterClass. - if cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() && clusterClass.Spec.ControlPlane.HealthCheck == nil { + if !cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() && clusterClass.Spec.ControlPlane.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled), @@ -674,7 +674,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust fldPath := field.NewPath("spec", "topology", "workers", "machineDeployments").Key(md.Name).Child("machineHealthCheck") // Validate the MachineDeployment MachineHealthCheck if defined. - if !md.HealthCheck.IsDefined() { + if md.HealthCheck.IsDefined() { allErrs = append(allErrs, validateMachineHealthCheckNodeStartupTimeoutSeconds(fldPath, md.HealthCheck.Checks.NodeStartupTimeoutSeconds)...) allErrs = append(allErrs, validateMachineHealthCheckUnhealthyLessThanOrEqualTo(fldPath, md.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo)...) } @@ -687,7 +687,7 @@ func validateMachineHealthChecks(cluster *clusterv1.Cluster, clusterClass *clust // Check if the machineHealthCheck is explicitly enabled in the machineDeploymentTopology. if md.HealthCheck.Enabled != nil && *md.HealthCheck.Enabled { // Ensure the MHC is defined in at least one of the MachineDeploymentTopology of the Cluster or the MachineDeploymentClass of the ClusterClass. - if md.HealthCheck.IsDefined() && mdClass.HealthCheck == nil { + if !md.HealthCheck.IsDefined() && mdClass.HealthCheck == nil { allErrs = append(allErrs, field.Forbidden( fldPath.Child("enable"), fmt.Sprintf("cannot be set to %t as MachineHealthCheck definition is not available in the Cluster topology or the ClusterClass", *md.HealthCheck.Enabled), diff --git a/internal/webhooks/clusterclass.go b/internal/webhooks/clusterclass.go index 8470ebacf384..68754623a0a2 100644 --- a/internal/webhooks/clusterclass.go +++ b/internal/webhooks/clusterclass.go @@ -194,7 +194,7 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol if cluster.Spec.Topology.ControlPlane.HealthCheck != nil && cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled != nil && *cluster.Spec.Topology.ControlPlane.HealthCheck.Enabled && - cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { + !cluster.Spec.Topology.ControlPlane.HealthCheck.IsDefined() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) } } @@ -222,7 +222,7 @@ func validateUpdatesToMachineHealthCheckClasses(clusters []clusterv1.Cluster, ol if mdTopology.HealthCheck != nil && mdTopology.HealthCheck.Enabled != nil && *mdTopology.HealthCheck.Enabled && - mdTopology.HealthCheck.IsDefined() { + !mdTopology.HealthCheck.IsDefined() { clustersUsingMHC = append(clustersUsingMHC, cluster.Name) break } From 23818a880b2773b3067f40f67e2c4298a41ca626 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 21 Jul 2025 13:28:04 +0200 Subject: [PATCH 4/7] Remove Machine from Cluster & ClusterClass health check structs --- api/core/v1beta1/conversion.go | 8 +- api/core/v1beta2/cluster_types.go | 52 +- api/core/v1beta2/clusterclass_types.go | 48 +- api/core/v1beta2/zz_generated.deepcopy.go | 394 +++++----- api/core/v1beta2/zz_generated.openapi.go | 720 +++++++++--------- .../desiredstate/desired_state_test.go | 12 +- exp/topology/scope/blueprint.go | 34 +- exp/topology/scope/blueprint_test.go | 80 +- .../controllers/topology/cluster/blueprint.go | 4 +- .../topology/cluster/blueprint_test.go | 12 +- .../topology/cluster/reconcile_state_test.go | 12 +- internal/webhooks/cluster_test.go | 40 +- internal/webhooks/clusterclass_test.go | 50 +- .../handler_integration_test.go | 4 +- util/test/builder/builders.go | 20 +- util/test/builder/zz_generated.deepcopy.go | 8 +- 16 files changed, 749 insertions(+), 749 deletions(-) diff --git a/api/core/v1beta1/conversion.go b/api/core/v1beta1/conversion.go index 112ea479fab9..3c06a0722808 100644 --- a/api/core/v1beta1/conversion.go +++ b/api/core/v1beta1/conversion.go @@ -680,7 +680,7 @@ func Convert_v1beta1_ControlPlaneClass_To_v1beta2_ControlPlaneClass(in *ControlP convert_v1beta1_LocalObjectTemplate_To_v1beta2_ClusterClassTemplateReference(&in.LocalObjectTemplate, &out.TemplateRef, s) if in.MachineHealthCheck != nil { - out.HealthCheck = &clusterv1.ControlPlaneClassMachineHealthCheck{} + out.HealthCheck = &clusterv1.ControlPlaneClassHealthCheck{} for _, c := range in.MachineHealthCheck.UnhealthyConditions { out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ Type: c.Type, @@ -748,7 +748,7 @@ func Convert_v1beta1_ControlPlaneTopology_To_v1beta2_ControlPlaneTopology(in *Co out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) if in.MachineHealthCheck != nil { - out.HealthCheck = &clusterv1.ControlPlaneTopologyMachineHealthCheck{} + out.HealthCheck = &clusterv1.ControlPlaneTopologyHealthCheck{} out.HealthCheck.Enabled = in.MachineHealthCheck.Enable for _, c := range in.MachineHealthCheck.UnhealthyConditions { out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ @@ -832,7 +832,7 @@ func Convert_v1beta1_MachineDeploymentClass_To_v1beta2_MachineDeploymentClass(in out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) if in.MachineHealthCheck != nil { - out.HealthCheck = &clusterv1.MachineDeploymentClassMachineHealthCheck{} + out.HealthCheck = &clusterv1.MachineDeploymentClassHealthCheck{} for _, c := range in.MachineHealthCheck.UnhealthyConditions { out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ Type: c.Type, @@ -919,7 +919,7 @@ func Convert_v1beta1_MachineDeploymentTopology_To_v1beta2_MachineDeploymentTopol out.Deletion.NodeDeletionTimeoutSeconds = clusterv1.ConvertToSeconds(in.NodeDeletionTimeout) if in.MachineHealthCheck != nil { - out.HealthCheck = &clusterv1.MachineDeploymentTopologyMachineHealthCheck{} + out.HealthCheck = &clusterv1.MachineDeploymentTopologyHealthCheck{} out.HealthCheck.Enabled = in.MachineHealthCheck.Enable for _, c := range in.MachineHealthCheck.UnhealthyConditions { out.HealthCheck.Checks.UnhealthyNodeConditions = append(out.HealthCheck.Checks.UnhealthyNodeConditions, clusterv1.UnhealthyNodeCondition{ diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index 0a181d1ee169..fe3dddc56190 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -614,7 +614,7 @@ type ControlPlaneTopology struct { // healthCheck allows to enable, disable and override control plane health check // configuration from the ClusterClass for this control plane. // +optional - HealthCheck *ControlPlaneTopologyMachineHealthCheck `json:"healthCheck,omitempty"` + HealthCheck *ControlPlaneTopologyHealthCheck `json:"healthCheck,omitempty"` // deletion contains configuration options for Machine deletion. // +optional @@ -641,9 +641,9 @@ type ControlPlaneTopology struct { Variables ControlPlaneVariables `json:"variables,omitempty,omitzero"` } -// ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for control plane machines. +// ControlPlaneTopologyHealthCheck defines a MachineHealthCheck for control plane machines. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneTopologyMachineHealthCheck struct { +type ControlPlaneTopologyHealthCheck struct { // enabled controls if a MachineHealthCheck should be created for the target machines. // // If false: No MachineHealthCheck will be created. @@ -658,21 +658,21 @@ type ControlPlaneTopologyMachineHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. // +optional - Checks ControlPlaneTopologyMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + Checks ControlPlaneTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. // +optional - Remediation ControlPlaneTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` + Remediation ControlPlaneTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } // IsDefined returns true if both checks and remediation are zero. -func (m *ControlPlaneTopologyMachineHealthCheck) IsDefined() bool { +func (m *ControlPlaneTopologyHealthCheck) IsDefined() bool { return !reflect.ValueOf(m.Checks).IsZero() || !reflect.ValueOf(m.Remediation).IsZero() } -// ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. +// ControlPlaneTopologyHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneTopologyMachineHealthCheckChecks struct { +type ControlPlaneTopologyHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck // to consider a Machine unhealthy if a corresponding Node isn't associated // through a `Spec.ProviderID` field. @@ -700,13 +700,13 @@ type ControlPlaneTopologyMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. +// ControlPlaneTopologyHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneTopologyMachineHealthCheckRemediation struct { +type ControlPlaneTopologyHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. // If this field is not set, remediations are always triggered. // +optional - TriggerIf ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + TriggerIf ControlPlaneTopologyHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` // templateRef is a reference to a remediation template // provided by an infrastructure provider. @@ -718,9 +718,9 @@ type ControlPlaneTopologyMachineHealthCheckRemediation struct { TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` } -// ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// ControlPlaneTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf struct { +type ControlPlaneTopologyHealthCheckRemediationTriggerIf struct { // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of // unhealthy Machines is less than or equal to the configured value. // unhealthyInRange takes precedence if set. @@ -828,7 +828,7 @@ type MachineDeploymentTopology struct { // healthCheck allows to enable, disable and override MachineDeployment health check // configuration from the ClusterClass for this MachineDeployment. // +optional - HealthCheck *MachineDeploymentTopologyMachineHealthCheck `json:"healthCheck,omitempty"` + HealthCheck *MachineDeploymentTopologyHealthCheck `json:"healthCheck,omitempty"` // deletion contains configuration options for Machine deletion. // +optional @@ -866,9 +866,9 @@ type MachineDeploymentTopology struct { Variables MachineDeploymentVariables `json:"variables,omitempty,omitzero"` } -// MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines. +// MachineDeploymentTopologyHealthCheck defines a MachineHealthCheck for MachineDeployment machines. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentTopologyMachineHealthCheck struct { +type MachineDeploymentTopologyHealthCheck struct { // enabled controls if a MachineHealthCheck should be created for the target machines. // // If false: No MachineHealthCheck will be created. @@ -883,21 +883,21 @@ type MachineDeploymentTopologyMachineHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. // +optional - Checks MachineDeploymentTopologyMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + Checks MachineDeploymentTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. // +optional - Remediation MachineDeploymentTopologyMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` + Remediation MachineDeploymentTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } // IsDefined returns true if both checks and remediation are zero. -func (m *MachineDeploymentTopologyMachineHealthCheck) IsDefined() bool { +func (m *MachineDeploymentTopologyHealthCheck) IsDefined() bool { return !reflect.ValueOf(m.Checks).IsZero() || !reflect.ValueOf(m.Remediation).IsZero() } -// MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. +// MachineDeploymentTopologyHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentTopologyMachineHealthCheckChecks struct { +type MachineDeploymentTopologyHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck // to consider a Machine unhealthy if a corresponding Node isn't associated // through a `Spec.ProviderID` field. @@ -925,13 +925,13 @@ type MachineDeploymentTopologyMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. +// MachineDeploymentTopologyHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentTopologyMachineHealthCheckRemediation struct { +type MachineDeploymentTopologyHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. // If this field is not set, remediations are always triggered. // +optional - TriggerIf MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + TriggerIf MachineDeploymentTopologyHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` // templateRef is a reference to a remediation template // provided by an infrastructure provider. @@ -943,9 +943,9 @@ type MachineDeploymentTopologyMachineHealthCheckRemediation struct { TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` } -// MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// MachineDeploymentTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf struct { +type MachineDeploymentTopologyHealthCheckRemediationTriggerIf struct { // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of // unhealthy Machines is less than or equal to the configured value. // unhealthyInRange takes precedence if set. diff --git a/api/core/v1beta2/clusterclass_types.go b/api/core/v1beta2/clusterclass_types.go index 166314ae71f7..b96b41aafe12 100644 --- a/api/core/v1beta2/clusterclass_types.go +++ b/api/core/v1beta2/clusterclass_types.go @@ -171,7 +171,7 @@ type ControlPlaneClass struct { // This field is supported if and only if the ControlPlane provider template // referenced above is Machine based and supports setting replicas. // +optional - HealthCheck *ControlPlaneClassMachineHealthCheck `json:"healthCheck,omitempty"` + HealthCheck *ControlPlaneClassHealthCheck `json:"healthCheck,omitempty"` // namingStrategy allows changing the naming pattern used when creating the control plane provider object. // +optional @@ -198,21 +198,21 @@ type ControlPlaneClass struct { ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"` } -// ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for control plane machines. +// ControlPlaneClassHealthCheck defines a MachineHealthCheck for control plane machines. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneClassMachineHealthCheck struct { +type ControlPlaneClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. // +optional - Checks ControlPlaneClassMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + Checks ControlPlaneClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. // +optional - Remediation ControlPlaneClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` + Remediation ControlPlaneClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. +// ControlPlaneClassHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneClassMachineHealthCheckChecks struct { +type ControlPlaneClassHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck // to consider a Machine unhealthy if a corresponding Node isn't associated // through a `Spec.ProviderID` field. @@ -240,13 +240,13 @@ type ControlPlaneClassMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. +// ControlPlaneClassHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneClassMachineHealthCheckRemediation struct { +type ControlPlaneClassHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. // If this field is not set, remediations are always triggered. // +optional - TriggerIf ControlPlaneClassMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + TriggerIf ControlPlaneClassHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` // templateRef is a reference to a remediation template // provided by an infrastructure provider. @@ -258,9 +258,9 @@ type ControlPlaneClassMachineHealthCheckRemediation struct { TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` } -// ControlPlaneClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// ControlPlaneClassHealthCheckRemediationTriggerIf configures if remediations are triggered. // +kubebuilder:validation:MinProperties=1 -type ControlPlaneClassMachineHealthCheckRemediationTriggerIf struct { +type ControlPlaneClassHealthCheckRemediationTriggerIf struct { // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of // unhealthy Machines is less than or equal to the configured value. // unhealthyInRange takes precedence if set. @@ -387,7 +387,7 @@ type MachineDeploymentClass struct { // healthCheck defines a MachineHealthCheck for this MachineDeploymentClass. // +optional - HealthCheck *MachineDeploymentClassMachineHealthCheck `json:"healthCheck,omitempty"` + HealthCheck *MachineDeploymentClassHealthCheck `json:"healthCheck,omitempty"` // failureDomain is the failure domain the machines will be created in. // Must match the name of a FailureDomain from the Cluster status. @@ -435,21 +435,21 @@ type MachineDeploymentClass struct { Strategy MachineDeploymentStrategy `json:"strategy,omitempty,omitzero"` } -// MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines. +// MachineDeploymentClassHealthCheck defines a MachineHealthCheck for MachineDeployment machines. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentClassMachineHealthCheck struct { +type MachineDeploymentClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. // +optional - Checks MachineDeploymentClassMachineHealthCheckChecks `json:"checks,omitempty,omitzero"` + Checks MachineDeploymentClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. // +optional - Remediation MachineDeploymentClassMachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` + Remediation MachineDeploymentClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } -// MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. +// MachineDeploymentClassHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentClassMachineHealthCheckChecks struct { +type MachineDeploymentClassHealthCheckChecks struct { // nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck // to consider a Machine unhealthy if a corresponding Node isn't associated // through a `Spec.ProviderID` field. @@ -477,13 +477,13 @@ type MachineDeploymentClassMachineHealthCheckChecks struct { UnhealthyNodeConditions []UnhealthyNodeCondition `json:"unhealthyNodeConditions,omitempty"` } -// MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. +// MachineDeploymentClassHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentClassMachineHealthCheckRemediation struct { +type MachineDeploymentClassHealthCheckRemediation struct { // triggerIf configures if remediations are triggered. // If this field is not set, remediations are always triggered. // +optional - TriggerIf MachineDeploymentClassMachineHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` + TriggerIf MachineDeploymentClassHealthCheckRemediationTriggerIf `json:"triggerIf,omitempty,omitzero"` // templateRef is a reference to a remediation template // provided by an infrastructure provider. @@ -495,9 +495,9 @@ type MachineDeploymentClassMachineHealthCheckRemediation struct { TemplateRef *MachineHealthCheckRemediationTemplateReference `json:"templateRef,omitempty"` } -// MachineDeploymentClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered. +// MachineDeploymentClassHealthCheckRemediationTriggerIf configures if remediations are triggered. // +kubebuilder:validation:MinProperties=1 -type MachineDeploymentClassMachineHealthCheckRemediationTriggerIf struct { +type MachineDeploymentClassHealthCheckRemediationTriggerIf struct { // unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of // unhealthy Machines is less than or equal to the configured value. // unhealthyInRange takes precedence if set. diff --git a/api/core/v1beta2/zz_generated.deepcopy.go b/api/core/v1beta2/zz_generated.deepcopy.go index 22dab2bbe36d..bedf1cfdf308 100644 --- a/api/core/v1beta2/zz_generated.deepcopy.go +++ b/api/core/v1beta2/zz_generated.deepcopy.go @@ -763,7 +763,7 @@ func (in *ControlPlaneClass) DeepCopyInto(out *ControlPlaneClass) { } if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck - *out = new(ControlPlaneClassMachineHealthCheck) + *out = new(ControlPlaneClassHealthCheck) (*in).DeepCopyInto(*out) } if in.NamingStrategy != nil { @@ -790,54 +790,24 @@ func (in *ControlPlaneClass) DeepCopy() *ControlPlaneClass { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneClassMachineDeletionSpec) DeepCopyInto(out *ControlPlaneClassMachineDeletionSpec) { - *out = *in - if in.NodeDrainTimeoutSeconds != nil { - in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeVolumeDetachTimeoutSeconds != nil { - in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeDeletionTimeoutSeconds != nil { - in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineDeletionSpec. -func (in *ControlPlaneClassMachineDeletionSpec) DeepCopy() *ControlPlaneClassMachineDeletionSpec { - if in == nil { - return nil - } - out := new(ControlPlaneClassMachineDeletionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneClassMachineHealthCheck) DeepCopyInto(out *ControlPlaneClassMachineHealthCheck) { +func (in *ControlPlaneClassHealthCheck) DeepCopyInto(out *ControlPlaneClassHealthCheck) { *out = *in in.Checks.DeepCopyInto(&out.Checks) in.Remediation.DeepCopyInto(&out.Remediation) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheck. -func (in *ControlPlaneClassMachineHealthCheck) DeepCopy() *ControlPlaneClassMachineHealthCheck { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassHealthCheck. +func (in *ControlPlaneClassHealthCheck) DeepCopy() *ControlPlaneClassHealthCheck { if in == nil { return nil } - out := new(ControlPlaneClassMachineHealthCheck) + out := new(ControlPlaneClassHealthCheck) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneClassMachineHealthCheckChecks) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckChecks) { +func (in *ControlPlaneClassHealthCheckChecks) DeepCopyInto(out *ControlPlaneClassHealthCheckChecks) { *out = *in if in.NodeStartupTimeoutSeconds != nil { in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds @@ -851,18 +821,18 @@ func (in *ControlPlaneClassMachineHealthCheckChecks) DeepCopyInto(out *ControlPl } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckChecks. -func (in *ControlPlaneClassMachineHealthCheckChecks) DeepCopy() *ControlPlaneClassMachineHealthCheckChecks { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassHealthCheckChecks. +func (in *ControlPlaneClassHealthCheckChecks) DeepCopy() *ControlPlaneClassHealthCheckChecks { if in == nil { return nil } - out := new(ControlPlaneClassMachineHealthCheckChecks) + out := new(ControlPlaneClassHealthCheckChecks) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneClassMachineHealthCheckRemediation) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckRemediation) { +func (in *ControlPlaneClassHealthCheckRemediation) DeepCopyInto(out *ControlPlaneClassHealthCheckRemediation) { *out = *in in.TriggerIf.DeepCopyInto(&out.TriggerIf) if in.TemplateRef != nil { @@ -872,18 +842,18 @@ func (in *ControlPlaneClassMachineHealthCheckRemediation) DeepCopyInto(out *Cont } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckRemediation. -func (in *ControlPlaneClassMachineHealthCheckRemediation) DeepCopy() *ControlPlaneClassMachineHealthCheckRemediation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassHealthCheckRemediation. +func (in *ControlPlaneClassHealthCheckRemediation) DeepCopy() *ControlPlaneClassHealthCheckRemediation { if in == nil { return nil } - out := new(ControlPlaneClassMachineHealthCheckRemediation) + out := new(ControlPlaneClassHealthCheckRemediation) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) { +func (in *ControlPlaneClassHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneClassHealthCheckRemediationTriggerIf) { *out = *in if in.UnhealthyLessThanOrEqualTo != nil { in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo @@ -892,12 +862,42 @@ func (in *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) DeepCopyInto( } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineHealthCheckRemediationTriggerIf. -func (in *ControlPlaneClassMachineHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneClassMachineHealthCheckRemediationTriggerIf { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassHealthCheckRemediationTriggerIf. +func (in *ControlPlaneClassHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneClassHealthCheckRemediationTriggerIf { if in == nil { return nil } - out := new(ControlPlaneClassMachineHealthCheckRemediationTriggerIf) + out := new(ControlPlaneClassHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneClassMachineDeletionSpec) DeepCopyInto(out *ControlPlaneClassMachineDeletionSpec) { + *out = *in + if in.NodeDrainTimeoutSeconds != nil { + in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeVolumeDetachTimeoutSeconds != nil { + in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeDeletionTimeoutSeconds != nil { + in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneClassMachineDeletionSpec. +func (in *ControlPlaneClassMachineDeletionSpec) DeepCopy() *ControlPlaneClassMachineDeletionSpec { + if in == nil { + return nil + } + out := new(ControlPlaneClassMachineDeletionSpec) in.DeepCopyInto(out) return out } @@ -944,7 +944,7 @@ func (in *ControlPlaneTopology) DeepCopyInto(out *ControlPlaneTopology) { } if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck - *out = new(ControlPlaneTopologyMachineHealthCheck) + *out = new(ControlPlaneTopologyHealthCheck) (*in).DeepCopyInto(*out) } in.Deletion.DeepCopyInto(&out.Deletion) @@ -967,37 +967,7 @@ func (in *ControlPlaneTopology) DeepCopy() *ControlPlaneTopology { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneTopologyMachineDeletionSpec) DeepCopyInto(out *ControlPlaneTopologyMachineDeletionSpec) { - *out = *in - if in.NodeDrainTimeoutSeconds != nil { - in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeVolumeDetachTimeoutSeconds != nil { - in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeDeletionTimeoutSeconds != nil { - in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineDeletionSpec. -func (in *ControlPlaneTopologyMachineDeletionSpec) DeepCopy() *ControlPlaneTopologyMachineDeletionSpec { - if in == nil { - return nil - } - out := new(ControlPlaneTopologyMachineDeletionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneTopologyMachineHealthCheck) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheck) { +func (in *ControlPlaneTopologyHealthCheck) DeepCopyInto(out *ControlPlaneTopologyHealthCheck) { *out = *in if in.Enabled != nil { in, out := &in.Enabled, &out.Enabled @@ -1008,18 +978,18 @@ func (in *ControlPlaneTopologyMachineHealthCheck) DeepCopyInto(out *ControlPlane in.Remediation.DeepCopyInto(&out.Remediation) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheck. -func (in *ControlPlaneTopologyMachineHealthCheck) DeepCopy() *ControlPlaneTopologyMachineHealthCheck { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyHealthCheck. +func (in *ControlPlaneTopologyHealthCheck) DeepCopy() *ControlPlaneTopologyHealthCheck { if in == nil { return nil } - out := new(ControlPlaneTopologyMachineHealthCheck) + out := new(ControlPlaneTopologyHealthCheck) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneTopologyMachineHealthCheckChecks) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckChecks) { +func (in *ControlPlaneTopologyHealthCheckChecks) DeepCopyInto(out *ControlPlaneTopologyHealthCheckChecks) { *out = *in if in.NodeStartupTimeoutSeconds != nil { in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds @@ -1033,18 +1003,18 @@ func (in *ControlPlaneTopologyMachineHealthCheckChecks) DeepCopyInto(out *Contro } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckChecks. -func (in *ControlPlaneTopologyMachineHealthCheckChecks) DeepCopy() *ControlPlaneTopologyMachineHealthCheckChecks { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyHealthCheckChecks. +func (in *ControlPlaneTopologyHealthCheckChecks) DeepCopy() *ControlPlaneTopologyHealthCheckChecks { if in == nil { return nil } - out := new(ControlPlaneTopologyMachineHealthCheckChecks) + out := new(ControlPlaneTopologyHealthCheckChecks) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneTopologyMachineHealthCheckRemediation) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckRemediation) { +func (in *ControlPlaneTopologyHealthCheckRemediation) DeepCopyInto(out *ControlPlaneTopologyHealthCheckRemediation) { *out = *in in.TriggerIf.DeepCopyInto(&out.TriggerIf) if in.TemplateRef != nil { @@ -1054,18 +1024,18 @@ func (in *ControlPlaneTopologyMachineHealthCheckRemediation) DeepCopyInto(out *C } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckRemediation. -func (in *ControlPlaneTopologyMachineHealthCheckRemediation) DeepCopy() *ControlPlaneTopologyMachineHealthCheckRemediation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyHealthCheckRemediation. +func (in *ControlPlaneTopologyHealthCheckRemediation) DeepCopy() *ControlPlaneTopologyHealthCheckRemediation { if in == nil { return nil } - out := new(ControlPlaneTopologyMachineHealthCheckRemediation) + out := new(ControlPlaneTopologyHealthCheckRemediation) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) { +func (in *ControlPlaneTopologyHealthCheckRemediationTriggerIf) DeepCopyInto(out *ControlPlaneTopologyHealthCheckRemediationTriggerIf) { *out = *in if in.UnhealthyLessThanOrEqualTo != nil { in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo @@ -1074,12 +1044,42 @@ func (in *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) DeepCopyIn } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf. -func (in *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyHealthCheckRemediationTriggerIf. +func (in *ControlPlaneTopologyHealthCheckRemediationTriggerIf) DeepCopy() *ControlPlaneTopologyHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(ControlPlaneTopologyHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControlPlaneTopologyMachineDeletionSpec) DeepCopyInto(out *ControlPlaneTopologyMachineDeletionSpec) { + *out = *in + if in.NodeDrainTimeoutSeconds != nil { + in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeVolumeDetachTimeoutSeconds != nil { + in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeDeletionTimeoutSeconds != nil { + in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlaneTopologyMachineDeletionSpec. +func (in *ControlPlaneTopologyMachineDeletionSpec) DeepCopy() *ControlPlaneTopologyMachineDeletionSpec { if in == nil { return nil } - out := new(ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf) + out := new(ControlPlaneTopologyMachineDeletionSpec) in.DeepCopyInto(out) return out } @@ -1535,7 +1535,7 @@ func (in *MachineDeploymentClass) DeepCopyInto(out *MachineDeploymentClass) { out.Infrastructure = in.Infrastructure if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck - *out = new(MachineDeploymentClassMachineHealthCheck) + *out = new(MachineDeploymentClassHealthCheck) (*in).DeepCopyInto(*out) } if in.NamingStrategy != nil { @@ -1584,130 +1584,130 @@ func (in *MachineDeploymentClassBootstrapTemplate) DeepCopy() *MachineDeployment } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassInfrastructureTemplate) DeepCopyInto(out *MachineDeploymentClassInfrastructureTemplate) { +func (in *MachineDeploymentClassHealthCheck) DeepCopyInto(out *MachineDeploymentClassHealthCheck) { *out = *in - out.TemplateRef = in.TemplateRef + in.Checks.DeepCopyInto(&out.Checks) + in.Remediation.DeepCopyInto(&out.Remediation) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassInfrastructureTemplate. -func (in *MachineDeploymentClassInfrastructureTemplate) DeepCopy() *MachineDeploymentClassInfrastructureTemplate { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassHealthCheck. +func (in *MachineDeploymentClassHealthCheck) DeepCopy() *MachineDeploymentClassHealthCheck { if in == nil { return nil } - out := new(MachineDeploymentClassInfrastructureTemplate) + out := new(MachineDeploymentClassHealthCheck) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassMachineDeletionSpec) DeepCopyInto(out *MachineDeploymentClassMachineDeletionSpec) { +func (in *MachineDeploymentClassHealthCheckChecks) DeepCopyInto(out *MachineDeploymentClassHealthCheckChecks) { *out = *in - if in.NodeDrainTimeoutSeconds != nil { - in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeVolumeDetachTimeoutSeconds != nil { - in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds + if in.NodeStartupTimeoutSeconds != nil { + in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds *out = new(int32) **out = **in } - if in.NodeDeletionTimeoutSeconds != nil { - in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds - *out = new(int32) - **out = **in + if in.UnhealthyNodeConditions != nil { + in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions + *out = make([]UnhealthyNodeCondition, len(*in)) + copy(*out, *in) } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineDeletionSpec. -func (in *MachineDeploymentClassMachineDeletionSpec) DeepCopy() *MachineDeploymentClassMachineDeletionSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassHealthCheckChecks. +func (in *MachineDeploymentClassHealthCheckChecks) DeepCopy() *MachineDeploymentClassHealthCheckChecks { if in == nil { return nil } - out := new(MachineDeploymentClassMachineDeletionSpec) + out := new(MachineDeploymentClassHealthCheckChecks) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassMachineHealthCheck) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheck) { +func (in *MachineDeploymentClassHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentClassHealthCheckRemediation) { *out = *in - in.Checks.DeepCopyInto(&out.Checks) - in.Remediation.DeepCopyInto(&out.Remediation) + in.TriggerIf.DeepCopyInto(&out.TriggerIf) + if in.TemplateRef != nil { + in, out := &in.TemplateRef, &out.TemplateRef + *out = new(MachineHealthCheckRemediationTemplateReference) + **out = **in + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheck. -func (in *MachineDeploymentClassMachineHealthCheck) DeepCopy() *MachineDeploymentClassMachineHealthCheck { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassHealthCheckRemediation. +func (in *MachineDeploymentClassHealthCheckRemediation) DeepCopy() *MachineDeploymentClassHealthCheckRemediation { if in == nil { return nil } - out := new(MachineDeploymentClassMachineHealthCheck) + out := new(MachineDeploymentClassHealthCheckRemediation) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassMachineHealthCheckChecks) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckChecks) { +func (in *MachineDeploymentClassHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentClassHealthCheckRemediationTriggerIf) { *out = *in - if in.NodeStartupTimeoutSeconds != nil { - in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds - *out = new(int32) + if in.UnhealthyLessThanOrEqualTo != nil { + in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo + *out = new(intstr.IntOrString) **out = **in } - if in.UnhealthyNodeConditions != nil { - in, out := &in.UnhealthyNodeConditions, &out.UnhealthyNodeConditions - *out = make([]UnhealthyNodeCondition, len(*in)) - copy(*out, *in) - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckChecks. -func (in *MachineDeploymentClassMachineHealthCheckChecks) DeepCopy() *MachineDeploymentClassMachineHealthCheckChecks { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassHealthCheckRemediationTriggerIf. +func (in *MachineDeploymentClassHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentClassHealthCheckRemediationTriggerIf { if in == nil { return nil } - out := new(MachineDeploymentClassMachineHealthCheckChecks) + out := new(MachineDeploymentClassHealthCheckRemediationTriggerIf) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassMachineHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckRemediation) { +func (in *MachineDeploymentClassInfrastructureTemplate) DeepCopyInto(out *MachineDeploymentClassInfrastructureTemplate) { *out = *in - in.TriggerIf.DeepCopyInto(&out.TriggerIf) - if in.TemplateRef != nil { - in, out := &in.TemplateRef, &out.TemplateRef - *out = new(MachineHealthCheckRemediationTemplateReference) - **out = **in - } + out.TemplateRef = in.TemplateRef } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckRemediation. -func (in *MachineDeploymentClassMachineHealthCheckRemediation) DeepCopy() *MachineDeploymentClassMachineHealthCheckRemediation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassInfrastructureTemplate. +func (in *MachineDeploymentClassInfrastructureTemplate) DeepCopy() *MachineDeploymentClassInfrastructureTemplate { if in == nil { return nil } - out := new(MachineDeploymentClassMachineHealthCheckRemediation) + out := new(MachineDeploymentClassInfrastructureTemplate) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) { +func (in *MachineDeploymentClassMachineDeletionSpec) DeepCopyInto(out *MachineDeploymentClassMachineDeletionSpec) { *out = *in - if in.UnhealthyLessThanOrEqualTo != nil { - in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo - *out = new(intstr.IntOrString) + if in.NodeDrainTimeoutSeconds != nil { + in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeVolumeDetachTimeoutSeconds != nil { + in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeDeletionTimeoutSeconds != nil { + in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds + *out = new(int32) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineHealthCheckRemediationTriggerIf. -func (in *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentClassMachineHealthCheckRemediationTriggerIf { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentClassMachineDeletionSpec. +func (in *MachineDeploymentClassMachineDeletionSpec) DeepCopy() *MachineDeploymentClassMachineDeletionSpec { if in == nil { return nil } - out := new(MachineDeploymentClassMachineHealthCheckRemediationTriggerIf) + out := new(MachineDeploymentClassMachineDeletionSpec) in.DeepCopyInto(out) return out } @@ -1916,7 +1916,7 @@ func (in *MachineDeploymentTopology) DeepCopyInto(out *MachineDeploymentTopology } if in.HealthCheck != nil { in, out := &in.HealthCheck, &out.HealthCheck - *out = new(MachineDeploymentTopologyMachineHealthCheck) + *out = new(MachineDeploymentTopologyHealthCheck) (*in).DeepCopyInto(*out) } in.Deletion.DeepCopyInto(&out.Deletion) @@ -1945,37 +1945,7 @@ func (in *MachineDeploymentTopology) DeepCopy() *MachineDeploymentTopology { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentTopologyMachineDeletionSpec) DeepCopyInto(out *MachineDeploymentTopologyMachineDeletionSpec) { - *out = *in - if in.NodeDrainTimeoutSeconds != nil { - in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeVolumeDetachTimeoutSeconds != nil { - in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds - *out = new(int32) - **out = **in - } - if in.NodeDeletionTimeoutSeconds != nil { - in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineDeletionSpec. -func (in *MachineDeploymentTopologyMachineDeletionSpec) DeepCopy() *MachineDeploymentTopologyMachineDeletionSpec { - if in == nil { - return nil - } - out := new(MachineDeploymentTopologyMachineDeletionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentTopologyMachineHealthCheck) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheck) { +func (in *MachineDeploymentTopologyHealthCheck) DeepCopyInto(out *MachineDeploymentTopologyHealthCheck) { *out = *in if in.Enabled != nil { in, out := &in.Enabled, &out.Enabled @@ -1986,18 +1956,18 @@ func (in *MachineDeploymentTopologyMachineHealthCheck) DeepCopyInto(out *Machine in.Remediation.DeepCopyInto(&out.Remediation) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheck. -func (in *MachineDeploymentTopologyMachineHealthCheck) DeepCopy() *MachineDeploymentTopologyMachineHealthCheck { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyHealthCheck. +func (in *MachineDeploymentTopologyHealthCheck) DeepCopy() *MachineDeploymentTopologyHealthCheck { if in == nil { return nil } - out := new(MachineDeploymentTopologyMachineHealthCheck) + out := new(MachineDeploymentTopologyHealthCheck) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentTopologyMachineHealthCheckChecks) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckChecks) { +func (in *MachineDeploymentTopologyHealthCheckChecks) DeepCopyInto(out *MachineDeploymentTopologyHealthCheckChecks) { *out = *in if in.NodeStartupTimeoutSeconds != nil { in, out := &in.NodeStartupTimeoutSeconds, &out.NodeStartupTimeoutSeconds @@ -2011,18 +1981,18 @@ func (in *MachineDeploymentTopologyMachineHealthCheckChecks) DeepCopyInto(out *M } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckChecks. -func (in *MachineDeploymentTopologyMachineHealthCheckChecks) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckChecks { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyHealthCheckChecks. +func (in *MachineDeploymentTopologyHealthCheckChecks) DeepCopy() *MachineDeploymentTopologyHealthCheckChecks { if in == nil { return nil } - out := new(MachineDeploymentTopologyMachineHealthCheckChecks) + out := new(MachineDeploymentTopologyHealthCheckChecks) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentTopologyMachineHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckRemediation) { +func (in *MachineDeploymentTopologyHealthCheckRemediation) DeepCopyInto(out *MachineDeploymentTopologyHealthCheckRemediation) { *out = *in in.TriggerIf.DeepCopyInto(&out.TriggerIf) if in.TemplateRef != nil { @@ -2032,18 +2002,18 @@ func (in *MachineDeploymentTopologyMachineHealthCheckRemediation) DeepCopyInto(o } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckRemediation. -func (in *MachineDeploymentTopologyMachineHealthCheckRemediation) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckRemediation { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyHealthCheckRemediation. +func (in *MachineDeploymentTopologyHealthCheckRemediation) DeepCopy() *MachineDeploymentTopologyHealthCheckRemediation { if in == nil { return nil } - out := new(MachineDeploymentTopologyMachineHealthCheckRemediation) + out := new(MachineDeploymentTopologyHealthCheckRemediation) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) { +func (in *MachineDeploymentTopologyHealthCheckRemediationTriggerIf) DeepCopyInto(out *MachineDeploymentTopologyHealthCheckRemediationTriggerIf) { *out = *in if in.UnhealthyLessThanOrEqualTo != nil { in, out := &in.UnhealthyLessThanOrEqualTo, &out.UnhealthyLessThanOrEqualTo @@ -2052,12 +2022,42 @@ func (in *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) DeepC } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf. -func (in *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyHealthCheckRemediationTriggerIf. +func (in *MachineDeploymentTopologyHealthCheckRemediationTriggerIf) DeepCopy() *MachineDeploymentTopologyHealthCheckRemediationTriggerIf { + if in == nil { + return nil + } + out := new(MachineDeploymentTopologyHealthCheckRemediationTriggerIf) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentTopologyMachineDeletionSpec) DeepCopyInto(out *MachineDeploymentTopologyMachineDeletionSpec) { + *out = *in + if in.NodeDrainTimeoutSeconds != nil { + in, out := &in.NodeDrainTimeoutSeconds, &out.NodeDrainTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeVolumeDetachTimeoutSeconds != nil { + in, out := &in.NodeVolumeDetachTimeoutSeconds, &out.NodeVolumeDetachTimeoutSeconds + *out = new(int32) + **out = **in + } + if in.NodeDeletionTimeoutSeconds != nil { + in, out := &in.NodeDeletionTimeoutSeconds, &out.NodeDeletionTimeoutSeconds + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentTopologyMachineDeletionSpec. +func (in *MachineDeploymentTopologyMachineDeletionSpec) DeepCopy() *MachineDeploymentTopologyMachineDeletionSpec { if in == nil { return nil } - out := new(MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf) + out := new(MachineDeploymentTopologyMachineDeletionSpec) in.DeepCopyInto(out) return out } diff --git a/api/core/v1beta2/zz_generated.openapi.go b/api/core/v1beta2/zz_generated.openapi.go index 8e08f2429d78..dd6cc023c3dc 100644 --- a/api/core/v1beta2/zz_generated.openapi.go +++ b/api/core/v1beta2/zz_generated.openapi.go @@ -28,147 +28,147 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.APIEndpoint": schema_cluster_api_api_core_v1beta2_APIEndpoint(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Bootstrap": schema_cluster_api_api_core_v1beta2_Bootstrap(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Cluster": schema_cluster_api_api_core_v1beta2_Cluster(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterAvailabilityGate": schema_cluster_api_api_core_v1beta2_ClusterAvailabilityGate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClass": schema_cluster_api_api_core_v1beta2_ClusterClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassList": schema_cluster_api_api_core_v1beta2_ClusterClassList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassPatch": schema_cluster_api_api_core_v1beta2_ClusterClassPatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassRef": schema_cluster_api_api_core_v1beta2_ClusterClassRef(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassSpec": schema_cluster_api_api_core_v1beta2_ClusterClassSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatus": schema_cluster_api_api_core_v1beta2_ClusterClassStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariable": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariableDefinition": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariableDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference": schema_cluster_api_api_core_v1beta2_ClusterClassTemplateReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariable": schema_cluster_api_api_core_v1beta2_ClusterClassVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariableMetadata": schema_cluster_api_api_core_v1beta2_ClusterClassVariableMetadata(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterControlPlaneStatus": schema_cluster_api_api_core_v1beta2_ClusterControlPlaneStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterInitializationStatus": schema_cluster_api_api_core_v1beta2_ClusterInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterList": schema_cluster_api_api_core_v1beta2_ClusterList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterNetwork": schema_cluster_api_api_core_v1beta2_ClusterNetwork(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterSpec": schema_cluster_api_api_core_v1beta2_ClusterSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterStatus": schema_cluster_api_api_core_v1beta2_ClusterStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterVariable": schema_cluster_api_api_core_v1beta2_ClusterVariable(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Condition": schema_cluster_api_api_core_v1beta2_Condition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ContractVersionedObjectReference": schema_cluster_api_api_core_v1beta2_ContractVersionedObjectReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClass": schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChecks(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediation(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediationTriggerIf(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy": schema_cluster_api_api_core_v1beta2_ControlPlaneClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopology": schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckChecks(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediation(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables": schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ExternalPatchDefinition": schema_cluster_api_api_core_v1beta2_ExternalPatchDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.FailureDomain": schema_cluster_api_api_core_v1beta2_FailureDomain(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClass": schema_cluster_api_api_core_v1beta2_InfrastructureClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClassNamingStrategy": schema_cluster_api_api_core_v1beta2_InfrastructureClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatch": schema_cluster_api_api_core_v1beta2_JSONPatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatchValue": schema_cluster_api_api_core_v1beta2_JSONPatchValue(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONSchemaProps": schema_cluster_api_api_core_v1beta2_JSONSchemaProps(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Machine": schema_cluster_api_api_core_v1beta2_Machine(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineAddress": schema_cluster_api_api_core_v1beta2_MachineAddress(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionStatus": schema_cluster_api_api_core_v1beta2_MachineDeletionStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeployment": schema_cluster_api_api_core_v1beta2_MachineDeployment(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClass": schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassBootstrapTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckChecks(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediation(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediationTriggerIf(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentList": schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategyRollingUpdate": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategyRollingUpdate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopology": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckChecks(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediation(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables": schema_cluster_api_api_core_v1beta2_MachineDeploymentVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRule": schema_cluster_api_api_core_v1beta2_MachineDrainRule(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleDrainConfig": schema_cluster_api_api_core_v1beta2_MachineDrainRuleDrainConfig(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleList": schema_cluster_api_api_core_v1beta2_MachineDrainRuleList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleMachineSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRuleMachineSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRulePodSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRulePodSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleSpec": schema_cluster_api_api_core_v1beta2_MachineDrainRuleSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineHealthCheck(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineHealthCheckChecks(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckList": schema_cluster_api_api_core_v1beta2_MachineHealthCheckList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediation(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTriggerIf(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckSpec": schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineInitializationStatus": schema_cluster_api_api_core_v1beta2_MachineInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineList": schema_cluster_api_api_core_v1beta2_MachineList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNodeReference": schema_cluster_api_api_core_v1beta2_MachineNodeReference(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePool": schema_cluster_api_api_core_v1beta2_MachinePool(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClass": schema_cluster_api_api_core_v1beta2_MachinePoolClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassBootstrapTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassInfrastructureTemplate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolClassMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachinePoolClassNamingStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolInitializationStatus": schema_cluster_api_api_core_v1beta2_MachinePoolInitializationStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolList": schema_cluster_api_api_core_v1beta2_MachinePoolList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolSpec": schema_cluster_api_api_core_v1beta2_MachinePoolSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolStatus": schema_cluster_api_api_core_v1beta2_MachinePoolStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopology": schema_cluster_api_api_core_v1beta2_MachinePoolTopology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolTopologyMachineDeletionSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolVariables": schema_cluster_api_api_core_v1beta2_MachinePoolVariables(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate": schema_cluster_api_api_core_v1beta2_MachineReadinessGate(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSet": schema_cluster_api_api_core_v1beta2_MachineSet(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetDeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetList": schema_cluster_api_api_core_v1beta2_MachineSetList(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetSpec": schema_cluster_api_api_core_v1beta2_MachineSetSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetStatus": schema_cluster_api_api_core_v1beta2_MachineSetStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSpec": schema_cluster_api_api_core_v1beta2_MachineSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineStatus": schema_cluster_api_api_core_v1beta2_MachineStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineTemplateSpec": schema_cluster_api_api_core_v1beta2_MachineTemplateSpec(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineV1Beta1DeprecatedStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.NetworkRanges": schema_cluster_api_api_core_v1beta2_NetworkRanges(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta": schema_cluster_api_api_core_v1beta2_ObjectMeta(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchDefinition": schema_cluster_api_api_core_v1beta2_PatchDefinition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelector": schema_cluster_api_api_core_v1beta2_PatchSelector(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatch": schema_cluster_api_api_core_v1beta2_PatchSelectorMatch(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachineDeploymentClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachineDeploymentClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachinePoolClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachinePoolClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.RemediationStrategy": schema_cluster_api_api_core_v1beta2_RemediationStrategy(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.Topology": schema_cluster_api_api_core_v1beta2_Topology(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition": schema_cluster_api_api_core_v1beta2_UnhealthyNodeCondition(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.ValidationRule": schema_cluster_api_api_core_v1beta2_ValidationRule(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchema": schema_cluster_api_api_core_v1beta2_VariableSchema(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchemaMetadata": schema_cluster_api_api_core_v1beta2_VariableSchemaMetadata(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersClass": schema_cluster_api_api_core_v1beta2_WorkersClass(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersStatus": schema_cluster_api_api_core_v1beta2_WorkersStatus(ref), - "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersTopology": schema_cluster_api_api_core_v1beta2_WorkersTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.APIEndpoint": schema_cluster_api_api_core_v1beta2_APIEndpoint(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Bootstrap": schema_cluster_api_api_core_v1beta2_Bootstrap(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Cluster": schema_cluster_api_api_core_v1beta2_Cluster(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterAvailabilityGate": schema_cluster_api_api_core_v1beta2_ClusterAvailabilityGate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClass": schema_cluster_api_api_core_v1beta2_ClusterClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassList": schema_cluster_api_api_core_v1beta2_ClusterClassList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassPatch": schema_cluster_api_api_core_v1beta2_ClusterClassPatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassRef": schema_cluster_api_api_core_v1beta2_ClusterClassRef(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassSpec": schema_cluster_api_api_core_v1beta2_ClusterClassSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatus": schema_cluster_api_api_core_v1beta2_ClusterClassStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariable": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassStatusVariableDefinition": schema_cluster_api_api_core_v1beta2_ClusterClassStatusVariableDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference": schema_cluster_api_api_core_v1beta2_ClusterClassTemplateReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterClassV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariable": schema_cluster_api_api_core_v1beta2_ClusterClassVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassVariableMetadata": schema_cluster_api_api_core_v1beta2_ClusterClassVariableMetadata(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterControlPlaneStatus": schema_cluster_api_api_core_v1beta2_ClusterControlPlaneStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterDeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterInitializationStatus": schema_cluster_api_api_core_v1beta2_ClusterInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterList": schema_cluster_api_api_core_v1beta2_ClusterList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterNetwork": schema_cluster_api_api_core_v1beta2_ClusterNetwork(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterSpec": schema_cluster_api_api_core_v1beta2_ClusterSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterStatus": schema_cluster_api_api_core_v1beta2_ClusterStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_ClusterV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterVariable": schema_cluster_api_api_core_v1beta2_ClusterVariable(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Condition": schema_cluster_api_api_core_v1beta2_Condition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ContractVersionedObjectReference": schema_cluster_api_api_core_v1beta2_ContractVersionedObjectReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClass": schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy": schema_cluster_api_api_core_v1beta2_ControlPlaneClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopology": schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheck": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckChecks": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables": schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ExternalPatchDefinition": schema_cluster_api_api_core_v1beta2_ExternalPatchDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.FailureDomain": schema_cluster_api_api_core_v1beta2_FailureDomain(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClass": schema_cluster_api_api_core_v1beta2_InfrastructureClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.InfrastructureClassNamingStrategy": schema_cluster_api_api_core_v1beta2_InfrastructureClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatch": schema_cluster_api_api_core_v1beta2_JSONPatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONPatchValue": schema_cluster_api_api_core_v1beta2_JSONPatchValue(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.JSONSchemaProps": schema_cluster_api_api_core_v1beta2_JSONSchemaProps(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Machine": schema_cluster_api_api_core_v1beta2_Machine(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineAddress": schema_cluster_api_api_core_v1beta2_MachineAddress(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeletionStatus": schema_cluster_api_api_core_v1beta2_MachineDeletionStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeployment": schema_cluster_api_api_core_v1beta2_MachineDeployment(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClass": schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassBootstrapTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentList": schema_cluster_api_api_core_v1beta2_MachineDeploymentList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategyRollingUpdate": schema_cluster_api_api_core_v1beta2_MachineDeploymentStrategyRollingUpdate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopology": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheck": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables": schema_cluster_api_api_core_v1beta2_MachineDeploymentVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRule": schema_cluster_api_api_core_v1beta2_MachineDrainRule(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleDrainConfig": schema_cluster_api_api_core_v1beta2_MachineDrainRuleDrainConfig(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleList": schema_cluster_api_api_core_v1beta2_MachineDrainRuleList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleMachineSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRuleMachineSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRulePodSelector": schema_cluster_api_api_core_v1beta2_MachineDrainRulePodSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDrainRuleSpec": schema_cluster_api_api_core_v1beta2_MachineDrainRuleSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheck": schema_cluster_api_api_core_v1beta2_MachineHealthCheck(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks": schema_cluster_api_api_core_v1beta2_MachineHealthCheckChecks(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckList": schema_cluster_api_api_core_v1beta2_MachineHealthCheckList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediation(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTemplateReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTriggerIf": schema_cluster_api_api_core_v1beta2_MachineHealthCheckRemediationTriggerIf(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckSpec": schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineHealthCheckV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineInitializationStatus": schema_cluster_api_api_core_v1beta2_MachineInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineList": schema_cluster_api_api_core_v1beta2_MachineList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNamingStrategy": schema_cluster_api_api_core_v1beta2_MachineNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineNodeReference": schema_cluster_api_api_core_v1beta2_MachineNodeReference(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePool": schema_cluster_api_api_core_v1beta2_MachinePool(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClass": schema_cluster_api_api_core_v1beta2_MachinePoolClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassBootstrapTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassBootstrapTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassInfrastructureTemplate": schema_cluster_api_api_core_v1beta2_MachinePoolClassInfrastructureTemplate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolClassMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolClassNamingStrategy": schema_cluster_api_api_core_v1beta2_MachinePoolClassNamingStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolInitializationStatus": schema_cluster_api_api_core_v1beta2_MachinePoolInitializationStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolList": schema_cluster_api_api_core_v1beta2_MachinePoolList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolSpec": schema_cluster_api_api_core_v1beta2_MachinePoolSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolStatus": schema_cluster_api_api_core_v1beta2_MachinePoolStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopology": schema_cluster_api_api_core_v1beta2_MachinePoolTopology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolTopologyMachineDeletionSpec": schema_cluster_api_api_core_v1beta2_MachinePoolTopologyMachineDeletionSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachinePoolV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachinePoolVariables": schema_cluster_api_api_core_v1beta2_MachinePoolVariables(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate": schema_cluster_api_api_core_v1beta2_MachineReadinessGate(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSet": schema_cluster_api_api_core_v1beta2_MachineSet(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetDeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetDeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetList": schema_cluster_api_api_core_v1beta2_MachineSetList(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetSpec": schema_cluster_api_api_core_v1beta2_MachineSetSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetStatus": schema_cluster_api_api_core_v1beta2_MachineSetStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSetV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineSetV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineSpec": schema_cluster_api_api_core_v1beta2_MachineSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineStatus": schema_cluster_api_api_core_v1beta2_MachineStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineTemplateSpec": schema_cluster_api_api_core_v1beta2_MachineTemplateSpec(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineV1Beta1DeprecatedStatus": schema_cluster_api_api_core_v1beta2_MachineV1Beta1DeprecatedStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.NetworkRanges": schema_cluster_api_api_core_v1beta2_NetworkRanges(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta": schema_cluster_api_api_core_v1beta2_ObjectMeta(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchDefinition": schema_cluster_api_api_core_v1beta2_PatchDefinition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelector": schema_cluster_api_api_core_v1beta2_PatchSelector(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatch": schema_cluster_api_api_core_v1beta2_PatchSelectorMatch(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachineDeploymentClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachineDeploymentClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.PatchSelectorMatchMachinePoolClass": schema_cluster_api_api_core_v1beta2_PatchSelectorMatchMachinePoolClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.RemediationStrategy": schema_cluster_api_api_core_v1beta2_RemediationStrategy(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.Topology": schema_cluster_api_api_core_v1beta2_Topology(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.UnhealthyNodeCondition": schema_cluster_api_api_core_v1beta2_UnhealthyNodeCondition(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.ValidationRule": schema_cluster_api_api_core_v1beta2_ValidationRule(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchema": schema_cluster_api_api_core_v1beta2_VariableSchema(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.VariableSchemaMetadata": schema_cluster_api_api_core_v1beta2_VariableSchemaMetadata(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersClass": schema_cluster_api_api_core_v1beta2_WorkersClass(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersStatus": schema_cluster_api_api_core_v1beta2_WorkersStatus(ref), + "sigs.k8s.io/cluster-api/api/core/v1beta2.WorkersTopology": schema_cluster_api_api_core_v1beta2_WorkersTopology(ref), } } @@ -1506,7 +1506,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref common.ReferenceC "healthCheck": { SchemaProps: spec.SchemaProps{ Description: "healthCheck defines a MachineHealthCheck for this ControlPlaneClass. This field is supported if and only if the ControlPlane provider template referenced above is Machine based and supports setting replicas.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheck"), }, }, "namingStrategy": { @@ -1549,78 +1549,44 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClass(ref common.ReferenceC }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineDeletionSpec contains configuration options for Machine deletion.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeDrainTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` NOTE: This value can be overridden while defining a Cluster.Topology.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeVolumeDetachTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. NOTE: This value can be overridden while defining a Cluster.Topology.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeDeletionTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds. NOTE: This value can be overridden while defining a Cluster.Topology.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - } -} - -func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheck defines a MachineHealthCheck for control plane machines.", + Description: "ControlPlaneClassHealthCheck defines a MachineHealthCheck for control plane machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ Description: "checks are the checks that are used to evaluate if a Machine is healthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediation"), }, }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediation"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediation"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", + Description: "ControlPlaneClassHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -1657,18 +1623,18 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckChec } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", + Description: "ControlPlaneClassHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { SchemaProps: spec.SchemaProps{ Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediationTriggerIf"), }, }, "templateRef": { @@ -1681,15 +1647,15 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckReme }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Description: "ControlPlaneClassHealthCheckRemediationTriggerIf configures if remediations are triggered.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "unhealthyLessThanOrEqualTo": { @@ -1713,6 +1679,40 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineHealthCheckReme } } +func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneClassMachineDeletionSpec contains configuration options for Machine deletion.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeDrainTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` NOTE: This value can be overridden while defining a Cluster.Topology.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeVolumeDetachTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. NOTE: This value can be overridden while defining a Cluster.Topology.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeDeletionTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds. NOTE: This value can be overridden while defining a Cluster.Topology.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_cluster_api_api_core_v1beta2_ControlPlaneClassMachineInfrastructureTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1780,7 +1780,7 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref common.Referen "healthCheck": { SchemaProps: spec.SchemaProps{ Description: "healthCheck allows to enable, disable and override control plane health check configuration from the ClusterClass for this control plane.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheck"), }, }, "deletion": { @@ -1823,49 +1823,15 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopology(ref common.Referen }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineDeletionSpec contains configuration options for Machine deletion.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeDrainTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeVolumeDetachTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeDeletionTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - } -} - -func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheck defines a MachineHealthCheck for control plane machines.", + Description: "ControlPlaneTopologyHealthCheck defines a MachineHealthCheck for control plane machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "enabled": { @@ -1879,29 +1845,29 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheck( SchemaProps: spec.SchemaProps{ Description: "checks are the checks that are used to evaluate if a Machine is healthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediation"), }, }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediation"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediation"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", + Description: "ControlPlaneTopologyHealthCheckChecks are the checks that are used to evaluate if a control plane Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -1938,18 +1904,18 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckC } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", + Description: "ControlPlaneTopologyHealthCheckRemediation configures if and how remediations are triggered if a control plane Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { SchemaProps: spec.SchemaProps{ Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIf"), }, }, "templateRef": { @@ -1962,15 +1928,15 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckR }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, } } -func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Description: "ControlPlaneTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "unhealthyLessThanOrEqualTo": { @@ -1994,6 +1960,40 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineHealthCheckR } } +func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ControlPlaneTopologyMachineDeletionSpec contains configuration options for Machine deletion.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeDrainTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeVolumeDetachTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeDeletionTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_cluster_api_api_core_v1beta2_ControlPlaneVariables(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2765,7 +2765,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref common.Refer "healthCheck": { SchemaProps: spec.SchemaProps{ Description: "healthCheck defines a MachineHealthCheck for this MachineDeploymentClass.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheck"), }, }, "failureDomain": { @@ -2829,7 +2829,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClass(ref common.Refer }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassBootstrapTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassInfrastructureTemplate", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassNamingStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } @@ -2856,97 +2856,40 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassBootstrapTemplate } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassInfrastructureTemplate defines the InfrastructureTemplate for a MachineDeployment.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "templateRef": { - SchemaProps: spec.SchemaProps{ - Description: "templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.", - Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference"), - }, - }, - }, - Required: []string{"templateRef"}, - }, - }, - Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference"}, - } -} - -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineDeletionSpec contains configuration options for Machine deletion.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeDrainTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeVolumeDetachTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeDeletionTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds. NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - } -} - -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", + Description: "MachineDeploymentClassHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ Description: "checks are the checks that are used to evaluate if a Machine is healthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediation"), }, }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediation"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediation"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", + Description: "MachineDeploymentClassHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -2983,18 +2926,18 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", + Description: "MachineDeploymentClassHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { SchemaProps: spec.SchemaProps{ Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIf"), }, }, "templateRef": { @@ -3007,15 +2950,15 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentClassMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Description: "MachineDeploymentClassHealthCheckRemediationTriggerIf configures if remediations are triggered.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "unhealthyLessThanOrEqualTo": { @@ -3039,6 +2982,63 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineHealthChec } } +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassInfrastructureTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentClassInfrastructureTemplate defines the InfrastructureTemplate for a MachineDeployment.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "templateRef": { + SchemaProps: spec.SchemaProps{ + Description: "templateRef is a required reference to the InfrastructureTemplate for a MachineDeployment.", + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference"), + }, + }, + }, + Required: []string{"templateRef"}, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/core/v1beta2.ClusterClassTemplateReference"}, + } +} + +func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentClassMachineDeletionSpec contains configuration options for Machine deletion.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeDrainTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout` NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeVolumeDetachTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations. NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeDeletionTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds. NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassNamingStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3411,7 +3411,7 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref common.Re "healthCheck": { SchemaProps: spec.SchemaProps{ Description: "healthCheck allows to enable, disable and override MachineDeployment health check configuration from the ClusterClass for this MachineDeployment.", - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheck"), }, }, "deletion": { @@ -3469,49 +3469,15 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopology(ref common.Re }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentStrategy", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheck", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineDeletionSpec", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentVariables", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineReadinessGate", "sigs.k8s.io/cluster-api/api/core/v1beta2.ObjectMeta"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineDeletionSpec contains configuration options for Machine deletion.", - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "nodeDrainTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeVolumeDetachTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - "nodeDeletionTimeoutSeconds": { - SchemaProps: spec.SchemaProps{ - Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds.", - Type: []string{"integer"}, - Format: "int32", - }, - }, - }, - }, - }, - } -} - -func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheck(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", + Description: "MachineDeploymentTopologyHealthCheck defines a MachineHealthCheck for MachineDeployment machines.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "enabled": { @@ -3525,29 +3491,29 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC SchemaProps: spec.SchemaProps{ Description: "checks are the checks that are used to evaluate if a Machine is healthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediation"), }, }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediation"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckChecks", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediation"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckChecks(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", + Description: "MachineDeploymentTopologyHealthCheckChecks are the checks that are used to evaluate if a MachineDeployment Machine is healthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "nodeStartupTimeoutSeconds": { @@ -3584,18 +3550,18 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckRemediation(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", + Description: "MachineDeploymentTopologyHealthCheckRemediation configures if and how remediations are triggered if a MachineDeployment Machine is unhealthy.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "triggerIf": { SchemaProps: spec.SchemaProps{ Description: "triggerIf configures if remediations are triggered. If this field is not set, remediations are always triggered.", Default: map[string]interface{}{}, - Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf"), + Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIf"), }, }, "templateRef": { @@ -3608,15 +3574,15 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, + "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediationTriggerIf", "sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediationTemplateReference"}, } } -func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheckRemediationTriggerIf(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf configures if remediations are triggered.", + Description: "MachineDeploymentTopologyHealthCheckRemediationTriggerIf configures if remediations are triggered.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "unhealthyLessThanOrEqualTo": { @@ -3640,6 +3606,40 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineHealthC } } +func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyMachineDeletionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentTopologyMachineDeletionSpec contains configuration options for Machine deletion.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeDrainTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDrainTimeoutSeconds 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: nodeDrainTimeoutSeconds is different from `kubectl drain --timeout`", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeVolumeDetachTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeVolumeDetachTimeoutSeconds is the total amount of time that the controller will spend on waiting for all volumes to be detached. The default value is 0, meaning that the volumes can be detached without any time limitations.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "nodeDeletionTimeoutSeconds": { + SchemaProps: spec.SchemaProps{ + Description: "nodeDeletionTimeoutSeconds defines how long the controller will attempt to delete the Node that the Machine hosts after the Machine is marked for deletion. A duration of 0 will retry deletion indefinitely. Defaults to 10 seconds.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_cluster_api_api_core_v1beta2_MachineDeploymentV1Beta1DeprecatedStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/exp/topology/desiredstate/desired_state_test.go b/exp/topology/desiredstate/desired_state_test.go index 0ef3e649e853..3f3a3a313757 100644 --- a/exp/topology/desiredstate/desired_state_test.go +++ b/exp/topology/desiredstate/desired_state_test.go @@ -1733,8 +1733,8 @@ func TestComputeMachineDeployment(t *testing.T) { WithAnnotations(annotations). WithInfrastructureTemplate(workerInfrastructureMachineTemplate). WithBootstrapTemplate(workerBootstrapTemplate). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: unhealthyNodeConditions, NodeStartupTimeoutSeconds: nodeTimeoutDuration, }, @@ -1776,8 +1776,8 @@ func TestComputeMachineDeployment(t *testing.T) { }, BootstrapTemplate: workerBootstrapTemplate, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: unhealthyNodeConditions, NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, @@ -1938,8 +1938,8 @@ func TestComputeMachineDeployment(t *testing.T) { }, BootstrapTemplate: workerBootstrapTemplate, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: unhealthyNodeConditions, NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, diff --git a/exp/topology/scope/blueprint.go b/exp/topology/scope/blueprint.go index aec6fe39aaa8..1f7f70468cdd 100644 --- a/exp/topology/scope/blueprint.go +++ b/exp/topology/scope/blueprint.go @@ -52,9 +52,9 @@ type ControlPlaneBlueprint struct { // InfrastructureMachineTemplate holds the infrastructure machine template for the control plane, if defined in the ClusterClass. InfrastructureMachineTemplate *unstructured.Unstructured - // MachineHealthCheck holds the MachineHealthCheckClass for this ControlPlane. + // HealthCheck holds the MachineHealthCheckClass for this ControlPlane. // +optional - MachineHealthCheck *clusterv1.ControlPlaneClassMachineHealthCheck + HealthCheck *clusterv1.ControlPlaneClassHealthCheck } // MachineDeploymentBlueprint holds the templates required for computing the desired state of a managed MachineDeployment; @@ -71,9 +71,9 @@ type MachineDeploymentBlueprint struct { // InfrastructureMachineTemplate holds the infrastructure machine template for a MachineDeployment referenced from ClusterClass. InfrastructureMachineTemplate *unstructured.Unstructured - // MachineHealthCheck holds the MachineHealthCheckClass for this MachineDeployment. + // HealthCheck holds the MachineHealthCheckClass for this MachineDeployment. // +optional - MachineHealthCheck *clusterv1.MachineDeploymentClassMachineHealthCheck + HealthCheck *clusterv1.MachineDeploymentClassHealthCheck } // MachinePoolBlueprint holds the templates required for computing the desired state of a managed MachinePool; @@ -117,7 +117,7 @@ func (b *ClusterBlueprint) IsControlPlaneMachineHealthCheckEnabled() bool { // ControlPlaneMachineHealthCheckClass returns the MachineHealthCheckClass that should be used to create the MachineHealthCheck object. func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() (clusterv1.MachineHealthCheckChecks, clusterv1.MachineHealthCheckRemediation) { - if b.Topology.ControlPlane.HealthCheck == nil && b.ControlPlane.MachineHealthCheck == nil { + if b.Topology.ControlPlane.HealthCheck == nil && b.ControlPlane.HealthCheck == nil { return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } @@ -135,14 +135,14 @@ func (b *ClusterBlueprint) ControlPlaneMachineHealthCheckClass() (clusterv1.Mach } return clusterv1.MachineHealthCheckChecks{ - NodeStartupTimeoutSeconds: b.ControlPlane.MachineHealthCheck.Checks.NodeStartupTimeoutSeconds, - UnhealthyNodeConditions: b.ControlPlane.MachineHealthCheck.Checks.UnhealthyNodeConditions, + NodeStartupTimeoutSeconds: b.ControlPlane.HealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: b.ControlPlane.HealthCheck.Checks.UnhealthyNodeConditions, }, clusterv1.MachineHealthCheckRemediation{ TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ - UnhealthyLessThanOrEqualTo: b.ControlPlane.MachineHealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, - UnhealthyInRange: b.ControlPlane.MachineHealthCheck.Remediation.TriggerIf.UnhealthyInRange, + UnhealthyLessThanOrEqualTo: b.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: b.ControlPlane.HealthCheck.Remediation.TriggerIf.UnhealthyInRange, }, - TemplateRef: b.ControlPlane.MachineHealthCheck.Remediation.TemplateRef, + TemplateRef: b.ControlPlane.HealthCheck.Remediation.TemplateRef, } } @@ -155,7 +155,7 @@ func (b *ClusterBlueprint) HasControlPlaneMachineHealthCheck() bool { // Returns false otherwise. func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clusterv1.MachineDeploymentTopology) bool { // If no MachineHealthCheck is defined in the ClusterClass or in the Cluster Topology then return false. - if b.MachineDeployments[md.Class].MachineHealthCheck == nil && (md.HealthCheck == nil || !md.HealthCheck.IsDefined()) { + if b.MachineDeployments[md.Class].HealthCheck == nil && (md.HealthCheck == nil || !md.HealthCheck.IsDefined()) { return false } // If `enable` is not set then consider it as true. A MachineHealthCheck will be created from either ClusterClass or Cluster Topology. @@ -168,7 +168,7 @@ func (b *ClusterBlueprint) IsMachineDeploymentMachineHealthCheckEnabled(md *clus // MachineDeploymentMachineHealthCheckClass return the MachineHealthCheckClass that should be used to create the MachineHealthCheck object. func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv1.MachineDeploymentTopology) (clusterv1.MachineHealthCheckChecks, clusterv1.MachineHealthCheckRemediation) { - if md.HealthCheck == nil && b.MachineDeployments[md.Class].MachineHealthCheck == nil { + if md.HealthCheck == nil && b.MachineDeployments[md.Class].HealthCheck == nil { return clusterv1.MachineHealthCheckChecks{}, clusterv1.MachineHealthCheckRemediation{} } @@ -186,14 +186,14 @@ func (b *ClusterBlueprint) MachineDeploymentMachineHealthCheckClass(md *clusterv } return clusterv1.MachineHealthCheckChecks{ - NodeStartupTimeoutSeconds: b.MachineDeployments[md.Class].MachineHealthCheck.Checks.NodeStartupTimeoutSeconds, - UnhealthyNodeConditions: b.MachineDeployments[md.Class].MachineHealthCheck.Checks.UnhealthyNodeConditions, + NodeStartupTimeoutSeconds: b.MachineDeployments[md.Class].HealthCheck.Checks.NodeStartupTimeoutSeconds, + UnhealthyNodeConditions: b.MachineDeployments[md.Class].HealthCheck.Checks.UnhealthyNodeConditions, }, clusterv1.MachineHealthCheckRemediation{ TriggerIf: clusterv1.MachineHealthCheckRemediationTriggerIf{ - UnhealthyLessThanOrEqualTo: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, - UnhealthyInRange: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TriggerIf.UnhealthyInRange, + UnhealthyLessThanOrEqualTo: b.MachineDeployments[md.Class].HealthCheck.Remediation.TriggerIf.UnhealthyLessThanOrEqualTo, + UnhealthyInRange: b.MachineDeployments[md.Class].HealthCheck.Remediation.TriggerIf.UnhealthyInRange, }, - TemplateRef: b.MachineDeployments[md.Class].MachineHealthCheck.Remediation.TemplateRef, + TemplateRef: b.MachineDeployments[md.Class].HealthCheck.Remediation.TemplateRef, } } diff --git a/exp/topology/scope/blueprint_test.go b/exp/topology/scope/blueprint_test.go index f26f379e71da..0465126171c8 100644 --- a/exp/topology/scope/blueprint_test.go +++ b/exp/topology/scope/blueprint_test.go @@ -61,7 +61,7 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). @@ -74,11 +74,11 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(false), }). Build(), @@ -90,11 +90,11 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ ClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "cluster-class"). WithControlPlaneInfrastructureMachineTemplate(&unstructured.Unstructured{}). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), }). Build(), @@ -109,8 +109,8 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -132,9 +132,9 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(false), - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -156,9 +156,9 @@ func TestIsControlPlaneMachineHealthCheckEnabled(t *testing.T) { Build(), Topology: builder.ClusterTopology(). WithClass("cluster-class"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -193,8 +193,8 @@ func TestControlPlaneMachineHealthCheckClass(t *testing.T) { name: "should return the MachineHealthCheck from cluster topology if defined - should take precedence over MachineHealthCheck in ClusterClass", blueprint: &ClusterBlueprint{ Topology: builder.ClusterTopology(). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -203,16 +203,16 @@ func TestControlPlaneMachineHealthCheckClass(t *testing.T) { }, }, }, - Remediation: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediation{ - TriggerIf: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediationTriggerIf{ + Remediation: clusterv1.ControlPlaneTopologyHealthCheckRemediation{ + TriggerIf: clusterv1.ControlPlaneTopologyHealthCheckRemediationTriggerIf{ UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), }, }, }). Build(), ControlPlane: &ControlPlaneBlueprint{ - MachineHealthCheck: &clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -243,11 +243,11 @@ func TestControlPlaneMachineHealthCheckClass(t *testing.T) { name: "should return the MachineHealthCheck from ClusterClass if no MachineHealthCheck is defined in cluster topology", blueprint: &ClusterBlueprint{ Topology: builder.ClusterTopology(). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{}). Build(), ControlPlane: &ControlPlaneBlueprint{ - MachineHealthCheck: &clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -306,7 +306,7 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{}, }, }, }, @@ -320,13 +320,13 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{}, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(false), }, }, @@ -337,13 +337,13 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{}, + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{}, }, }, }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), }, }, @@ -358,8 +358,8 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -381,9 +381,9 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(false), - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -405,9 +405,9 @@ func TestIsMachineDeploymentMachineHealthCheckEnabled(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -443,8 +443,8 @@ func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -459,8 +459,8 @@ func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -469,8 +469,8 @@ func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { }, }, }, - Remediation: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediation{ - TriggerIf: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediationTriggerIf{ + Remediation: clusterv1.MachineDeploymentTopologyHealthCheckRemediation{ + TriggerIf: clusterv1.MachineDeploymentTopologyHealthCheckRemediationTriggerIf{ UnhealthyLessThanOrEqualTo: ptr.To(intstr.FromString("50%")), }, }, @@ -496,8 +496,8 @@ func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { blueprint: &ClusterBlueprint{ MachineDeployments: map[string]*MachineDeploymentBlueprint{ "worker-class": { - MachineHealthCheck: &clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + HealthCheck: &clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -512,7 +512,7 @@ func TestMachineDeploymentMachineHealthCheckClass(t *testing.T) { }, mdTopology: &clusterv1.MachineDeploymentTopology{ Class: "worker-class", - HealthCheck: &clusterv1.MachineDeploymentTopologyMachineHealthCheck{}, + HealthCheck: &clusterv1.MachineDeploymentTopologyHealthCheck{}, }, wantChecks: clusterv1.MachineHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ diff --git a/internal/controllers/topology/cluster/blueprint.go b/internal/controllers/topology/cluster/blueprint.go index 84e9a09af206..d394be2b6b98 100644 --- a/internal/controllers/topology/cluster/blueprint.go +++ b/internal/controllers/topology/cluster/blueprint.go @@ -61,7 +61,7 @@ func (r *Reconciler) getBlueprint(ctx context.Context, cluster *clusterv1.Cluste // If the clusterClass defines a valid MachineHealthCheck (including a defined MachineInfrastructure) set the blueprint MachineHealthCheck. if blueprint.HasControlPlaneMachineHealthCheck() { - blueprint.ControlPlane.MachineHealthCheck = blueprint.ClusterClass.Spec.ControlPlane.HealthCheck + blueprint.ControlPlane.HealthCheck = blueprint.ClusterClass.Spec.ControlPlane.HealthCheck } // Loop over the machine deployments classes in ClusterClass @@ -88,7 +88,7 @@ func (r *Reconciler) getBlueprint(ctx context.Context, cluster *clusterv1.Cluste // If the machineDeploymentClass defines a MachineHealthCheck add it to the blueprint. if machineDeploymentClass.HealthCheck != nil { - machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.HealthCheck + machineDeploymentBlueprint.HealthCheck = machineDeploymentClass.HealthCheck } blueprint.MachineDeployments[machineDeploymentClass.Class] = machineDeploymentBlueprint } diff --git a/internal/controllers/topology/cluster/blueprint_test.go b/internal/controllers/topology/cluster/blueprint_test.go index bd2b0d23fd75..48c83f560e60 100644 --- a/internal/controllers/topology/cluster/blueprint_test.go +++ b/internal/controllers/topology/cluster/blueprint_test.go @@ -61,13 +61,13 @@ func TestGetBlueprint(t *testing.T) { Build() workerBootstrapTemplate := builder.BootstrapTemplate(metav1.NamespaceDefault, "workerbootstraptemplate1"). Build() - cpMachineHealthCheck := &clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + cpMachineHealthCheck := &clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, } - mdMachineHealthCheck := &clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + mdMachineHealthCheck := &clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ NodeStartupTimeoutSeconds: ptr.To(int32(1)), }, } @@ -233,7 +233,7 @@ func TestGetBlueprint(t *testing.T) { }, InfrastructureMachineTemplate: workerInfrastructureMachineTemplate, BootstrapTemplate: workerBootstrapTemplate, - MachineHealthCheck: mdMachineHealthCheck, + HealthCheck: mdMachineHealthCheck, }, }, MachinePools: map[string]*scope.MachinePoolBlueprint{}, @@ -293,7 +293,7 @@ func TestGetBlueprint(t *testing.T) { ControlPlane: &scope.ControlPlaneBlueprint{ Template: controlPlaneTemplate, InfrastructureMachineTemplate: controlPlaneInfrastructureMachineTemplate, - MachineHealthCheck: cpMachineHealthCheck, + HealthCheck: cpMachineHealthCheck, }, MachineDeployments: map[string]*scope.MachineDeploymentBlueprint{}, MachinePools: map[string]*scope.MachinePoolBlueprint{}, diff --git a/internal/controllers/topology/cluster/reconcile_state_test.go b/internal/controllers/topology/cluster/reconcile_state_test.go index d5e6366e171c..2ef2576a2c69 100644 --- a/internal/controllers/topology/cluster/reconcile_state_test.go +++ b/internal/controllers/topology/cluster/reconcile_state_test.go @@ -1836,8 +1836,8 @@ func TestReconcileControlPlaneMachineHealthCheck(t *testing.T) { // Create InfrastructureMachineTemplates for test cases infrastructureMachineTemplate := builder.TestInfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build() - mhcClass := &clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + mhcClass := &clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -1851,10 +1851,10 @@ func TestReconcileControlPlaneMachineHealthCheck(t *testing.T) { // Create clusterClasses requiring controlPlaneInfrastructure and one not. ccWithControlPlaneInfrastructure := &scope.ControlPlaneBlueprint{ InfrastructureMachineTemplate: infrastructureMachineTemplate, - MachineHealthCheck: mhcClass, + HealthCheck: mhcClass, } ccWithoutControlPlaneInfrastructure := &scope.ControlPlaneBlueprint{ - MachineHealthCheck: mhcClass, + HealthCheck: mhcClass, } // Create ControlPlane Object. @@ -3924,8 +3924,8 @@ func prepareControlPlaneBluePrint(in *scope.ControlPlaneBlueprint, namespace str s.InfrastructureMachineTemplate.SetNamespace(namespace) } } - if in.MachineHealthCheck != nil { - s.MachineHealthCheck = in.MachineHealthCheck.DeepCopy() + if in.HealthCheck != nil { + s.HealthCheck = in.HealthCheck.DeepCopy() } if in.Template != nil { s.Template = in.Template.DeepCopy() diff --git a/internal/webhooks/cluster_test.go b/internal/webhooks/cluster_test.go index 4e725cd56203..d7270afe7a15 100644 --- a/internal/webhooks/cluster_test.go +++ b/internal/webhooks/cluster_test.go @@ -57,16 +57,16 @@ func TestClusterTopologyDefaultNamespaces(t *testing.T) { WithTopology(builder.ClusterTopology(). WithClass("foo"). WithVersion("v1.19.1"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ - Remediation: clusterv1.ControlPlaneTopologyMachineHealthCheckRemediation{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ + Remediation: clusterv1.ControlPlaneTopologyHealthCheckRemediation{ TemplateRef: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, }, }). WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("aa"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ - Remediation: clusterv1.MachineDeploymentTopologyMachineHealthCheckRemediation{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ + Remediation: clusterv1.MachineDeploymentTopologyHealthCheckRemediation{ TemplateRef: &clusterv1.MachineHealthCheckRemediationTemplateReference{}, }, }). @@ -2248,7 +2248,7 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), }). Build()). @@ -2266,8 +2266,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{}, }, }). @@ -2287,8 +2287,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2312,13 +2312,13 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), }). Build()). Build(), class: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), classReconciled: true, wantErr: false, @@ -2331,9 +2331,9 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithClass("clusterclass"). WithVersion("v1.22.2"). WithControlPlaneReplicas(3). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2361,7 +2361,7 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), }). Build(), @@ -2387,8 +2387,8 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{}, }, }). @@ -2415,7 +2415,7 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), }). Build(), @@ -2425,7 +2425,7 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { class: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass"). WithWorkerMachineDeploymentClasses( *builder.MachineDeploymentClass("worker-class"). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{}). Build(), ). Build(), @@ -2443,9 +2443,9 @@ func TestClusterTopologyValidationWithClient(t *testing.T) { WithMachineDeployment( builder.MachineDeploymentTopology("md1"). WithClass("worker-class"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, diff --git a/internal/webhooks/clusterclass_test.go b/internal/webhooks/clusterclass_test.go index 0978d0e23d92..e7770bf6299a 100644 --- a/internal/webhooks/clusterclass_test.go +++ b/internal/webhooks/clusterclass_test.go @@ -690,8 +690,8 @@ func TestClusterClassValidation(t *testing.T) { WithControlPlaneInfrastructureMachineTemplate( builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "cp-infra1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -713,8 +713,8 @@ func TestClusterClassValidation(t *testing.T) { builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). // No ControlPlaneMachineInfrastructure makes this an invalid creation request. - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ NodeStartupTimeoutSeconds: ptr.To(int32(60)), }, }). @@ -732,8 +732,8 @@ func TestClusterClassValidation(t *testing.T) { WithControlPlaneInfrastructureMachineTemplate( builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "cp-infra1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ NodeStartupTimeoutSeconds: ptr.To(int32(60)), }, }). @@ -754,8 +754,8 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -783,8 +783,8 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -814,8 +814,8 @@ func TestClusterClassValidation(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{ - Checks: clusterv1.MachineDeploymentClassMachineHealthCheckChecks{ + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{ + Checks: clusterv1.MachineDeploymentClassHealthCheckChecks{ NodeStartupTimeoutSeconds: ptr.To(int32(60)), }, }). @@ -2084,7 +2084,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.Cluster(metav1.NamespaceDefault, "cluster1"). WithTopology(builder.ClusterTopology(). WithClass("clusterclass1"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), }). Build()). @@ -2096,8 +2096,8 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{ - Checks: clusterv1.ControlPlaneClassMachineHealthCheckChecks{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{ + Checks: clusterv1.ControlPlaneClassHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2132,7 +2132,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), newClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1"). WithInfrastructureClusterTemplate( @@ -2149,9 +2149,9 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.Cluster(metav1.NamespaceDefault, "cluster1"). WithTopology(builder.ClusterTopology(). WithClass("clusterclass1"). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyMachineHealthCheck{ + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.ControlPlaneTopologyMachineHealthCheckChecks{ + Checks: clusterv1.ControlPlaneTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2170,7 +2170,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithControlPlaneTemplate( builder.ControlPlaneTemplate(metav1.NamespaceDefault, "cp1"). Build()). - WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassMachineHealthCheck{}). + WithControlPlaneMachineHealthCheck(&clusterv1.ControlPlaneClassHealthCheck{}). Build(), newClusterClass: builder.ClusterClass(metav1.NamespaceDefault, "clusterclass1"). WithInfrastructureClusterTemplate( @@ -2189,7 +2189,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithClass("clusterclass1"). WithMachineDeployment(builder.MachineDeploymentTopology("md1"). WithClass("mdclass1"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), }). Build()). @@ -2208,7 +2208,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{}). Build(), ). Build(), @@ -2253,7 +2253,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{}). Build(), ). Build(), @@ -2282,9 +2282,9 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { WithClass("clusterclass1"). WithMachineDeployment(builder.MachineDeploymentTopology("md1"). WithClass("mdclass1"). - WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyMachineHealthCheck{ + WithMachineHealthCheck(&clusterv1.MachineDeploymentTopologyHealthCheck{ Enabled: ptr.To(true), - Checks: clusterv1.MachineDeploymentTopologyMachineHealthCheckChecks{ + Checks: clusterv1.MachineDeploymentTopologyHealthCheckChecks{ UnhealthyNodeConditions: []clusterv1.UnhealthyNodeCondition{ { Type: corev1.NodeReady, @@ -2310,7 +2310,7 @@ func TestClusterClassValidationWithClusterAwareChecks(t *testing.T) { builder.InfrastructureMachineTemplate(metav1.NamespaceDefault, "infra1").Build()). WithBootstrapTemplate( builder.BootstrapTemplate(metav1.NamespaceDefault, "bootstrap1").Build()). - WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassMachineHealthCheck{}). + WithMachineHealthCheckClass(&clusterv1.MachineDeploymentClassHealthCheck{}). Build(), ). Build(), diff --git a/test/extension/handlers/topologymutation/handler_integration_test.go b/test/extension/handlers/topologymutation/handler_integration_test.go index 6fc67aeb5455..33963056b46c 100644 --- a/test/extension/handlers/topologymutation/handler_integration_test.go +++ b/test/extension/handlers/topologymutation/handler_integration_test.go @@ -282,7 +282,7 @@ func getScope(cluster *clusterv1.Cluster, clusterClassFile string) (*scope.Scope s.Blueprint.ControlPlane.InfrastructureMachineTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, s.Blueprint.ClusterClass.Spec.ControlPlane.MachineInfrastructure.TemplateRef)) } if s.Blueprint.HasControlPlaneMachineHealthCheck() { - s.Blueprint.ControlPlane.MachineHealthCheck = s.Blueprint.ClusterClass.Spec.ControlPlane.HealthCheck + s.Blueprint.ControlPlane.HealthCheck = s.Blueprint.ClusterClass.Spec.ControlPlane.HealthCheck } // MachineDeployments. @@ -292,7 +292,7 @@ func getScope(cluster *clusterv1.Cluster, clusterClassFile string) (*scope.Scope machineDeploymentBlueprint.InfrastructureMachineTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, machineDeploymentClass.Infrastructure.TemplateRef)) machineDeploymentBlueprint.BootstrapTemplate = mustFind(findObject[*unstructured.Unstructured](parsedObjects, machineDeploymentClass.Bootstrap.TemplateRef)) if machineDeploymentClass.HealthCheck != nil { - machineDeploymentBlueprint.MachineHealthCheck = machineDeploymentClass.HealthCheck + machineDeploymentBlueprint.HealthCheck = machineDeploymentClass.HealthCheck } s.Blueprint.MachineDeployments[machineDeploymentClass.Class] = machineDeploymentBlueprint } diff --git a/util/test/builder/builders.go b/util/test/builder/builders.go index af42ce85e30a..b8add4a71967 100644 --- a/util/test/builder/builders.go +++ b/util/test/builder/builders.go @@ -119,7 +119,7 @@ type ClusterTopologyBuilder struct { workers clusterv1.WorkersTopology version string controlPlaneReplicas int32 - controlPlaneMHC *clusterv1.ControlPlaneTopologyMachineHealthCheck + controlPlaneMHC *clusterv1.ControlPlaneTopologyHealthCheck variables []clusterv1.ClusterVariable controlPlaneVariables []clusterv1.ClusterVariable } @@ -161,8 +161,8 @@ func (c *ClusterTopologyBuilder) WithControlPlaneVariables(variables ...clusterv return c } -// WithControlPlaneMachineHealthCheck adds ControlPlaneTopologyMachineHealthCheck used as the MachineHealthCheck value. -func (c *ClusterTopologyBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneTopologyMachineHealthCheck) *ClusterTopologyBuilder { +// WithControlPlaneMachineHealthCheck adds ControlPlaneTopologyHealthCheck used as the MachineHealthCheck value. +func (c *ClusterTopologyBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneTopologyHealthCheck) *ClusterTopologyBuilder { c.controlPlaneMHC = mhc return c } @@ -216,7 +216,7 @@ type MachineDeploymentTopologyBuilder struct { class string name string replicas *int32 - mhc *clusterv1.MachineDeploymentTopologyMachineHealthCheck + mhc *clusterv1.MachineDeploymentTopologyHealthCheck variables []clusterv1.ClusterVariable } @@ -251,8 +251,8 @@ func (m *MachineDeploymentTopologyBuilder) WithVariables(variables ...clusterv1. return m } -// WithMachineHealthCheck adds MachineDeploymentTopologyMachineHealthCheck used as the MachineHealthCheck value. -func (m *MachineDeploymentTopologyBuilder) WithMachineHealthCheck(mhc *clusterv1.MachineDeploymentTopologyMachineHealthCheck) *MachineDeploymentTopologyBuilder { +// WithMachineHealthCheck adds MachineDeploymentTopologyHealthCheck used as the MachineHealthCheck value. +func (m *MachineDeploymentTopologyBuilder) WithMachineHealthCheck(mhc *clusterv1.MachineDeploymentTopologyHealthCheck) *MachineDeploymentTopologyBuilder { m.mhc = mhc return m } @@ -345,7 +345,7 @@ type ClusterClassBuilder struct { controlPlaneReadinessGates []clusterv1.MachineReadinessGate controlPlaneTemplate *unstructured.Unstructured controlPlaneInfrastructureMachineTemplate *unstructured.Unstructured - controlPlaneMHC *clusterv1.ControlPlaneClassMachineHealthCheck + controlPlaneMHC *clusterv1.ControlPlaneClassHealthCheck controlPlaneNodeDrainTimeout *int32 controlPlaneNodeVolumeDetachTimeout *int32 controlPlaneNodeDeletionTimeout *int32 @@ -401,7 +401,7 @@ func (c *ClusterClassBuilder) WithControlPlaneInfrastructureMachineTemplate(t *u } // WithControlPlaneMachineHealthCheck adds a MachineHealthCheck for the ControlPlane to the ClusterClassBuilder. -func (c *ClusterClassBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneClassMachineHealthCheck) *ClusterClassBuilder { +func (c *ClusterClassBuilder) WithControlPlaneMachineHealthCheck(mhc *clusterv1.ControlPlaneClassHealthCheck) *ClusterClassBuilder { c.controlPlaneMHC = mhc return c } @@ -548,7 +548,7 @@ type MachineDeploymentClassBuilder struct { bootstrapTemplate *unstructured.Unstructured labels map[string]string annotations map[string]string - machineHealthCheckClass *clusterv1.MachineDeploymentClassMachineHealthCheck + machineHealthCheckClass *clusterv1.MachineDeploymentClassHealthCheck readinessGates []clusterv1.MachineReadinessGate failureDomain *string nodeDrainTimeout *int32 @@ -591,7 +591,7 @@ func (m *MachineDeploymentClassBuilder) WithAnnotations(annotations map[string]s } // WithMachineHealthCheckClass sets the MachineHealthCheckClass for the MachineDeploymentClassBuilder. -func (m *MachineDeploymentClassBuilder) WithMachineHealthCheckClass(mhc *clusterv1.MachineDeploymentClassMachineHealthCheck) *MachineDeploymentClassBuilder { +func (m *MachineDeploymentClassBuilder) WithMachineHealthCheckClass(mhc *clusterv1.MachineDeploymentClassHealthCheck) *MachineDeploymentClassBuilder { m.machineHealthCheckClass = mhc return m } diff --git a/util/test/builder/zz_generated.deepcopy.go b/util/test/builder/zz_generated.deepcopy.go index bf62c91d1427..29ce805cc3aa 100644 --- a/util/test/builder/zz_generated.deepcopy.go +++ b/util/test/builder/zz_generated.deepcopy.go @@ -135,7 +135,7 @@ func (in *ClusterClassBuilder) DeepCopyInto(out *ClusterClassBuilder) { } if in.controlPlaneMHC != nil { in, out := &in.controlPlaneMHC, &out.controlPlaneMHC - *out = new(v1beta2.ControlPlaneClassMachineHealthCheck) + *out = new(v1beta2.ControlPlaneClassHealthCheck) (*in).DeepCopyInto(*out) } if in.controlPlaneNodeDrainTimeout != nil { @@ -223,7 +223,7 @@ func (in *ClusterTopologyBuilder) DeepCopyInto(out *ClusterTopologyBuilder) { in.workers.DeepCopyInto(&out.workers) if in.controlPlaneMHC != nil { in, out := &in.controlPlaneMHC, &out.controlPlaneMHC - *out = new(v1beta2.ControlPlaneTopologyMachineHealthCheck) + *out = new(v1beta2.ControlPlaneTopologyHealthCheck) (*in).DeepCopyInto(*out) } if in.variables != nil { @@ -533,7 +533,7 @@ func (in *MachineDeploymentClassBuilder) DeepCopyInto(out *MachineDeploymentClas } if in.machineHealthCheckClass != nil { in, out := &in.machineHealthCheckClass, &out.machineHealthCheckClass - *out = new(v1beta2.MachineDeploymentClassMachineHealthCheck) + *out = new(v1beta2.MachineDeploymentClassHealthCheck) (*in).DeepCopyInto(*out) } if in.readinessGates != nil { @@ -601,7 +601,7 @@ func (in *MachineDeploymentTopologyBuilder) DeepCopyInto(out *MachineDeploymentT } if in.mhc != nil { in, out := &in.mhc, &out.mhc - *out = new(v1beta2.MachineDeploymentTopologyMachineHealthCheck) + *out = new(v1beta2.MachineDeploymentTopologyHealthCheck) (*in).DeepCopyInto(*out) } if in.variables != nil { From 9194d44e0a0f6b205733ab6da4463ac89d65a54c Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 21 Jul 2025 13:38:48 +0200 Subject: [PATCH 5/7] Add migration documentation --- .../providers/migrations/v1.10-to-v1.11.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md b/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md index d42e12e34c89..64f56026b239 100644 --- a/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md +++ b/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md @@ -143,6 +143,49 @@ When looking at API changes introduced in the v1beta2 API version for each CRD i ### Cluster + + + + + + + + +
v1beta1 v1beta2
+ +```yaml +spec: + topology: + controlPlane: + machineHealthCheck: + enable: true + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + maxUnhealthy: "80%" + unhealthyRange: "[1-4]" + remediationTemplate: {...} +``` + + + +```yaml +spec: + topology: + controlPlane: + healthCheck: + enabled: true + checks: + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + remediation: + triggerIf: + unhealthyLessThanOrEqualTo: "80%" + unhealthyInRange: "[1-4]" + templateRef: {...} +``` + +
+ - See changes that apply to [all CRDs](#all-crds) - The type of the `spec.paused` field has been changed from `bool` to `*bool`(compliance with K8s API guidelines) - The `spec.controlPlaneRef` and `spec.infrastructureRef` fields are now using `ContractVersionedObjectReference` type instead @@ -163,6 +206,10 @@ When looking at API changes introduced in the v1beta2 API version for each CRD i - `spec.topology.workers.machineDeployments[].variables.overrides[]` - `spec.topology.workers.machinePools[].variables.overrides[]` - The type of the `spec.workers` field has been changed from `*WorkersTopology` to `WorkersTopology` (drop unnecessary pointers) +- The `spec.topology.controlPlane.healthCheck` field, previously `spec.topology.controlPlane.machineHealthCheck`, has been restructured + and made consistent across all resources. Notably fields for checks and remediation are now well identified under corresponding fields. + The Go structs have been modified accordingly. For more details see YAML above (improve consistency). + - The same change has been applied to `spec.topology.workers.machineDeployments[].healthCheck`, previously `spec.topology.workers.machineDeployments[].machineHealthCheck` - The type of the `spec.topology.controlPlane.variables` field has been changed from `*ControlPlaneVariables` to `ControlPlaneVariables` (drop unnecessary pointers) - The type of the `spec.topology.workers.machineDeployments[].failureDomain` field has been changed from `*string` to `string` (drop unnecessary pointers) - The type of the `spec.topology.workers.machineDeployments[].strategy` field has been changed from `*MachineDeploymentStrategy` to `MachineDeploymentStrategy` (drop unnecessary pointers) @@ -318,6 +365,42 @@ When looking at API changes introduced in the v1beta2 API version for each CRD i ### MachineHealthCheck + + + + + + + + + +
v1beta1 v1beta2
+ +```yaml +spec: + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + maxUnhealthy: "80%" + unhealthyRange: "[1-4]" + remediationTemplate: {...} +``` + + + +```yaml +spec: + checks: + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + remediation: + triggerIf: + unhealthyLessThanOrEqualTo: "80%" + unhealthyInRange: "[1-4]" + templateRef: {...} +``` + +
+ - See changes that apply to [all CRDs](#all-crds) - All fields of type Duration in `spec` have been renamed by adding the `Seconds` suffix and their type was changed to int32 (compliance with K8s API guidelines) @@ -333,12 +416,54 @@ When looking at API changes introduced in the v1beta2 API version for each CRD i - the old `status.conditions` based on custom cluster API condition types will continue to exist temporarily under `status.deprecated.v1beta1.conditions` for the sake of down conversions and to provide a temporary option for users willing to continue using old conditions. +- The `spec` has been restructured and made consistent across all resources. Notably fields for checks and remediation + are now well identified under corresponding fields. + The Go structs have been modified accordingly. For more details see YAML above (improve consistency). - The type of the `status.expectedMachines` field has been changed from `*int32` to `int32` (drop unnecessary pointers) - The type of the `status.currentHealthy` field has been changed from `*int32` to `int32` (drop unnecessary pointers) - The type of the `status.remediationsAllowed` field has been changed from `*int32` to `int32` (drop unnecessary pointers) ### ClusterClass + + + + + + + + +
v1beta1 v1beta2
+ +```yaml +spec: + controlPlane: + machineHealthCheck: + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + maxUnhealthy: "80%" + unhealthyRange: "[1-4]" + remediationTemplate: {...} +``` + + + +```yaml +spec: + controlPlane: + healthCheck: + checks: + nodeStartupTimeoutSeconds: 300 + unhealthyNodeConditions: [...] + remediation: + triggerIf: + unhealthyLessThanOrEqualTo: "80%" + unhealthyInRange: "[1-4]" + templateRef: {...} +``` + +
+ - See changes that apply to [all CRDs](#all-crds) - The `spec.patches[].external.generateExtension` and `spec.patches[].external.validateExtension` fields have been renamed to `spec.patches[].external.generatePatchesExtension` and `spec.patches[].external.validateTopologyExtension` (improve consistency) @@ -368,6 +493,10 @@ When looking at API changes introduced in the v1beta2 API version for each CRD i - `spec.workers.machinePool[].bootstrap.templateRef`, previously `spec.workers.machinePool[].bootstrap.template.ref` - `spec.workers.machinePool[].infrastructure.templateRef`, previously `spec.workers.machinePool[].infrastructure.template.ref` - For all the above, the following fields have been removed from `*.ref`: `namespace`, `uid`, `resourceVersion`, `fieldPath` +- The `spec.controlPlane.healthCheck` field, previously `spec.controlPlane.machineHealthCheck`, has been restructured + and made consistent across all resources. Notably fields for checks and remediation are now well identified under corresponding fields. + The Go structs have been modified accordingly. For more details see YAML above (improve consistency). + - The same change has been applied to `spec.workers.machineDeployments[].healthCheck`, previously `spec.workers.machineDeployments[].machineHealthCheck` - The `spec.workers.machineDeployments[].template.metadata` field has been moved to `spec.workers.machineDeployments[].metadata` (drop unnecessary nested struct) - The `spec.workers.machinePools[].template.metadata` field has been moved to `spec.workers.machinePools[].metadata` (drop unnecessary nested struct) - The type of the `spec.infrastructure.namingStrategy.template` field has been changed from `*string` to `string` (drop unnecessary pointers) From e4ed9621a9d815d378481c74f033bff553ec0aee Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 21 Jul 2025 13:56:41 +0200 Subject: [PATCH 6/7] Improve godoc --- api/core/v1beta2/cluster_types.go | 18 ++++++++++ api/core/v1beta2/clusterclass_types.go | 18 ++++++++++ api/core/v1beta2/machinehealthcheck_types.go | 9 +++++ api/core/v1beta2/zz_generated.openapi.go | 20 +++++------ .../cluster.x-k8s.io_clusterclasses.yaml | 34 ++++++++++++++----- .../crd/bases/cluster.x-k8s.io_clusters.yaml | 34 ++++++++++++++----- .../cluster.x-k8s.io_machinehealthchecks.yaml | 17 +++++++--- 7 files changed, 120 insertions(+), 30 deletions(-) diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index fe3dddc56190..ecab85e3fb28 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -657,10 +657,19 @@ type ControlPlaneTopologyHealthCheck struct { Enabled *bool `json:"enabled,omitempty"` // checks are the checks that are used to evaluate if a Machine is healthy. + // Even if checks is not set, the MachineHealthCheck controller will still + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // is defaulted to 10 minutes and evaluated accordingly. // +optional Checks ControlPlaneTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // If remediation is not set (and thus triggerIf is not set), remediation will always be + // triggered for unhealthy Machines. + // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + // for example a MachineSet or a KubeadmControlPlane. // +optional Remediation ControlPlaneTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } @@ -882,10 +891,19 @@ type MachineDeploymentTopologyHealthCheck struct { Enabled *bool `json:"enabled,omitempty"` // checks are the checks that are used to evaluate if a Machine is healthy. + // Even if checks is not set, the MachineHealthCheck controller will still + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // is defaulted to 10 minutes and evaluated accordingly. // +optional Checks MachineDeploymentTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // If remediation is not set (and thus triggerIf is not set), remediation will always be + // triggered for unhealthy Machines. + // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + // for example a MachineSet or a KubeadmControlPlane. // +optional Remediation MachineDeploymentTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/clusterclass_types.go b/api/core/v1beta2/clusterclass_types.go index b96b41aafe12..f81095e62fcc 100644 --- a/api/core/v1beta2/clusterclass_types.go +++ b/api/core/v1beta2/clusterclass_types.go @@ -202,10 +202,19 @@ type ControlPlaneClass struct { // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. + // Even if checks is not set, the MachineHealthCheck controller will still + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // is defaulted to 10 minutes and evaluated accordingly. // +optional Checks ControlPlaneClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // If remediation is not set (and thus triggerIf is not set), remediation will always be + // triggered for unhealthy Machines. + // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + // for example a MachineSet or a KubeadmControlPlane. // +optional Remediation ControlPlaneClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } @@ -439,10 +448,19 @@ type MachineDeploymentClass struct { // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. + // Even if checks is not set, the MachineHealthCheck controller will still + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // is defaulted to 10 minutes and evaluated accordingly. // +optional Checks MachineDeploymentClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // If remediation is not set (and thus triggerIf is not set), remediation will always be + // triggered for unhealthy Machines. + // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + // for example a MachineSet or a KubeadmControlPlane. // +optional Remediation MachineDeploymentClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/machinehealthcheck_types.go b/api/core/v1beta2/machinehealthcheck_types.go index 82d95e95e34c..b67d0c84e914 100644 --- a/api/core/v1beta2/machinehealthcheck_types.go +++ b/api/core/v1beta2/machinehealthcheck_types.go @@ -61,10 +61,19 @@ type MachineHealthCheckSpec struct { Selector metav1.LabelSelector `json:"selector"` // checks are the checks that are used to evaluate if a Machine is healthy. + // Even if checks is not set, the MachineHealthCheck controller will still + // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // is defaulted to 10 minutes and evaluated accordingly. // +optional Checks MachineHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. + // If remediation is not set (and thus triggerIf is not set), remediation will always be + // triggered for unhealthy Machines. + // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + // for example a MachineSet or a KubeadmControlPlane. // +optional Remediation MachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/zz_generated.openapi.go b/api/core/v1beta2/zz_generated.openapi.go index dd6cc023c3dc..f0735704a5bc 100644 --- a/api/core/v1beta2/zz_generated.openapi.go +++ b/api/core/v1beta2/zz_generated.openapi.go @@ -1562,14 +1562,14 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheck(ref common Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediation"), }, @@ -1843,14 +1843,14 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheck(ref com }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediation"), }, @@ -2865,14 +2865,14 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheck(ref c Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediation"), }, @@ -3489,14 +3489,14 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheck(re }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediation"), }, @@ -4280,14 +4280,14 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref common.Refer }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation"), }, diff --git a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml index f202b8bf1815..624989072c4b 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml @@ -2932,8 +2932,12 @@ spec: minProperties: 1 properties: checks: - description: checks are the checks that are used to evaluate - if a Machine is healthy. + description: |- + checks are the checks that are used to evaluate if a Machine is healthy. + Even if checks is not set, the MachineHealthCheck controller will still + flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: nodeStartupTimeoutSeconds: @@ -2993,8 +2997,13 @@ spec: x-kubernetes-list-type: atomic type: object remediation: - description: remediation configures if and how remediations - are triggered if a Machine is unhealthy. + description: |- + remediation configures if and how remediations are triggered if a Machine is unhealthy. + If remediation is not set (and thus triggerIf is not set), remediation will always be + triggered for unhealthy Machines. + If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: @@ -4044,8 +4053,12 @@ spec: minProperties: 1 properties: checks: - description: checks are the checks that are used to - evaluate if a Machine is healthy. + description: |- + checks are the checks that are used to evaluate if a Machine is healthy. + Even if checks is not set, the MachineHealthCheck controller will still + flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: nodeStartupTimeoutSeconds: @@ -4105,8 +4118,13 @@ spec: x-kubernetes-list-type: atomic type: object remediation: - description: remediation configures if and how remediations - are triggered if a Machine is unhealthy. + description: |- + remediation configures if and how remediations are triggered if a Machine is unhealthy. + If remediation is not set (and thus triggerIf is not set), remediation will always be + triggered for unhealthy Machines. + If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index 7b865435b17a..6cc636fb2acf 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -2447,8 +2447,12 @@ spec: minProperties: 1 properties: checks: - description: checks are the checks that are used to evaluate - if a Machine is healthy. + description: |- + checks are the checks that are used to evaluate if a Machine is healthy. + Even if checks is not set, the MachineHealthCheck controller will still + flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: nodeStartupTimeoutSeconds: @@ -2520,8 +2524,13 @@ spec: block if `enable` is true and no MachineHealthCheck definition is available. type: boolean remediation: - description: remediation configures if and how remediations - are triggered if a Machine is unhealthy. + description: |- + remediation configures if and how remediations are triggered if a Machine is unhealthy. + If remediation is not set (and thus triggerIf is not set), remediation will always be + triggered for unhealthy Machines. + If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: @@ -2817,8 +2826,12 @@ spec: minProperties: 1 properties: checks: - description: checks are the checks that are used - to evaluate if a Machine is healthy. + description: |- + checks are the checks that are used to evaluate if a Machine is healthy. + Even if checks is not set, the MachineHealthCheck controller will still + flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: nodeStartupTimeoutSeconds: @@ -2890,8 +2903,13 @@ spec: block if `enable` is true and no MachineHealthCheck definition is available. type: boolean remediation: - description: remediation configures if and how remediations - are triggered if a Machine is unhealthy. + description: |- + remediation configures if and how remediations are triggered if a Machine is unhealthy. + If remediation is not set (and thus triggerIf is not set), remediation will always be + triggered for unhealthy Machines. + If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: diff --git a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml index 6172f68b0731..3b8a06297895 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml @@ -1036,8 +1036,12 @@ spec: description: spec is the specification of machine health check policy properties: checks: - description: checks are the checks that are used to evaluate if a - Machine is healthy. + description: |- + checks are the checks that are used to evaluate if a Machine is healthy. + Even if checks is not set, the MachineHealthCheck controller will still + flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and + Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: nodeStartupTimeoutSeconds: @@ -1103,8 +1107,13 @@ spec: minLength: 1 type: string remediation: - description: remediation configures if and how remediations are triggered - if a Machine is unhealthy. + description: |- + remediation configures if and how remediations are triggered if a Machine is unhealthy. + If remediation is not set (and thus triggerIf is not set), remediation will always be + triggered for unhealthy Machines. + If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition + will be set on unhealthy Machines to trigger remediation via the owner of the Machines, + for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: From c81ae92dcefb94408e92a885f5c30eec41ac5fc6 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Tue, 22 Jul 2025 09:39:13 +0200 Subject: [PATCH 7/7] Adjust godoc comments --- api/core/v1beta2/cluster_types.go | 58 ++++++++++++++----- api/core/v1beta2/clusterclass_types.go | 42 +++++++++----- api/core/v1beta2/machinehealthcheck_types.go | 21 ++++--- api/core/v1beta2/zz_generated.openapi.go | 20 +++---- .../cluster.x-k8s.io_clusterclasses.yaml | 38 +++++++----- .../crd/bases/cluster.x-k8s.io_clusters.yaml | 54 ++++++++++++----- .../cluster.x-k8s.io_machinehealthchecks.yaml | 19 +++--- 7 files changed, 172 insertions(+), 80 deletions(-) diff --git a/api/core/v1beta2/cluster_types.go b/api/core/v1beta2/cluster_types.go index ecab85e3fb28..15ba5cc50b4a 100644 --- a/api/core/v1beta2/cluster_types.go +++ b/api/core/v1beta2/cluster_types.go @@ -657,19 +657,34 @@ type ControlPlaneTopologyHealthCheck struct { Enabled *bool `json:"enabled,omitempty"` // checks are the checks that are used to evaluate if a Machine is healthy. - // Even if checks is not set, the MachineHealthCheck controller will still + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from Cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // Independent of this configuration the MachineHealthCheck controller will always // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it // is defaulted to 10 minutes and evaluated accordingly. + // // +optional Checks ControlPlaneTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. - // If remediation is not set (and thus triggerIf is not set), remediation will always be - // triggered for unhealthy Machines. - // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - // for example a MachineSet or a KubeadmControlPlane. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // If an health check override is defined and remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If an health check override is defined and remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + // // +optional Remediation ControlPlaneTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } @@ -891,19 +906,34 @@ type MachineDeploymentTopologyHealthCheck struct { Enabled *bool `json:"enabled,omitempty"` // checks are the checks that are used to evaluate if a Machine is healthy. - // Even if checks is not set, the MachineHealthCheck controller will still + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from Cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // Independent of this configuration the MachineHealthCheck controller will always // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it // is defaulted to 10 minutes and evaluated accordingly. + // // +optional Checks MachineDeploymentTopologyHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. - // If remediation is not set (and thus triggerIf is not set), remediation will always be - // triggered for unhealthy Machines. - // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - // for example a MachineSet or a KubeadmControlPlane. + // + // If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + // and as a consequence the checks and remediation fields from cluster will be used instead of the + // corresponding fields in ClusterClass. + // + // If an health check override is defined and remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If an health check override is defined and remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + // // +optional Remediation MachineDeploymentTopologyHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/clusterclass_types.go b/api/core/v1beta2/clusterclass_types.go index f81095e62fcc..6dc3dddae1a9 100644 --- a/api/core/v1beta2/clusterclass_types.go +++ b/api/core/v1beta2/clusterclass_types.go @@ -202,19 +202,26 @@ type ControlPlaneClass struct { // +kubebuilder:validation:MinProperties=1 type ControlPlaneClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. - // Even if checks is not set, the MachineHealthCheck controller will still + // + // Independent of this configuration the MachineHealthCheck controller will always // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it // is defaulted to 10 minutes and evaluated accordingly. + // // +optional Checks ControlPlaneClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. - // If remediation is not set (and thus triggerIf is not set), remediation will always be - // triggered for unhealthy Machines. - // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - // for example a MachineSet or a KubeadmControlPlane. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + // // +optional Remediation ControlPlaneClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } @@ -448,19 +455,26 @@ type MachineDeploymentClass struct { // +kubebuilder:validation:MinProperties=1 type MachineDeploymentClassHealthCheck struct { // checks are the checks that are used to evaluate if a Machine is healthy. - // Even if checks is not set, the MachineHealthCheck controller will still + // + // Independent of this configuration the MachineHealthCheck controller will always // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it // is defaulted to 10 minutes and evaluated accordingly. + // // +optional Checks MachineDeploymentClassHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. - // If remediation is not set (and thus triggerIf is not set), remediation will always be - // triggered for unhealthy Machines. - // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - // for example a MachineSet or a KubeadmControlPlane. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + // // +optional Remediation MachineDeploymentClassHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/machinehealthcheck_types.go b/api/core/v1beta2/machinehealthcheck_types.go index b67d0c84e914..1fdb10768661 100644 --- a/api/core/v1beta2/machinehealthcheck_types.go +++ b/api/core/v1beta2/machinehealthcheck_types.go @@ -61,19 +61,26 @@ type MachineHealthCheckSpec struct { Selector metav1.LabelSelector `json:"selector"` // checks are the checks that are used to evaluate if a Machine is healthy. - // Even if checks is not set, the MachineHealthCheck controller will still + // + // Independent of this configuration the MachineHealthCheck controller will always // flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - // Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + // Machines with deleted Nodes as unhealthy. + // + // Furthermore, if checks.nodeStartupTimeoutSeconds is not set it // is defaulted to 10 minutes and evaluated accordingly. + // // +optional Checks MachineHealthCheckChecks `json:"checks,omitempty,omitzero"` // remediation configures if and how remediations are triggered if a Machine is unhealthy. - // If remediation is not set (and thus triggerIf is not set), remediation will always be - // triggered for unhealthy Machines. - // If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - // will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - // for example a MachineSet or a KubeadmControlPlane. + // + // If remediation or remediation.triggerIf is not set, + // remediation will always be triggered for unhealthy Machines. + // + // If remediation or remediation.templateRef is not set, + // the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + // the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. + // // +optional Remediation MachineHealthCheckRemediation `json:"remediation,omitempty,omitzero"` } diff --git a/api/core/v1beta2/zz_generated.openapi.go b/api/core/v1beta2/zz_generated.openapi.go index f0735704a5bc..e903b3e2786c 100644 --- a/api/core/v1beta2/zz_generated.openapi.go +++ b/api/core/v1beta2/zz_generated.openapi.go @@ -1562,14 +1562,14 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneClassHealthCheck(ref common Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIndependent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf remediation or remediation.triggerIf is not set, remediation will always be triggered for unhealthy Machines.\n\nIf remediation or remediation.templateRef is not set, the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneClassHealthCheckRemediation"), }, @@ -1843,14 +1843,14 @@ func schema_cluster_api_api_core_v1beta2_ControlPlaneTopologyHealthCheck(ref com }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIf one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, and as a consequence the checks and remediation fields from Cluster will be used instead of the corresponding fields in ClusterClass.\n\nIndependent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, and as a consequence the checks and remediation fields from cluster will be used instead of the corresponding fields in ClusterClass.\n\nIf an health check override is defined and remediation or remediation.triggerIf is not set, remediation will always be triggered for unhealthy Machines.\n\nIf an health check override is defined and remediation or remediation.templateRef is not set, the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.ControlPlaneTopologyHealthCheckRemediation"), }, @@ -2865,14 +2865,14 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentClassHealthCheck(ref c Properties: map[string]spec.Schema{ "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIndependent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf remediation or remediation.triggerIf is not set, remediation will always be triggered for unhealthy Machines.\n\nIf remediation or remediation.templateRef is not set, the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentClassHealthCheckRemediation"), }, @@ -3489,14 +3489,14 @@ func schema_cluster_api_api_core_v1beta2_MachineDeploymentTopologyHealthCheck(re }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIf one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, and as a consequence the checks and remediation fields from Cluster will be used instead of the corresponding fields in ClusterClass.\n\nIndependent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, and as a consequence the checks and remediation fields from cluster will be used instead of the corresponding fields in ClusterClass.\n\nIf an health check override is defined and remediation or remediation.triggerIf is not set, remediation will always be triggered for unhealthy Machines.\n\nIf an health check override is defined and remediation or remediation.templateRef is not set, the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineDeploymentTopologyHealthCheckRemediation"), }, @@ -4280,14 +4280,14 @@ func schema_cluster_api_api_core_v1beta2_MachineHealthCheckSpec(ref common.Refer }, "checks": { SchemaProps: spec.SchemaProps{ - Description: "checks are the checks that are used to evaluate if a Machine is healthy. Even if checks is not set, the MachineHealthCheck controller will still flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds is defaulted to 10 minutes and evaluated accordingly.", + Description: "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIndependent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and Machines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckChecks"), }, }, "remediation": { SchemaProps: spec.SchemaProps{ - Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy. If remediation is not set (and thus triggerIf is not set), remediation will always be triggered for unhealthy Machines. If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", + Description: "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf remediation or remediation.triggerIf is not set, remediation will always be triggered for unhealthy Machines.\n\nIf remediation or remediation.templateRef is not set, the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via the owner of the Machines, for example a MachineSet or a KubeadmControlPlane.", Default: map[string]interface{}{}, Ref: ref("sigs.k8s.io/cluster-api/api/core/v1beta2.MachineHealthCheckRemediation"), }, diff --git a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml index 624989072c4b..52aa197aea6d 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml @@ -2934,9 +2934,12 @@ spec: checks: description: |- checks are the checks that are used to evaluate if a Machine is healthy. - Even if checks is not set, the MachineHealthCheck controller will still + + Independent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + Machines with deleted Nodes as unhealthy. + + Furthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: @@ -2999,11 +3002,13 @@ spec: remediation: description: |- remediation configures if and how remediations are triggered if a Machine is unhealthy. - If remediation is not set (and thus triggerIf is not set), remediation will always be - triggered for unhealthy Machines. - If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - for example a MachineSet or a KubeadmControlPlane. + + If remediation or remediation.triggerIf is not set, + remediation will always be triggered for unhealthy Machines. + + If remediation or remediation.templateRef is not set, + the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: @@ -4055,9 +4060,12 @@ spec: checks: description: |- checks are the checks that are used to evaluate if a Machine is healthy. - Even if checks is not set, the MachineHealthCheck controller will still + + Independent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + Machines with deleted Nodes as unhealthy. + + Furthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: @@ -4120,11 +4128,13 @@ spec: remediation: description: |- remediation configures if and how remediations are triggered if a Machine is unhealthy. - If remediation is not set (and thus triggerIf is not set), remediation will always be - triggered for unhealthy Machines. - If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - for example a MachineSet or a KubeadmControlPlane. + + If remediation or remediation.triggerIf is not set, + remediation will always be triggered for unhealthy Machines. + + If remediation or remediation.templateRef is not set, + the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index 6cc636fb2acf..98eeb9d4fd14 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -2449,9 +2449,16 @@ spec: checks: description: |- checks are the checks that are used to evaluate if a Machine is healthy. - Even if checks is not set, the MachineHealthCheck controller will still + + If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + and as a consequence the checks and remediation fields from Cluster will be used instead of the + corresponding fields in ClusterClass. + + Independent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + Machines with deleted Nodes as unhealthy. + + Furthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: @@ -2526,11 +2533,17 @@ spec: remediation: description: |- remediation configures if and how remediations are triggered if a Machine is unhealthy. - If remediation is not set (and thus triggerIf is not set), remediation will always be - triggered for unhealthy Machines. - If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - for example a MachineSet or a KubeadmControlPlane. + + If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + and as a consequence the checks and remediation fields from cluster will be used instead of the + corresponding fields in ClusterClass. + + If an health check override is defined and remediation or remediation.triggerIf is not set, + remediation will always be triggered for unhealthy Machines. + + If an health check override is defined and remediation or remediation.templateRef is not set, + the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: @@ -2828,9 +2841,16 @@ spec: checks: description: |- checks are the checks that are used to evaluate if a Machine is healthy. - Even if checks is not set, the MachineHealthCheck controller will still + + If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + and as a consequence the checks and remediation fields from Cluster will be used instead of the + corresponding fields in ClusterClass. + + Independent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + Machines with deleted Nodes as unhealthy. + + Furthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: @@ -2905,11 +2925,17 @@ spec: remediation: description: |- remediation configures if and how remediations are triggered if a Machine is unhealthy. - If remediation is not set (and thus triggerIf is not set), remediation will always be - triggered for unhealthy Machines. - If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - for example a MachineSet or a KubeadmControlPlane. + + If one of checks and remediation fields are set, the system assumes that an healthCheck override is defined, + and as a consequence the checks and remediation fields from cluster will be used instead of the + corresponding fields in ClusterClass. + + If an health check override is defined and remediation or remediation.triggerIf is not set, + remediation will always be triggered for unhealthy Machines. + + If an health check override is defined and remediation or remediation.templateRef is not set, + the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: diff --git a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml index 3b8a06297895..bd83a1a7fa38 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml @@ -1038,9 +1038,12 @@ spec: checks: description: |- checks are the checks that are used to evaluate if a Machine is healthy. - Even if checks is not set, the MachineHealthCheck controller will still + + Independent of this configuration the MachineHealthCheck controller will always flag Machines with `cluster.x-k8s.io/remediate-machine` annotation and - Machines with deleted Nodes as unhealthy. Furthermore, nodeStartupTimeoutSeconds + Machines with deleted Nodes as unhealthy. + + Furthermore, if checks.nodeStartupTimeoutSeconds is not set it is defaulted to 10 minutes and evaluated accordingly. minProperties: 1 properties: @@ -1109,11 +1112,13 @@ spec: remediation: description: |- remediation configures if and how remediations are triggered if a Machine is unhealthy. - If remediation is not set (and thus triggerIf is not set), remediation will always be - triggered for unhealthy Machines. - If remediation is not set (and thus templateRef is not set), the OwnerRemediated condition - will be set on unhealthy Machines to trigger remediation via the owner of the Machines, - for example a MachineSet or a KubeadmControlPlane. + + If remediation or remediation.triggerIf is not set, + remediation will always be triggered for unhealthy Machines. + + If remediation or remediation.templateRef is not set, + the OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via + the owner of the Machines, for example a MachineSet or a KubeadmControlPlane. minProperties: 1 properties: templateRef: