feat(list): show chaos status and chaos version
This commit is contained in:
parent
611430aab2
commit
3753357ef8
|
@ -39,13 +39,15 @@ var listAppServerFlag = &cli.StringFlag{
|
||||||
}
|
}
|
||||||
|
|
||||||
type appStatus struct {
|
type appStatus struct {
|
||||||
Server string `json:"server"`
|
Server string `json:"server"`
|
||||||
Recipe string `json:"recipe"`
|
Recipe string `json:"recipe"`
|
||||||
AppName string `json:"appName"`
|
AppName string `json:"appName"`
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Version string `json:"version"`
|
Chaos string `json:"chaos"`
|
||||||
Upgrade string `json:"upgrade"`
|
ChaosVersion string `json:"chaosVersion"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Upgrade string `json:"upgrade"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type serverStatus struct {
|
type serverStatus struct {
|
||||||
|
@ -138,12 +140,20 @@ can take some time.
|
||||||
if status {
|
if status {
|
||||||
status := "unknown"
|
status := "unknown"
|
||||||
version := "unknown"
|
version := "unknown"
|
||||||
|
chaos := "unknown"
|
||||||
|
chaosVersion := "unknown"
|
||||||
if statusMeta, ok := statuses[app.StackName()]; ok {
|
if statusMeta, ok := statuses[app.StackName()]; ok {
|
||||||
if currentVersion, exists := statusMeta["version"]; exists {
|
if currentVersion, exists := statusMeta["version"]; exists {
|
||||||
if currentVersion != "" {
|
if currentVersion != "" {
|
||||||
version = currentVersion
|
version = currentVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if chaosDeploy, exists := statusMeta["chaos"]; exists {
|
||||||
|
chaos = chaosDeploy
|
||||||
|
}
|
||||||
|
if chaosDeployVersion, exists := statusMeta["chaosVersion"]; exists {
|
||||||
|
chaosVersion = chaosDeployVersion
|
||||||
|
}
|
||||||
if statusMeta["status"] != "" {
|
if statusMeta["status"] != "" {
|
||||||
status = statusMeta["status"]
|
status = statusMeta["status"]
|
||||||
}
|
}
|
||||||
|
@ -153,6 +163,8 @@ can take some time.
|
||||||
}
|
}
|
||||||
|
|
||||||
appStats.Status = status
|
appStats.Status = status
|
||||||
|
appStats.Chaos = chaos
|
||||||
|
appStats.ChaosVersion = chaosVersion
|
||||||
appStats.Version = version
|
appStats.Version = version
|
||||||
|
|
||||||
var newUpdates []string
|
var newUpdates []string
|
||||||
|
@ -223,7 +235,7 @@ can take some time.
|
||||||
|
|
||||||
tableCol := []string{"recipe", "domain"}
|
tableCol := []string{"recipe", "domain"}
|
||||||
if status {
|
if status {
|
||||||
tableCol = append(tableCol, []string{"status", "version", "upgrade"}...)
|
tableCol = append(tableCol, []string{"status", "chaos", "chaos version", "version", "upgrade"}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
table := formatter.CreateTable(tableCol)
|
table := formatter.CreateTable(tableCol)
|
||||||
|
@ -231,7 +243,7 @@ can take some time.
|
||||||
for _, appStat := range serverStat.Apps {
|
for _, appStat := range serverStat.Apps {
|
||||||
tableRow := []string{appStat.Recipe, appStat.Domain}
|
tableRow := []string{appStat.Recipe, appStat.Domain}
|
||||||
if status {
|
if status {
|
||||||
tableRow = append(tableRow, []string{appStat.Status, appStat.Version, appStat.Upgrade}...)
|
tableRow = append(tableRow, []string{appStat.Status, appStat.Chaos, appStat.ChaosVersion, appStat.Version, appStat.Upgrade}...)
|
||||||
}
|
}
|
||||||
table.Append(tableRow)
|
table.Append(tableRow)
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,7 +403,18 @@ func GetAppStatuses(apps []App, MachineReadable bool) (map[string]map[string]str
|
||||||
result["status"] = "deployed"
|
result["status"] = "deployed"
|
||||||
}
|
}
|
||||||
|
|
||||||
labelKey := fmt.Sprintf("coop-cloud.%s.version", name)
|
labelKey := fmt.Sprintf("coop-cloud.%s.chaos", name)
|
||||||
|
chaos, ok := service.Spec.Labels[labelKey]
|
||||||
|
if ok {
|
||||||
|
result["chaos"] = chaos
|
||||||
|
}
|
||||||
|
|
||||||
|
labelKey = fmt.Sprintf("coop-cloud.%s.chaos_version", name)
|
||||||
|
if chaosVersion, ok := service.Spec.Labels[labelKey]; ok {
|
||||||
|
result["chaosVersion"] = chaosVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
labelKey = fmt.Sprintf("coop-cloud.%s.version", name)
|
||||||
if version, ok := service.Spec.Labels[labelKey]; ok {
|
if version, ok := service.Spec.Labels[labelKey]; ok {
|
||||||
result["version"] = version
|
result["version"] = version
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue