Skip to content

Commit

Permalink
feat(platform):add new cluster phase ClusterRecovering which means th…
Browse files Browse the repository at this point in the history
…e cluster is recovering form confined.
  • Loading branch information
wtaozzhang committed Jun 6, 2024
1 parent e0e2b8b commit bc89d1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions api/platform/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ const (
ClusterUpscaling ClusterPhase = "Upscaling"
// ClusterDownscaling means the cluster is undergoing graceful down scaling.
ClusterDownscaling ClusterPhase = "Downscaling"
// ClusterRecovering means the cluster is recovering form confined.
ClusterRecovering ClusterPhase = "Recovering"
)

// ComponentPhase defines the phase of anywhere cluster component
Expand Down
2 changes: 2 additions & 0 deletions api/platform/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ const (
ClusterUpscaling ClusterPhase = "Upscaling"
// ClusterDownscaling means the cluster is undergoing graceful down scaling.
ClusterDownscaling ClusterPhase = "Downscaling"
// ClusterRecovering means the cluster is recovering form confined.
ClusterRecovering ClusterPhase = "Recovering"
)

// ComponentPhase defines the phase of anywhere cluster component
Expand Down
5 changes: 3 additions & 2 deletions pkg/platform/controller/cluster/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (c *Controller) reconcile(ctx context.Context, key string, cluster *platfor
err = c.onUpdate(ctx, cluster)
case platformv1.ClusterUpscaling, platformv1.ClusterDownscaling:
err = c.onUpdate(ctx, cluster)
case platformv1.ClusterIdling, platformv1.ClusterConfined:
case platformv1.ClusterIdling, platformv1.ClusterConfined, platformv1.ClusterRecovering:
err = c.onUpdate(ctx, cluster)
case platformv1.ClusterTerminating:
log.FromContext(ctx).Info("Cluster has been terminated. Attempting to cleanup resources")
Expand Down Expand Up @@ -444,7 +444,8 @@ func (c *Controller) onUpdate(ctx context.Context, cluster *platformv1.Cluster)
if clusterWrapper.Status.Phase == platformv1.ClusterRunning ||
clusterWrapper.Status.Phase == platformv1.ClusterFailed ||
clusterWrapper.Status.Phase == platformv1.ClusterIdling ||
clusterWrapper.Status.Phase == platformv1.ClusterConfined {
clusterWrapper.Status.Phase == platformv1.ClusterConfined ||
clusterWrapper.Status.Phase == platformv1.ClusterRecovering {
err = provider.OnUpdate(ctx, clusterWrapper)
clusterWrapper = c.checkHealth(ctx, clusterWrapper)
if err != nil {
Expand Down

0 comments on commit bc89d1a

Please sign in to comment.