Skip to content

Commit d0e714f

Browse files
committed
Flip machine readiness through MachineScope.SetNotReady instead of assigning Status.Ready directly
1 parent 651c6cb commit d0e714f

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

controller/stackitmachine_infrastructure.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ func (r *StackitMachineReconciler) reconcileNormal(ctx context.Context, s *scope
7373

7474
server, created, err := r.ensureServer(ctx, cloudClient, s, bootstrapData)
7575
if err != nil {
76-
// Keep the legacy boolean in step with the conditions: a machine whose
77-
// server could not be ensured is not ready, even if it was before.
78-
sm.Status.Ready = false
76+
s.SetNotReady("InstanceError", err.Error(), infrav1.MachineInstanceReadyCondition, infrav1.MachineReadyCondition)
7977
return util.CloudFailureResult(
8078
&sm.Status.Conditions,
8179
sm.Generation,
@@ -103,7 +101,7 @@ func (r *StackitMachineReconciler) reconcileNormal(ctx context.Context, s *scope
103101
}
104102

105103
if err := r.reconcileBastionNodeSSHAccess(ctx, cloudClient, s, server); err != nil {
106-
sm.Status.Ready = false
104+
s.SetNotReady("BastionSSHAccessError", err.Error(), infrav1.MachineReadyCondition)
107105
return util.CloudFailureResult(
108106
&sm.Status.Conditions,
109107
sm.Generation,
@@ -116,7 +114,7 @@ func (r *StackitMachineReconciler) reconcileNormal(ctx context.Context, s *scope
116114
}
117115

118116
if err := r.reconcileAPIServerLoadBalancerTarget(ctx, cloudClient, s, server); err != nil {
119-
sm.Status.Ready = false
117+
s.SetNotReady("LoadBalancerTargetError", err.Error(), infrav1.MachineReadyCondition)
120118
return util.CloudFailureResult(
121119
&sm.Status.Conditions,
122120
sm.Generation,

0 commit comments

Comments
 (0)