Skip to content

Commit 50446ee

Browse files
committed
rename all KCP mentions to RKE2ControlPlane. Fix conversion tests
1 parent 2bd77da commit 50446ee

File tree

5 files changed

+41
-36
lines changed

5 files changed

+41
-36
lines changed

controlplane/api/v1alpha1/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ func (src *RKE2ControlPlane) ConvertTo(dstRaw conversion.Hub) error {
5757
dst.Spec.AgentConfig.PodSecurityAdmissionConfigFile = restored.Spec.AgentConfig.PodSecurityAdmissionConfigFile
5858
}
5959

60+
if restored.Spec.RemediationStrategy != nil {
61+
dst.Spec.RemediationStrategy = restored.Spec.RemediationStrategy
62+
}
63+
6064
dst.Spec.ServerConfig.EmbeddedRegistry = restored.Spec.ServerConfig.EmbeddedRegistry
6165
dst.Spec.MachineTemplate = restored.Spec.MachineTemplate
6266
dst.Status = restored.Status

controlplane/api/v1beta1/rke2controlplane_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,14 @@ type RemediationStrategy struct {
468468
// +optional
469469
MaxRetry *int32 `json:"maxRetry,omitempty"`
470470

471-
// retryPeriod is the duration that KCP should wait before remediating a machine being created as a replacement
471+
// retryPeriod is the duration that RKE2ControlPlane should wait before remediating a machine being created as a replacement
472472
// for an unhealthy machine (a retry).
473473
//
474474
// If not set, a retry will happen immediately.
475475
// +optional
476476
RetryPeriod metav1.Duration `json:"retryPeriod,omitempty"`
477477

478-
// minHealthyPeriod defines the duration after which KCP will consider any failure to a machine unrelated
478+
// minHealthyPeriod defines the duration after which RKE2ControlPlane will consider any failure to a machine unrelated
479479
// from the previous one. In this case the remediation is not considered a retry anymore, and thus the retry
480480
// counter restarts from 0. For example, assuming MinHealthyPeriod is set to 1h (default)
481481
//

controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_rke2controlplanes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,8 +1977,8 @@ spec:
19771977
type: integer
19781978
minHealthyPeriod:
19791979
description: "minHealthyPeriod defines the duration after which
1980-
KCP will consider any failure to a machine unrelated\nfrom the
1981-
previous one. In this case the remediation is not considered
1980+
RKE2ControlPlane will consider any failure to a machine unrelated\nfrom
1981+
the previous one. In this case the remediation is not considered
19821982
a retry anymore, and thus the retry\ncounter restarts from 0.
19831983
For example, assuming MinHealthyPeriod is set to 1h (default)\n\n\tM1
19841984
become unhealthy; remediation happens, and M1-1 is created as
@@ -1994,7 +1994,7 @@ spec:
19941994
type: string
19951995
retryPeriod:
19961996
description: |-
1997-
retryPeriod is the duration that KCP should wait before remediating a machine being created as a replacement
1997+
retryPeriod is the duration that RKE2ControlPlane should wait before remediating a machine being created as a replacement
19981998
for an unhealthy machine (a retry).
19991999
20002000
If not set, a retry will happen immediately.

controlplane/config/crd/bases/controlplane.cluster.x-k8s.io_rke2controlplanetemplates.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -821,25 +821,26 @@ spec:
821821
type: integer
822822
minHealthyPeriod:
823823
description: "minHealthyPeriod defines the duration after
824-
which KCP will consider any failure to a machine unrelated\nfrom
825-
the previous one. In this case the remediation is not
826-
considered a retry anymore, and thus the retry\ncounter
827-
restarts from 0. For example, assuming MinHealthyPeriod
828-
is set to 1h (default)\n\n\tM1 become unhealthy; remediation
829-
happens, and M1-1 is created as a replacement.\n\tIf
830-
M1-1 (replacement of M1) has problems within the 1hr
831-
after the creation, also\n\tthis machine will be remediated
832-
and this operation is considered a retry - a problem
833-
related\n\tto the original issue happened to M1 -.\n\n\tIf
834-
instead the problem on M1-1 is happening after MinHealthyPeriod
835-
expired, e.g. four days after\n\tm1-1 has been created
836-
as a remediation of M1, the problem on M1-1 is considered
837-
unrelated to\n\tthe original issue happened to M1.\n\nIf
838-
not set, this value is defaulted to 1h."
824+
which RKE2ControlPlane will consider any failure to
825+
a machine unrelated\nfrom the previous one. In this
826+
case the remediation is not considered a retry anymore,
827+
and thus the retry\ncounter restarts from 0. For example,
828+
assuming MinHealthyPeriod is set to 1h (default)\n\n\tM1
829+
become unhealthy; remediation happens, and M1-1 is created
830+
as a replacement.\n\tIf M1-1 (replacement of M1) has
831+
problems within the 1hr after the creation, also\n\tthis
832+
machine will be remediated and this operation is considered
833+
a retry - a problem related\n\tto the original issue
834+
happened to M1 -.\n\n\tIf instead the problem on M1-1
835+
is happening after MinHealthyPeriod expired, e.g. four
836+
days after\n\tm1-1 has been created as a remediation
837+
of M1, the problem on M1-1 is considered unrelated to\n\tthe
838+
original issue happened to M1.\n\nIf not set, this value
839+
is defaulted to 1h."
839840
type: string
840841
retryPeriod:
841842
description: |-
842-
retryPeriod is the duration that KCP should wait before remediating a machine being created as a replacement
843+
retryPeriod is the duration that RKE2ControlPlane should wait before remediating a machine being created as a replacement
843844
for an unhealthy machine (a retry).
844845
845846
If not set, a retry will happen immediately.

controlplane/internal/controllers/remediation.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
9292
// and `MachineOwnerRemediated` is false, indicating that this controller is responsible for performing remediation.
9393
machinesToBeRemediated := controlPlane.MachinesToBeRemediatedByRCP()
9494

95-
// If there are no machines to remediated, return so KCP can proceed with other operations (ctrl.Result nil).
95+
// If there are no machines to remediated, return so RKE2ControlPlane can proceed with other operations (ctrl.Result nil).
9696
if len(machinesToBeRemediated) == 0 {
9797
return ctrl.Result{}, nil
9898
}
@@ -120,8 +120,8 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
120120
// is not being deleted to avoid unnecessary logs if no further remediation should be done.
121121
if v, ok := controlPlane.RCP.Annotations[controlplanev1.RemediationInProgressAnnotation]; ok {
122122
// Check if the annotation is stale; this might happen in case there is a crash in the controller in between
123-
// when a new Machine is created and the annotation is eventually removed from KCP via defer patch at the end
124-
// of KCP reconcile.
123+
// when a new Machine is created and the annotation is eventually removed from RKE2ControlPlane via defer patch at the end
124+
// of RKE2ControlPlane reconcile.
125125
remediationData, err := RemediationDataFromAnnotation(v)
126126
if err != nil {
127127
return ctrl.Result{}, err
@@ -168,9 +168,9 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
168168
// Before starting remediation, run preflight checks in order to verify it is safe to remediate.
169169
// If any of the following checks fails, we'll surface the reason in the MachineOwnerRemediated condition.
170170

171-
// Check if KCP is allowed to remediate considering retry limits:
171+
// Check if RKE2ControlPlane is allowed to remediate considering retry limits:
172172
// - Remediation cannot happen because retryPeriod is not yet expired.
173-
// - KCP already reached MaxRetries limit.
173+
// - RKE2ControlPlane already reached MaxRetries limit.
174174
remediationInProgressData, canRemediate, err := r.checkRetryLimits(log, machineToBeRemediated, controlPlane, reconciliationTime)
175175
if err != nil {
176176
return ctrl.Result{}, err
@@ -181,7 +181,7 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
181181
return ctrl.Result{}, nil
182182
}
183183

184-
// Executes checks that apply only if the control plane is already initialized; in this case KCP can
184+
// Executes checks that apply only if the control plane is already initialized; in this case RKE2ControlPlane can
185185
// remediate only if it can safely assume that the operation preserves the operation state of the
186186
// existing cluster (or at least it doesn't make it worse).
187187
if controlPlane.RCP.Status.Initialized {
@@ -203,7 +203,7 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
203203
}
204204

205205
// The cluster MUST NOT have healthy machines still being provisioned.
206-
// This rule prevents KCP taking actions while the cluster is in a transitional state.
206+
// This rule prevents RKE2ControlPlane taking actions while the cluster is in a transitional state.
207207
if controlPlane.HasHealthyMachineStillProvisioning() {
208208
log.Info("A control plane machine needs remediation, but there are other control-plane machines being provisioned. Skipping remediation")
209209
conditions.MarkFalse(
@@ -217,7 +217,7 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
217217
return ctrl.Result{}, nil
218218
}
219219

220-
// The cluster MUST have no machines with a deletion timestamp. This rule prevents KCP taking actions while the cluster is in a transitional state.
220+
// The cluster MUST have no machines with a deletion timestamp. This rule prevents RKE2ControlPlane taking actions while the cluster is in a transitional state.
221221
if controlPlane.HasDeletingMachine() {
222222
log.Info("A control plane machine needs remediation, but there are other control-plane machines being deleted. Skipping remediation")
223223
conditions.MarkFalse(
@@ -231,7 +231,7 @@ func (r *RKE2ControlPlaneReconciler) reconcileUnhealthyMachines(ctx context.Cont
231231
return ctrl.Result{}, nil
232232
}
233233

234-
// Remediation MUST preserve etcd quorum. This rule ensures that KCP will not remove a member that would result in etcd
234+
// Remediation MUST preserve etcd quorum. This rule ensures that RKE2ControlPlane will not remove a member that would result in etcd
235235
// losing a majority of members and thus become unable to field new requests.
236236
if controlPlane.IsEtcdManaged() {
237237
canSafelyRemediate, err := r.canSafelyRemoveEtcdMember(ctx, controlPlane, machineToBeRemediated)
@@ -433,9 +433,9 @@ func pickMachineToBeRemediatedByConditionState(i, j *clusterv1.Machine, t cluste
433433
return nil
434434
}
435435

436-
// checkRetryLimits checks if KCP is allowed to remediate considering retry limits:
436+
// checkRetryLimits checks if RKE2ControlPlane is allowed to remediate considering retry limits:
437437
// - Remediation cannot happen because retryPeriod is not yet expired.
438-
// - KCP already reached the maximum number of retries for a machine.
438+
// - RKE2ControlPlane already reached the maximum number of retries for a machine.
439439
// NOTE: Counting the number of retries is required In order to prevent infinite remediation e.g. in case the
440440
// first Control Plane machine is failing due to quota issue.
441441
func (r *RKE2ControlPlaneReconciler) checkRetryLimits(
@@ -489,7 +489,7 @@ func (r *RKE2ControlPlaneReconciler) checkRetryLimits(
489489
}
490490

491491
// Once we get here we already know that there was a last remediation for the Machine.
492-
// If the current remediation is happening before minHealthyPeriod is expired, then KCP considers this
492+
// If the current remediation is happening before minHealthyPeriod is expired, then RKE2ControlPlane considers this
493493
// as a remediation for the same previously unhealthy machine.
494494
// NOTE: If someone/something changes the RemediationForAnnotation on Machines (e.g. changes the Timestamp),
495495
// this could potentially lead to executing more retries than expected, but this is considered acceptable in such a case.
@@ -624,9 +624,9 @@ func (r *RKE2ControlPlaneReconciler) canSafelyRemoveEtcdMember(ctx context.Conte
624624
}
625625

626626
// If an etcd member does not have a corresponding machine it is not possible to retrieve etcd member health,
627-
// so KCP is assuming the worst scenario and considering the member unhealthy.
627+
// so RKE2ControlPlane is assuming the worst scenario and considering the member unhealthy.
628628
//
629-
// NOTE: This should not happen given that KCP is running reconcileEtcdMembers before calling this method.
629+
// NOTE: This should not happen given that RKE2ControlPlane is running reconcileEtcdMembers before calling this method.
630630
if machine == nil {
631631
log.Info("An etcd member does not have a corresponding machine, assuming this member is unhealthy", "memberName", etcdMember)
632632
targetUnhealthyMembers++
@@ -663,7 +663,7 @@ func (r *RKE2ControlPlaneReconciler) canSafelyRemoveEtcdMember(ctx context.Conte
663663
return canSafelyRemediate, nil
664664
}
665665

666-
// RemediationData struct is used to keep track of information stored in the RemediationInProgressAnnotation in KCP
666+
// RemediationData struct is used to keep track of information stored in the RemediationInProgressAnnotation in RKE2ControlPlane
667667
// during remediation and then into the RemediationForAnnotation on the replacement machine once it is created.
668668
type RemediationData struct {
669669
// machine is the machine name of the latest machine being remediated.

0 commit comments

Comments
 (0)