Skip to content

Commit

Permalink
Merge pull request #9355 from typeid/9285_pass_draining_condition
Browse files Browse the repository at this point in the history
🐛 Bubble up machine drain condition in `MachinesReadyCondition`
  • Loading branch information
k8s-ci-robot committed Jan 15, 2024
2 parents 433d4a5 + bb9639b commit f6109cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func patchMachine(ctx context.Context, patchHelper *patch.Helper, machine *clust
// MHC reported condition should take precedence over the remediation progress
clusterv1.MachineHealthCheckSucceededCondition,
clusterv1.MachineOwnerRemediatedCondition,
clusterv1.DrainingSucceededCondition,
),
conditions.WithStepCounterIf(machine.ObjectMeta.DeletionTimestamp.IsZero() && machine.Spec.ProviderID == nil),
conditions.WithStepCounterIfOnly(
Expand Down
11 changes: 11 additions & 0 deletions internal/controllers/machine/machine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,17 @@ func TestMachineConditions(t *testing.T) {
conditions.UnknownCondition(clusterv1.MachineNodeHealthyCondition, clusterv1.NodeInspectionFailedReason, "Failed to get the Node for this Machine by ProviderID"),
},
},
{
name: "ready condition summary consumes reason from the draining succeeded condition",
infraReady: true,
bootstrapReady: true,
beforeFunc: func(bootstrap, infra *unstructured.Unstructured, m *clusterv1.Machine) {
conditions.MarkFalse(m, clusterv1.DrainingSucceededCondition, clusterv1.DrainingFailedReason, clusterv1.ConditionSeverityWarning, "")
},
conditionsToAssert: []*clusterv1.Condition{
conditions.FalseCondition(clusterv1.ReadyCondition, clusterv1.DrainingFailedReason, clusterv1.ConditionSeverityWarning, ""),
},
},
}

for _, tt := range testcases {
Expand Down

0 comments on commit f6109cd

Please sign in to comment.