app ls --status shows more detailles about the deployment state #280

Merged
moritz merged 8 commits from detailed_app_list into main 2023-03-07 12:32:19 +00:00
2 changed files with 33 additions and 10 deletions
Showing only changes of commit 3753357ef8 - Show all commits

View File

@ -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)
} }

View File

@ -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)
moritz marked this conversation as resolved Outdated

chaos_version -> chaos-version following the convention of -? This would require updating in several places in this PR.

`chaos_version` -> `chaos-version` following the convention of `-`? This would require updating in several places in this PR.
if chaosVersion, ok := service.Spec.Labels[labelKey]; ok {
result["chaosVersion"] = chaosVersion
}
labelKey = fmt.Sprintf("coop-cloud.%s.version", name)
decentral1se marked this conversation as resolved Outdated

Is autoupdate -> auto-update potentially more readable?

Is `autoupdate` -> `auto-update` potentially more readable?

This would be a bit more readable but it would break kadabra for for all apps that are deployed with the current abra version.
Kadabra is still alpha, so breaking changes are part of it, but I don't think this label change is really worth the effort to redeploy all apps after the next abra release.

This would be a bit more readable but it would break kadabra for for all apps that are deployed with the current abra version. Kadabra is still alpha, so breaking changes are part of it, but I don't think this label change is really worth the effort to redeploy all apps after the next abra release.
if version, ok := service.Spec.Labels[labelKey]; ok { if version, ok := service.Spec.Labels[labelKey]; ok {
result["version"] = version result["version"] = version
} else { } else {