Add SYNC POLICY column to app view
parent
1e22843012
commit
3cfb6769cd
|
|
@ -2,6 +2,7 @@ package render
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
|
||||||
"github.com/derailed/k9s/internal/client"
|
"github.com/derailed/k9s/internal/client"
|
||||||
|
|
@ -23,6 +24,7 @@ func (Application) Header(ns string) Header {
|
||||||
HeaderColumn{Name: "NAME"},
|
HeaderColumn{Name: "NAME"},
|
||||||
HeaderColumn{Name: "SYNC STATUS"},
|
HeaderColumn{Name: "SYNC STATUS"},
|
||||||
HeaderColumn{Name: "HEALTH STATUS"},
|
HeaderColumn{Name: "HEALTH STATUS"},
|
||||||
|
HeaderColumn{Name: "SYNC POLICY"},
|
||||||
HeaderColumn{Name: "REVISION"},
|
HeaderColumn{Name: "REVISION"},
|
||||||
HeaderColumn{Name: "AGE", Time: true, Decorator: AgeDecorator},
|
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)
|
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{
|
r.Fields = Fields{
|
||||||
app.Name,
|
app.Name,
|
||||||
string(app.Status.Sync.Status),
|
string(app.Status.Sync.Status),
|
||||||
string(app.Status.Health.Status),
|
string(app.Status.Health.Status),
|
||||||
|
strings.Join(syncPolicies, ","),
|
||||||
string(app.Status.Sync.Revision),
|
string(app.Status.Sync.Revision),
|
||||||
toAge(app.ObjectMeta.CreationTimestamp),
|
toAge(app.ObjectMeta.CreationTimestamp),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue