diff --git a/controllers/apps/v2beta1/update_emqx_status.go b/controllers/apps/v2beta1/update_emqx_status.go index 3bff86a9..7d7232d2 100644 --- a/controllers/apps/v2beta1/update_emqx_status.go +++ b/controllers/apps/v2beta1/update_emqx_status.go @@ -117,19 +117,21 @@ func (u *updateStatus) reconcile(ctx context.Context, logger logr.Logger, instan } } - isEnterpriser := false - for _, node := range coreNodes { - if node.ControllerUID == currentSts.UID && node.Edition == "Enterprise" { - isEnterpriser = true - break + if currentSts != nil { + isEnterpriser := false + for _, node := range coreNodes { + if node.ControllerUID == currentSts.UID && node.Edition == "Enterprise" { + isEnterpriser = true + break + } } - } - if isEnterpriser { - nodeEvacuationsStatus, err := getNodeEvacuationStatusByAPI(r) - if err != nil { - u.EventRecorder.Event(instance, corev1.EventTypeWarning, "FailedToGetNodeEvacuationStatuses", err.Error()) + if isEnterpriser { + nodeEvacuationsStatus, err := getNodeEvacuationStatusByAPI(r) + if err != nil { + u.EventRecorder.Event(instance, corev1.EventTypeWarning, "FailedToGetNodeEvacuationStatuses", err.Error()) + } + instance.Status.NodeEvacuationsStatus = nodeEvacuationsStatus } - instance.Status.NodeEvacuationsStatus = nodeEvacuationsStatus } // update status condition