Skip to content

Commit

Permalink
Remove unused Paused conditions & minor MHC godoc fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Oct 17, 2024
1 parent ff13a64 commit a48485e
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 40 deletions.
8 changes: 4 additions & 4 deletions api/v1beta1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions api/v1beta1/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 0 additions & 12 deletions api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
)
3 changes: 0 additions & 3 deletions controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions exp/addons/api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
3 changes: 0 additions & 3 deletions exp/api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

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

0 comments on commit a48485e

Please sign in to comment.