Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.9] 🐛 Machine: sort list of pre-drain hooks for stable condition messages #11625

Open
wants to merge 1 commit into
base: release-1.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,11 @@ func (r *Reconciler) reconcileDelete(ctx context.Context, s *scope) (ctrl.Result
hooks = append(hooks, key)
}
}
slices.Sort(hooks)
log.Info("Waiting for pre-drain hooks to succeed", "hooks", strings.Join(hooks, ","))
conditions.MarkFalse(m, clusterv1.PreDrainDeleteHookSucceededCondition, clusterv1.WaitingExternalHookReason, clusterv1.ConditionSeverityInfo, "")
s.deletingReason = clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason
s.deletingMessage = fmt.Sprintf("Waiting for pre-drain hooks to complete (hooks: %s)", strings.Join(hooks, ","))
s.deletingMessage = fmt.Sprintf("Waiting for pre-drain hooks to succeed (hooks: %s)", strings.Join(hooks, ","))
return ctrl.Result{}, nil
}
conditions.MarkTrue(m, clusterv1.PreDrainDeleteHookSucceededCondition)
Expand Down
12 changes: 6 additions & 6 deletions internal/controllers/machine/machine_controller_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,12 @@ func TestDeletingCondition(t *testing.T) {
},
reconcileDeleteExecuted: true,
deletingReason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
deletingMessage: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
deletingMessage: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
expectCondition: metav1.Condition{
Type: clusterv1.MachineDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
Message: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
Message: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
},
},
{
Expand Down Expand Up @@ -1186,7 +1186,7 @@ func TestDeletingCondition(t *testing.T) {
Type: clusterv1.MachineDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
Message: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
Message: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
},
},
},
Expand All @@ -1200,7 +1200,7 @@ func TestDeletingCondition(t *testing.T) {
Type: clusterv1.MachineDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
Message: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
Message: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
},
},
}
Expand Down Expand Up @@ -1409,7 +1409,7 @@ func TestSetReadyCondition(t *testing.T) {
Type: clusterv1.MachineDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
Message: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
Message: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
},
},
},
Expand Down Expand Up @@ -1788,7 +1788,7 @@ After above Pods have been removed from the Node, the following Pods will be evi
Type: clusterv1.MachineDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: clusterv1.MachineDeletingWaitingForPreDrainHookV1Beta2Reason,
Message: "Waiting for pre-drain hooks to complete (hooks: test-hook)",
Message: "Waiting for pre-drain hooks to succeed (hooks: test-hook)",
},
},
},
Expand Down
Loading