Skip to content

Commit

Permalink
feat: add new cluster phase ClusterRecovering (#2320)
Browse files Browse the repository at this point in the history
Co-authored-by: wtaozzhang <wtaozzhang@tencent.com>
  • Loading branch information
1996wentaozhang and wtaozzhang authored Jun 6, 2024
1 parent e0e2b8b commit 3adc0f4
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 3adc0f4

Please sign in to comment.