feat(list): show autoupdate state

This commit is contained in:
Moritz 2023-03-01 12:26:28 +01:00
parent 3753357ef8
commit d120299929
2 changed files with 15 additions and 2 deletions

View File

@ -46,6 +46,7 @@ type appStatus struct {
Status string `json:"status"`
Chaos string `json:"chaos"`
ChaosVersion string `json:"chaosVersion"`
AutoUpdate string `json:"autoUpdate"`
Version string `json:"version"`
Upgrade string `json:"upgrade"`
}
@ -142,6 +143,7 @@ can take some time.
version := "unknown"
chaos := "unknown"
chaosVersion := "unknown"
autoUpdate := "unknown"
if statusMeta, ok := statuses[app.StackName()]; ok {
if currentVersion, exists := statusMeta["version"]; exists {
if currentVersion != "" {
@ -154,6 +156,9 @@ can take some time.
if chaosDeployVersion, exists := statusMeta["chaosVersion"]; exists {
chaosVersion = chaosDeployVersion
}
if autoUpdateState, exists := statusMeta["autoUpdate"]; exists {
autoUpdate = autoUpdateState
}
if statusMeta["status"] != "" {
status = statusMeta["status"]
}
@ -166,6 +171,7 @@ can take some time.
appStats.Chaos = chaos
appStats.ChaosVersion = chaosVersion
appStats.Version = version
appStats.AutoUpdate = autoUpdate
var newUpdates []string
if version != "unknown" {
@ -235,7 +241,7 @@ can take some time.
tableCol := []string{"recipe", "domain"}
if status {
tableCol = append(tableCol, []string{"status", "chaos", "chaos version", "version", "upgrade"}...)
tableCol = append(tableCol, []string{"status", "chaos", "chaos version", "version", "upgrade", "autoupdate"}...)
}
table := formatter.CreateTable(tableCol)
@ -243,7 +249,7 @@ can take some time.
for _, appStat := range serverStat.Apps {
tableRow := []string{appStat.Recipe, appStat.Domain}
if status {
tableRow = append(tableRow, []string{appStat.Status, appStat.Chaos, appStat.ChaosVersion, appStat.Version, appStat.Upgrade}...)
tableRow = append(tableRow, []string{appStat.Status, appStat.Chaos, appStat.ChaosVersion, appStat.Version, appStat.Upgrade, appStat.AutoUpdate}...)
}
table.Append(tableRow)
}

View File

@ -414,6 +414,13 @@ func GetAppStatuses(apps []App, MachineReadable bool) (map[string]map[string]str
result["chaosVersion"] = chaosVersion
}
labelKey = fmt.Sprintf("coop-cloud.%s.autoupdate", name)
if autoUpdate, ok := service.Spec.Labels[labelKey]; ok {
result["autoUpdate"] = autoUpdate
} else {
result["autoUpdate"] = "false"
}
labelKey = fmt.Sprintf("coop-cloud.%s.version", name)
if version, ok := service.Spec.Labels[labelKey]; ok {
result["version"] = version