From a48485eded66446ed6734821998b6727d8c5fd3f Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Thu, 17 Oct 2024 11:57:54 +0200 Subject: [PATCH] Remove unused Paused conditions & minor MHC godoc fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- api/v1beta1/machine_types.go | 8 ++++---- api/v1beta1/machinehealthcheck_types.go | 6 ------ api/v1beta1/v1beta2_condition_consts.go | 12 ------------ .../kubeadm/api/v1beta1/v1beta2_condition_consts.go | 3 --- exp/addons/api/v1beta1/v1beta2_condition_consts.go | 3 --- exp/api/v1beta1/v1beta2_condition_consts.go | 3 --- .../machinehealthcheck_controller.go | 2 +- .../machinehealthcheck_controller_test.go | 4 ++-- .../docker/api/v1beta1/v1beta2_condition_consts.go | 6 ------ 9 files changed, 7 insertions(+), 40 deletions(-) diff --git a/api/v1beta1/machine_types.go b/api/v1beta1/machine_types.go index 723ce8a88a61..609d6f19c7d3 100644 --- a/api/v1beta1/machine_types.go +++ b/api/v1beta1/machine_types.go @@ -224,12 +224,12 @@ const ( // the timeout defined by a MachineHealthCheck object. MachineHealthCheckNodeStartupTimeoutV1Beta2Reason = "NodeStartupTimeout" - // MachineHealthCheckNodeDeletedV1Beta2Reason surfaces when a MachineHealthCheck detect that the node hosted on the + // MachineHealthCheckNodeDeletedV1Beta2Reason surfaces when a MachineHealthCheck detects that the node hosted on the // machine has been deleted while the Machine is still running. MachineHealthCheckNodeDeletedV1Beta2Reason = "NodeDeleted" - // MachineHealthCheckHasRemediateAnnotationV1Beta2Reason surfaces a MachineHealthCheck detects a machine manually remediated - // via the remediate-machine annotation. + // MachineHealthCheckHasRemediateAnnotationV1Beta2Reason surfaces when a MachineHealthCheck detects that a Machine was + // marked for remediation via the `cluster.x-k8s.io/remediate-machine` annotation. MachineHealthCheckHasRemediateAnnotationV1Beta2Reason = "HasRemediateAnnotation" ) @@ -259,7 +259,7 @@ const ( MachineExternallyRemediatedWaitingForRemediationV1Beta2Reason = "WaitingForRemediation" // MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason surfaces that the MachineHealthCheck cannot - // find the template for a external remediation request. + // find the template for an external remediation request. MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason = "RemediationTemplateNotFound" // MachineExternallyRemediatedRemediationRequestCreationFailedV1Beta2Reason surfaces that the MachineHealthCheck cannot diff --git a/api/v1beta1/machinehealthcheck_types.go b/api/v1beta1/machinehealthcheck_types.go index 27614b351de0..837ea0fe7678 100644 --- a/api/v1beta1/machinehealthcheck_types.go +++ b/api/v1beta1/machinehealthcheck_types.go @@ -39,12 +39,6 @@ const ( MachineHealthCheckRemediationAllowedV1Beta2Reason = "RemediationAllowed" ) -// MachineHealthCheck's Paused condition and corresponding reasons that will be used in v1Beta2 API version. -const ( - // MachineHealthCheckPausedV1Beta2Condition is true if this MachineHealthCheck or the Cluster it belongs to are paused. - MachineHealthCheckPausedV1Beta2Condition = PausedV1Beta2Condition -) - var ( // DefaultNodeStartupTimeout is the time allowed for a node to start up. // Can be made longer as part of spec if required for particular provider. diff --git a/api/v1beta1/v1beta2_condition_consts.go b/api/v1beta1/v1beta2_condition_consts.go index c6f72d41a482..813a5cf566d4 100644 --- a/api/v1beta1/v1beta2_condition_consts.go +++ b/api/v1beta1/v1beta2_condition_consts.go @@ -133,9 +133,6 @@ const ( // MachineSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. MachineSetDeletingV1Beta2Condition = DeletingV1Beta2Condition - - // MachineSetPausedV1Beta2Condition is true if this MachineSet or the Cluster it belongs to are paused. - MachineSetPausedV1Beta2Condition = PausedV1Beta2Condition ) // Conditions that will be used for the MachineDeployment object in v1Beta2 API version. @@ -162,9 +159,6 @@ const ( // MachineDeploymentDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. MachineDeploymentDeletingV1Beta2Condition = DeletingV1Beta2Condition - - // MachineDeploymentPausedV1Beta2Condition is true if this MachineDeployment or the Cluster it belongs to are paused. - MachineDeploymentPausedV1Beta2Condition = PausedV1Beta2Condition ) // Conditions that will be used for the Cluster object in v1Beta2 API version. @@ -220,9 +214,6 @@ const ( // ClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the cluster. ClusterDeletingV1Beta2Condition = DeletingV1Beta2Condition - - // ClusterPausedV1Beta2Condition is true if Cluster and all the resources being part of it are paused. - ClusterPausedV1Beta2Condition = PausedV1Beta2Condition ) // Conditions that will be used for the ClusterClass object in v1Beta2 API version. @@ -236,7 +227,4 @@ const ( // up-to-date (i.e. they are using the latest apiVersion of the current Cluster API contract from // the corresponding CRD). ClusterClassRefVersionsUpToDateV1Beta2Condition = "RefVersionsUpToDate" - - // ClusterClassPausedV1Beta2Condition is true if this ClusterClass is paused. - ClusterClassPausedV1Beta2Condition = PausedV1Beta2Condition ) diff --git a/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go b/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go index 81faa410f14a..b81e7f902c8a 100644 --- a/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go +++ b/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go @@ -51,9 +51,6 @@ const ( // KubeadmControlPlaneDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. KubeadmControlPlaneDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition - - // KubeadmControlPlanePausedV1Beta2Condition is true if this resource or the Cluster it belongs to are paused. - KubeadmControlPlanePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition ) // Conditions that will be used for the KubeadmControlPlane controlled machines in v1Beta2 API version. diff --git a/exp/addons/api/v1beta1/v1beta2_condition_consts.go b/exp/addons/api/v1beta1/v1beta2_condition_consts.go index 89fd06a33884..7a0fddfece05 100644 --- a/exp/addons/api/v1beta1/v1beta2_condition_consts.go +++ b/exp/addons/api/v1beta1/v1beta2_condition_consts.go @@ -26,7 +26,4 @@ const ( // ClusterResourceSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the ClusterResourceSet. ClusterResourceSetDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition - - // ClusterResourceSetPausedV1Beta2Condition is true if this ClusterResourceSet is paused. - ClusterResourceSetPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition ) diff --git a/exp/api/v1beta1/v1beta2_condition_consts.go b/exp/api/v1beta1/v1beta2_condition_consts.go index 87a4b44a4604..fccd1c34fb48 100644 --- a/exp/api/v1beta1/v1beta2_condition_consts.go +++ b/exp/api/v1beta1/v1beta2_condition_consts.go @@ -46,7 +46,4 @@ const ( // MachinePoolDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. MachinePoolDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition - - // MachinePoolPausedV1Beta2Condition is true if this MachinePool or the Cluster it belongs to are paused. - MachinePoolPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition ) diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go b/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go index c6a46adaa101..9eb380353cb6 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_controller.go @@ -418,7 +418,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg Type: clusterv1.MachineExternallyRemediatedV1Beta2Condition, Status: metav1.ConditionFalse, Reason: clusterv1.MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason, - Message: fmt.Sprintf("error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(t.Machine.Namespace, m.Spec.RemediationTemplate.Name)), + Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(t.Machine.Namespace, m.Spec.RemediationTemplate.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)) return errList diff --git a/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go b/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go index 2b47f4a40912..9edb453de8df 100644 --- a/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go +++ b/internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go @@ -661,7 +661,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { }).Should(Equal(1)) }) - t.Run("it marks unhealthy machines for remediation when the unhealthy Machines exceed MaxUnhealthy", func(t *testing.T) { + t.Run("it doesn't mark unhealthy machines for remediation when the unhealthy Machines exceed MaxUnhealthy", func(t *testing.T) { g := NewWithT(t) cluster := createCluster(g, ns.Name) @@ -807,7 +807,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) { assertMachinesOwnerRemediated(g, mhc, 1) }) - t.Run("it marks unhealthy machines for remediation when the unhealthy Machines is not within UnhealthyRange", func(t *testing.T) { + t.Run("it doesn't mark unhealthy machines for remediation when the unhealthy Machines is not within UnhealthyRange", func(t *testing.T) { g := NewWithT(t) cluster := createCluster(g, ns.Name) diff --git a/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go b/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go index 974e8cb6a787..3ac5acadbb59 100644 --- a/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go +++ b/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go @@ -29,9 +29,6 @@ const ( // DockerClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerCluster. DockerClusterDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition - - // DockerClusterPausedV1Beta2Condition is true if this DockerCluster or the Cluster it belongs to are paused. - DockerClusterPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition ) // Conditions that will be used for the DockerMachine object in v1Beta2 API version. @@ -58,7 +55,4 @@ const ( // DockerMachineDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerMachine. DockerMachineDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition - - // DockerMachinePausedV1Beta2Condition is true if this DockerMachine or the Cluster it belongs to are paused. - DockerMachinePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition )