Skip to content

Commit ccc430f

Browse files
authored
Merge pull request #11298 from sbueringer/pr-fixups-mhc
🌱 Remove unused Paused conditions & minor MHC godoc fixes
2 parents b59bca9 + bb7d7e6 commit ccc430f

File tree

9 files changed

+7
-40
lines changed

9 files changed

+7
-40
lines changed

api/v1beta1/machine_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ const (
224224
// the timeout defined by a MachineHealthCheck object.
225225
MachineHealthCheckNodeStartupTimeoutV1Beta2Reason = "NodeStartupTimeout"
226226

227-
// MachineHealthCheckNodeDeletedV1Beta2Reason surfaces when a MachineHealthCheck detect that the node hosted on the
227+
// MachineHealthCheckNodeDeletedV1Beta2Reason surfaces when a MachineHealthCheck detects that the node hosted on the
228228
// machine has been deleted while the Machine is still running.
229229
MachineHealthCheckNodeDeletedV1Beta2Reason = "NodeDeleted"
230230

231-
// MachineHealthCheckHasRemediateAnnotationV1Beta2Reason surfaces a MachineHealthCheck detects a machine manually remediated
232-
// via the remediate-machine annotation.
231+
// MachineHealthCheckHasRemediateAnnotationV1Beta2Reason surfaces when a MachineHealthCheck detects that a Machine was
232+
// marked for remediation via the `cluster.x-k8s.io/remediate-machine` annotation.
233233
MachineHealthCheckHasRemediateAnnotationV1Beta2Reason = "HasRemediateAnnotation"
234234
)
235235

@@ -259,7 +259,7 @@ const (
259259
MachineExternallyRemediatedWaitingForRemediationV1Beta2Reason = "WaitingForRemediation"
260260

261261
// MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason surfaces that the MachineHealthCheck cannot
262-
// find the template for a external remediation request.
262+
// find the template for an external remediation request.
263263
MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason = "RemediationTemplateNotFound"
264264

265265
// MachineExternallyRemediatedRemediationRequestCreationFailedV1Beta2Reason surfaces that the MachineHealthCheck cannot

api/v1beta1/machinehealthcheck_types.go

-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ const (
3939
MachineHealthCheckRemediationAllowedV1Beta2Reason = "RemediationAllowed"
4040
)
4141

42-
// MachineHealthCheck's Paused condition and corresponding reasons that will be used in v1Beta2 API version.
43-
const (
44-
// MachineHealthCheckPausedV1Beta2Condition is true if this MachineHealthCheck or the Cluster it belongs to are paused.
45-
MachineHealthCheckPausedV1Beta2Condition = PausedV1Beta2Condition
46-
)
47-
4842
var (
4943
// DefaultNodeStartupTimeout is the time allowed for a node to start up.
5044
// Can be made longer as part of spec if required for particular provider.

api/v1beta1/v1beta2_condition_consts.go

-12
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ const (
133133

134134
// MachineSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines.
135135
MachineSetDeletingV1Beta2Condition = DeletingV1Beta2Condition
136-
137-
// MachineSetPausedV1Beta2Condition is true if this MachineSet or the Cluster it belongs to are paused.
138-
MachineSetPausedV1Beta2Condition = PausedV1Beta2Condition
139136
)
140137

141138
// Conditions that will be used for the MachineDeployment object in v1Beta2 API version.
@@ -162,9 +159,6 @@ const (
162159

163160
// MachineDeploymentDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines.
164161
MachineDeploymentDeletingV1Beta2Condition = DeletingV1Beta2Condition
165-
166-
// MachineDeploymentPausedV1Beta2Condition is true if this MachineDeployment or the Cluster it belongs to are paused.
167-
MachineDeploymentPausedV1Beta2Condition = PausedV1Beta2Condition
168162
)
169163

170164
// Conditions that will be used for the Cluster object in v1Beta2 API version.
@@ -220,9 +214,6 @@ const (
220214

221215
// ClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the cluster.
222216
ClusterDeletingV1Beta2Condition = DeletingV1Beta2Condition
223-
224-
// ClusterPausedV1Beta2Condition is true if Cluster and all the resources being part of it are paused.
225-
ClusterPausedV1Beta2Condition = PausedV1Beta2Condition
226217
)
227218

228219
// Conditions that will be used for the ClusterClass object in v1Beta2 API version.
@@ -236,7 +227,4 @@ const (
236227
// up-to-date (i.e. they are using the latest apiVersion of the current Cluster API contract from
237228
// the corresponding CRD).
238229
ClusterClassRefVersionsUpToDateV1Beta2Condition = "RefVersionsUpToDate"
239-
240-
// ClusterClassPausedV1Beta2Condition is true if this ClusterClass is paused.
241-
ClusterClassPausedV1Beta2Condition = PausedV1Beta2Condition
242230
)

controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go

-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ const (
5151

5252
// KubeadmControlPlaneDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines.
5353
KubeadmControlPlaneDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
54-
55-
// KubeadmControlPlanePausedV1Beta2Condition is true if this resource or the Cluster it belongs to are paused.
56-
KubeadmControlPlanePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
5754
)
5855

5956
// Conditions that will be used for the KubeadmControlPlane controlled machines in v1Beta2 API version.

exp/addons/api/v1beta1/v1beta2_condition_consts.go

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,4 @@ const (
2626

2727
// ClusterResourceSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the ClusterResourceSet.
2828
ClusterResourceSetDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
29-
30-
// ClusterResourceSetPausedV1Beta2Condition is true if this ClusterResourceSet is paused.
31-
ClusterResourceSetPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
3229
)

exp/api/v1beta1/v1beta2_condition_consts.go

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,4 @@ const (
4646

4747
// MachinePoolDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines.
4848
MachinePoolDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
49-
50-
// MachinePoolPausedV1Beta2Condition is true if this MachinePool or the Cluster it belongs to are paused.
51-
MachinePoolPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
5249
)

internal/controllers/machinehealthcheck/machinehealthcheck_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg
418418
Type: clusterv1.MachineExternallyRemediatedV1Beta2Condition,
419419
Status: metav1.ConditionFalse,
420420
Reason: clusterv1.MachineExternallyRemediatedRemediationTemplateNotFoundV1Beta2Reason,
421-
Message: fmt.Sprintf("error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(t.Machine.Namespace, m.Spec.RemediationTemplate.Name)),
421+
Message: fmt.Sprintf("Error retrieving remediation template %s %s", m.Spec.RemediationTemplate.Kind, klog.KRef(t.Machine.Namespace, m.Spec.RemediationTemplate.Name)),
422422
})
423423
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))
424424
return errList

