feat: support version/upgrade listing

Closes coop-cloud/organising#130.
This commit is contained in:
2021-10-08 09:51:47 +02:00
parent 98ffc210e1
commit dde8afcd43
6 changed files with 89 additions and 34 deletions

View File

@ -276,8 +276,8 @@ func SanitiseAppName(name string) string {
}
// GetAppStatuses queries servers to check the deployment status of given apps
func GetAppStatuses(appFiles AppFiles) (map[string]string, error) {
statuses := map[string]string{}
func GetAppStatuses(appFiles AppFiles) (map[string]map[string]string, error) {
statuses := make(map[string]map[string]string)
var unique []string
servers := make(map[string]struct{})
@ -299,11 +299,20 @@ func GetAppStatuses(appFiles AppFiles) (map[string]string, error) {
for range servers {
status := <-ch
result := make(map[string]string)
for _, service := range status.Services {
name := service.Spec.Labels[convert.LabelNamespace]
if _, ok := statuses[name]; !ok {
statuses[name] = "deployed"
result["status"] = "deployed"
}
labelKey := fmt.Sprintf("coop-cloud.%s.version", name)
if version, ok := service.Spec.Labels[labelKey]; ok {
result["version"] = version
}
statuses[name] = result
}
}