Skip to content

Commit 604d5d2

Browse files
Address comments
1 parent f3ff615 commit 604d5d2

File tree

3 files changed

+39
-43
lines changed

3 files changed

+39
-43
lines changed

controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ const (
3535

3636
// KubeadmControlPlaneCertificatesAvailableV1Beta2Reason surfaces when cluster certificates are available,
3737
// no matter if those certificates have been provided by the user or generated by KubeadmControlPlane itself.
38-
// Cluster certificates includes: certificates authorities for ca, sa, front-proxy, etcd, and if external etcd is used,
38+
// Cluster certificates include: certificate authorities for ca, sa, front-proxy, etcd, and if external etcd is used,
3939
// also the apiserver-etcd-client client certificate.
40-
KubeadmControlPlaneCertificatesAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Condition
40+
KubeadmControlPlaneCertificatesAvailableV1Beta2Reason = clusterv1.MachineAvailableV1Beta2Reason
4141
)
4242

4343
// KubeadmControlPlane's EtcdClusterAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
@@ -86,22 +86,19 @@ const (
8686
// KubeadmControlPlaneMachineRemediationInternalErrorV1Beta2Reason surfaces unexpected failures while remediation a control plane machine.
8787
KubeadmControlPlaneMachineRemediationInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason
8888

89-
// KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason surfaces when remediation of a control plane machine can't be completed.
90-
KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason = "CannotRemediate"
89+
// KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason surfaces when remediation of a control plane machine can't be started.
90+
KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason = "CannotBeRemediated"
9191

9292
// KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason surfaces when remediation of a control plane machine must be deferred.
9393
KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason = "RemediationDeferred"
9494

95-
// KubeadmControlPlaneMachineRemediationDoneV1Beta2Reason surfaces when remediation of a control plane machine has been completed.
95+
// KubeadmControlPlaneMachineRemediationMachineDeletedV1Beta2Reason surfaces when remediation of a control plane machine
96+
// has been completed by deleting the unhealthy machine.
9697
// Note: After an unhealthy machine is deleted, a new one is created by the KubeadmControlPlaneMachine as part of the
97-
// regular reconcile loop that ensures the correct number of replicas exist; KubeadmControlPlaneMachine waits for
98+
// regular reconcile loop that ensures the correct number of replicas exist; KubeadmControlPlane machine waits for
9899
// the new machine to exists before removing the controlplane.cluster.x-k8s.io/remediation-in-progress annotation.
99100
// This is part of a series of safeguards to ensure that operation are performed sequentially on control plane machines.
100-
KubeadmControlPlaneMachineRemediationDoneV1Beta2Reason = "MachineDeleted"
101-
102-
// KubeadmControlPlaneMachineRemediationDInternalErrorV1Beta2Reason surfaces unexpected failures when remediating
103-
// a KubeadmControlPlane controlled machine.
104-
KubeadmControlPlaneMachineRemediationDInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason
101+
KubeadmControlPlaneMachineRemediationMachineDeletedV1Beta2Reason = "MachineDeleted"
105102
)
106103

107104
// KubeadmControlPlane's Deleting condition and corresponding reasons that will be used in v1Beta2 API version.

controlplane/kubeadm/internal/controllers/remediation.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
7777

7878
if err := patchHelper.Patch(ctx, m, patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{
7979
clusterv1.MachineOwnerRemediatedCondition,
80+
}}, patch.WithOwnedV1Beta2Conditions{Conditions: []string{
81+
clusterv1.MachineOwnerRemediatedV1Beta2Condition,
8082
}}); err != nil {
8183
errList = append(errList, err)
8284
}
@@ -141,8 +143,6 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
141143

142144
patchHelper, err := patch.NewHelper(machineToBeRemediated, r.Client)
143145
if err != nil {
144-
log.Error(err, "failed to create patch helper")
145-
146146
return ctrl.Result{}, err
147147
}
148148

@@ -206,7 +206,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
206206
Type: clusterv1.MachineOwnerRemediatedV1Beta2Condition,
207207
Status: metav1.ConditionFalse,
208208
Reason: controlplanev1.KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason,
209-
Message: "KCP waiting for control plane machine provisioning to complete before triggering remediation",
209+
Message: "KCP waiting for control plane Machine provisioning to complete before triggering remediation",
210210
})
211211
return ctrl.Result{}, nil
212212
}
@@ -220,7 +220,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
220220
Type: clusterv1.MachineOwnerRemediatedV1Beta2Condition,
221221
Status: metav1.ConditionFalse,
222222
Reason: controlplanev1.KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason,
223-
Message: "KCP waiting for control plane machine deletion to complete before triggering remediation",
223+
Message: "KCP waiting for control plane Machine deletion to complete before triggering remediation",
224224
})
225225
return ctrl.Result{}, nil
226226
}
@@ -248,7 +248,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
248248
Type: clusterv1.MachineOwnerRemediatedV1Beta2Condition,
249249
Status: metav1.ConditionFalse,
250250
Reason: controlplanev1.KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason,
251-
Message: "KCP can't remediate this machine because this could result in etcd loosing quorum",
251+
Message: "KCP can't remediate this Machine because this could result in etcd loosing quorum",
252252
})
253253
return ctrl.Result{}, nil
254254
}
@@ -279,7 +279,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
279279
Type: clusterv1.MachineOwnerRemediatedV1Beta2Condition,
280280
Status: metav1.ConditionFalse,
281281
Reason: controlplanev1.KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason,
282-
Message: "KCP can't remediate this machine because there is no healthy machine to forward etcd leadership to",
282+
Message: "KCP can't remediate this Machine because there is no healthy Machine to forward etcd leadership to",
283283
})
284284
return ctrl.Result{}, nil
285285
}
@@ -320,7 +320,7 @@ func (r *KubeadmControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.C
320320
v1beta2conditions.Set(machineToBeRemediated, metav1.Condition{
321321
Type: clusterv1.MachineOwnerRemediatedV1Beta2Condition,
322322
Status: metav1.ConditionFalse,
323-
Reason: controlplanev1.KubeadmControlPlaneMachineRemediationDoneV1Beta2Reason,
323+
Reason: controlplanev1.KubeadmControlPlaneMachineRemediationMachineDeletedV1Beta2Reason,
324324
})
325325

326326
// Prepare the info for tracking the remediation progress into the RemediationInProgressAnnotation.
@@ -524,7 +524,6 @@ func (r *KubeadmControlPlaneReconciler) canSafelyRemoveEtcdMember(ctx context.Co
524524
}
525525

526526
// Check member health as reported by machine's health conditions
527-
// TODO: note as phase 2 task
528527
if !conditions.IsTrue(machine, controlplanev1.MachineEtcdMemberHealthyCondition) {
529528
targetUnhealthyMembers++
530529
unhealthyMembers = append(unhealthyMembers, fmt.Sprintf("%s (%s)", etcdMember, machine.Name))

0 commit comments

Comments
 (0)