internal/controllers/machinehealthcheck/machinehealthcheck_controller_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) {
661661
}).Should(Equal(1))
662662
})
663663

664-
t.Run("it marks unhealthy machines for remediation when the unhealthy Machines exceed MaxUnhealthy", func(t *testing.T) {
664+
t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines exceed MaxUnhealthy", func(t *testing.T) {
665665
g := NewWithT(t)
666666
cluster := createCluster(g, ns.Name)
667667

@@ -807,7 +807,7 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) {
807807
assertMachinesOwnerRemediated(g, mhc, 1)
808808
})
809809

810-
t.Run("it marks unhealthy machines for remediation when the unhealthy Machines is not within UnhealthyRange", func(t *testing.T) {
810+
t.Run("it marks unhealthy machines as unhealthy but not for remediation when the unhealthy Machines is not within UnhealthyRange", func(t *testing.T) {
811811
g := NewWithT(t)
812812
cluster := createCluster(g, ns.Name)
813813

test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go

-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ const (
2929

3030
// DockerClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerCluster.
3131
DockerClusterDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
32-
33-
// DockerClusterPausedV1Beta2Condition is true if this DockerCluster or the Cluster it belongs to are paused.
34-
DockerClusterPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
3532
)
3633

3734
// Conditions that will be used for the DockerMachine object in v1Beta2 API version.
@@ -58,7 +55,4 @@ const (
5855

5956
// DockerMachineDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerMachine.
6057
DockerMachineDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
61-
62-
// DockerMachinePausedV1Beta2Condition is true if this DockerMachine or the Cluster it belongs to are paused.
63-
DockerMachinePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
6458
)

0 commit comments

Comments
 (0)