Skip to content

Commit b53ef08

Browse files
Set instance in moving state to be not ready, but dont throw error (#367)
1 parent cf46124 commit b53ef08

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

controllers/ocimachine_controller.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ func (r *OCIMachineReconciler) reconcileNormal(ctx context.Context, logger logr.
326326
machineScope.Info("Instance is pending")
327327
conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceNotReadyReason, clusterv1.ConditionSeverityInfo, "")
328328
return reconcile.Result{RequeueAfter: 10 * time.Second}, nil
329-
case core.InstanceLifecycleStateStopping, core.InstanceLifecycleStateStopped:
329+
case core.InstanceLifecycleStateStopping, core.InstanceLifecycleStateStopped, core.InstanceLifecycleStateMoving:
330330
machineScope.SetNotReady()
331+
machineScope.Info(fmt.Sprintf("Instance is in %s state and not ready", instance.LifecycleState))
331332
conditions.MarkFalse(machineScope.OCIMachine, infrastructurev1beta2.InstanceReadyCondition, infrastructurev1beta2.InstanceNotReadyReason, clusterv1.ConditionSeverityInfo, "")
332333
return reconcile.Result{}, nil
333334
case core.InstanceLifecycleStateRunning:

controllers/ocimachine_controller_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,22 @@ func TestNormalReconciliationFunction(t *testing.T) {
334334
}, nil)
335335
},
336336
},
337+
{
338+
name: "instance in moving state",
339+
errorExpected: false,
340+
conditionAssertion: []conditionAssertion{{infrastructurev1beta2.InstanceReadyCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityInfo, infrastructurev1beta2.InstanceNotReadyReason}},
341+
testSpecificSetup: func(t *test, machineScope *scope.MachineScope, computeClient *mock_compute.MockComputeClient, vcnClient *mock_vcn.MockClient, nlbclient *mock_nlb.MockNetworkLoadBalancerClient) {
342+
computeClient.EXPECT().GetInstance(gomock.Any(), gomock.Eq(core.GetInstanceRequest{
343+
InstanceId: common.String("test"),
344+
})).
345+
Return(core.GetInstanceResponse{
346+
Instance: core.Instance{
347+
Id: common.String("test"),
348+
LifecycleState: core.InstanceLifecycleStateMoving,
349+
},
350+
}, nil)
351+
},
352+
},
337353
{
338354
name: "instance in terminated state",
339355
errorExpected: true,

0 commit comments

Comments
 (0)