Add SYNC POLICY column to app view

mine
Raphaël Pinson 2020-12-10 00:20:46 +01:00
parent 1e22843012
commit 3cfb6769cd
No known key found for this signature in database
GPG Key ID: A1AAC49E10CB2A8D
1 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package render
import (
"fmt"
"strings"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/derailed/k9s/internal/client"
@ -23,6 +24,7 @@ func (Application) Header(ns string) Header {
HeaderColumn{Name: "NAME"},
HeaderColumn{Name: "SYNC STATUS"},
HeaderColumn{Name: "HEALTH STATUS"},
HeaderColumn{Name: "SYNC POLICY"},
HeaderColumn{Name: "REVISION"},
HeaderColumn{Name: "AGE", Time: true, Decorator: AgeDecorator},
}
@ -41,10 +43,19 @@ func (Application) Render(o interface{}, ns string, r *Row) error {
}
r.ID = client.MetaFQN(app.ObjectMeta)
var syncPolicies []string
syncPolicy := app.Spec.SyncPolicy
if syncPolicy.Automated.SelfHeal {
syncPolicies = append(syncPolicies, "selfHeal")
}
if syncPolicy.Automated.Prune {
syncPolicies = append(syncPolicies, "prune")
}
r.Fields = Fields{
app.Name,
string(app.Status.Sync.Status),
string(app.Status.Health.Status),
strings.Join(syncPolicies, ","),
string(app.Status.Sync.Revision),
toAge(app.ObjectMeta.CreationTimestamp),
}