refac policy
parent
d54826327e
commit
a4d42aaf51
|
|
@ -293,14 +293,6 @@ var expectedConfig = `k9s:
|
|||
- kube-system
|
||||
view:
|
||||
active: ctx
|
||||
plugins:
|
||||
sniff:
|
||||
shortCut: ShiftS
|
||||
scopes:
|
||||
- po
|
||||
- dp
|
||||
args:
|
||||
"n": $NAMESPACE
|
||||
`
|
||||
|
||||
var resetConfig = `k9s:
|
||||
|
|
@ -317,12 +309,4 @@ var resetConfig = `k9s:
|
|||
- default
|
||||
view:
|
||||
active: po
|
||||
plugins:
|
||||
sniff:
|
||||
shortCut: ShiftS
|
||||
scopes:
|
||||
- po
|
||||
- dp
|
||||
args:
|
||||
"n": $NAMESPACE
|
||||
`
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ type K9s struct {
|
|||
CurrentCluster string `yaml:"currentCluster"`
|
||||
Clusters map[string]*Cluster `yaml:"clusters,omitempty"`
|
||||
Aliases map[string]string `yaml:"aliases,omitempty"`
|
||||
Plugins map[string]Plugin `yaml:"plugins"`
|
||||
}
|
||||
|
||||
// NewK9s create a new K9s configuration.
|
||||
|
|
|
|||
|
|
@ -230,11 +230,11 @@ func (v *policyView) parseRules(ns, binding string, rules []rbacv1.PolicyRule) r
|
|||
for _, na := range r.ResourceNames {
|
||||
n := fqn(k, na)
|
||||
m[fqn(ns, n)] = &resource.RowEvent{
|
||||
Fields: v.prepRow(ns, n, grp, binding, r.Verbs),
|
||||
Fields: append(v.prepRow(ns, n, grp, binding), r.Verbs...),
|
||||
}
|
||||
}
|
||||
m[fqn(ns, k)] = &resource.RowEvent{
|
||||
Fields: v.prepRow(ns, k, grp, binding, r.Verbs),
|
||||
Fields: append(v.prepRow(ns, k, grp, binding), r.Verbs...),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ func (v *policyView) parseRules(ns, binding string, rules []rbacv1.PolicyRule) r
|
|||
nres = "/" + nres
|
||||
}
|
||||
m[fqn(ns, nres)] = &resource.RowEvent{
|
||||
Fields: v.prepRow(ns, nres, resource.NAValue, binding, r.Verbs),
|
||||
Fields: append(v.prepRow(ns, nres, resource.NAValue, binding), r.Verbs...),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -251,19 +251,13 @@ func (v *policyView) parseRules(ns, binding string, rules []rbacv1.PolicyRule) r
|
|||
return m
|
||||
}
|
||||
|
||||
func (v *policyView) prepRow(ns, res, grp, binding string, verbs []string) resource.Row {
|
||||
func (v *policyView) prepRow(ns, res, grp, binding string) resource.Row {
|
||||
if grp != resource.NAValue {
|
||||
grp = toGroup(grp)
|
||||
}
|
||||
|
||||
return v.makeRow(ns, res, grp, binding, asVerbs(verbs...))
|
||||
}
|
||||
|
||||
func (*policyView) makeRow(ns, res, group, binding string, verbs []string) resource.Row {
|
||||
r := make(resource.Row, 0, len(policyHeader))
|
||||
r = append(r, ns, res, group, binding)
|
||||
|
||||
return append(r, verbs...)
|
||||
return append(r, ns, res, grp, binding)
|
||||
}
|
||||
|
||||
func mapSubject(subject string) string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue