Skip to content

Commit

Permalink
Add ClusterStatus supported (caoyingjunz#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
caoyingjunz authored Jul 13, 2024
1 parent 7c29c0b commit 93a6b37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ func (c *cluster) model2Type(o *model.Cluster) *types.Cluster {
return tc
}

func (c *cluster) GetClusterStatusFromPlanTask(planId int64) (string, error) {
func (c *cluster) GetClusterStatusFromPlanTask(planId int64) (model.ClusterStatus, error) {
status := model.ClusterStatusRunning

// 尝试获取最新的任务状态
Expand Down
10 changes: 6 additions & 4 deletions pkg/db/model/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ const (
ClusterTypeCustom // 自建集群
)

type ClusterStatus uint8

const (
ClusterStatusRunning = "运行中"
ClusterStatusDeploy = "部署中"
ClusterStatusUnStart = "等待部署"
ClusterStatusFailed = "部署失败"
ClusterStatusRunning ClusterStatus = iota // 运行中
ClusterStatusDeploy // 部署中
ClusterStatusUnStart // 等待部署
ClusterStatusFailed // 部署失败
)

// Cluster kubernetes 集群信息
Expand Down
6 changes: 3 additions & 3 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ type TimeMeta struct {
type Cluster struct {
PixiuMeta `json:",inline"`

Name string `json:"name"`
AliasName string `json:"alias_name"`
Status string `json:"status"` // 标记集群状态,自建集群有部署更新状态
Name string `json:"name"`
AliasName string `json:"alias_name"`
Status model.ClusterStatus `json:"status"` // 标记集群状态,自建集群有部署更新状态

// 0: 标准集群 1: 自建集群
ClusterType model.ClusterType `json:"cluster_type"`
Expand Down

0 comments on commit 93a6b37

Please sign in to comment.