@@ -18,6 +18,7 @@ package controllers
18
18
19
19
import (
20
20
"context"
21
+ "time"
21
22
22
23
"github.com/go-logr/logr"
23
24
"github.com/pkg/errors"
@@ -158,14 +159,14 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi
158
159
if ! machineScope .Cluster .Status .InfrastructureReady {
159
160
machineScope .Info ("Cluster infrastructure is not ready yet" )
160
161
conditions .MarkFalse (machineScope .IBMPowerVSMachine , v1beta1 .InstanceReadyCondition , v1beta1 .WaitingForClusterInfrastructureReason , clusterv1 .ConditionSeverityInfo , "" )
161
- return ctrl.Result {}, nil
162
+ return ctrl.Result {RequeueAfter : 1 * time . Minute }, nil
162
163
}
163
164
164
165
// Make sure bootstrap data is available and populated.
165
166
if machineScope .Machine .Spec .Bootstrap .DataSecretName == nil {
166
167
machineScope .Info ("Bootstrap data secret reference is not yet available" )
167
168
conditions .MarkFalse (machineScope .IBMPowerVSMachine , v1beta1 .InstanceReadyCondition , v1beta1 .WaitingForBootstrapDataReason , clusterv1 .ConditionSeverityInfo , "" )
168
- return ctrl.Result {}, nil
169
+ return ctrl.Result {RequeueAfter : 1 * time . Minute }, nil
169
170
}
170
171
171
172
controllerutil .AddFinalizer (machineScope .IBMPowerVSMachine , v1beta1 .IBMPowerVSMachineFinalizer )
@@ -193,6 +194,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi
193
194
case v1beta1 .PowerVSInstanceStateSHUTOFF :
194
195
machineScope .SetNotReady ()
195
196
conditions .MarkFalse (machineScope .IBMPowerVSMachine , v1beta1 .InstanceReadyCondition , v1beta1 .InstanceStoppedReason , clusterv1 .ConditionSeverityError , "" )
197
+ return ctrl.Result {}, nil
196
198
case v1beta1 .PowerVSInstanceStateACTIVE :
197
199
machineScope .SetReady ()
198
200
conditions .MarkTrue (machineScope .IBMPowerVSMachine , v1beta1 .InstanceReadyCondition )
@@ -205,5 +207,10 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machi
205
207
}
206
208
machineScope .SetProviderID ()
207
209
208
- return ctrl.Result {}, nil
210
+ // Requeue after 2 minute if machine is not ready to update status of the machine properly
211
+ if ! machineScope .IsReady () {
212
+ return ctrl.Result {RequeueAfter : 2 * time .Minute }, nil
213
+ } else {
214
+ return ctrl.Result {}, nil
215
+ }
209
216
}
0 commit comments