Skip to content

Commit

Permalink
[BugFix] Keep the cluster status phase same with component (#380)
Browse files Browse the repository at this point in the history
Signed-off-by: yandongxiao <[email protected]>
  • Loading branch information
yandongxiao authored Dec 21, 2023
1 parent 330c4a7 commit 1211461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 4 additions & 7 deletions pkg/apis/starrocks/v1/starrockscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,15 @@ const (
// ClusterFailed represents starrocks cluster failed.
ClusterFailed Phase = "failed"

// ClusterPending represents the starrocks cluster is creating
ClusterPending Phase = "pending"

// ClusterDeleting waiting all resource deleted
ClusterDeleting Phase = "deleting"
// ClusterReconciling represents some component is reconciling
ClusterReconciling Phase = "reconciling"
)

const (
// ComponentReconciling the starrocks have component in starting.
// ComponentReconciling the starrocks component is reconciling
ComponentReconciling ComponentPhase = "reconciling"

// ComponentFailed have at least one service failed.
// ComponentFailed the pod of component is failed
ComponentFailed ComponentPhase = "failed"

// ComponentRunning all components runs available.
Expand Down
3 changes: 1 addition & 2 deletions pkg/controllers/starrockscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (r *StarRocksClusterReconciler) Reconcile(ctx context.Context, req ctrl.Req
// reconcile src deleted
if !src.DeletionTimestamp.IsZero() {
logger.Info("deletion timestamp is not zero, clear StarRocksCluster related resources")
src.Status.Phase = srapi.ClusterDeleting
return ctrl.Result{}, nil
}

Expand Down Expand Up @@ -216,7 +215,7 @@ func GetPhaseFromComponent(componentStatus *srapi.StarRocksComponentStatus) srap
return ""
}
if componentStatus.Phase == srapi.ComponentReconciling {
return srapi.ClusterPending
return srapi.ClusterReconciling
}
if componentStatus.Phase == srapi.ComponentFailed {
return srapi.ClusterFailed
Expand Down

0 comments on commit 1211461

Please sign in to comment.