mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
populate the map from a slice
This commit is contained in:
@@ -37,15 +37,15 @@ func (a IdSlice) Less(i, j int) bool {
|
|||||||
return a[i].Name() < a[j].Name()
|
return a[i].Name() < a[j].Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
var typeOrders = map[string]int{
|
var order = []string{"Namespace", "CustomResourceDefinition", "ServiceAccount",
|
||||||
"Namespace": 0,
|
"Role", "ClusterRole", "RoleBinding", "ClusterRoleBinding"}
|
||||||
"CustomResourceDefinition": 1,
|
var typeOrders = func() map[string]int {
|
||||||
"ServiceAccount": 2,
|
m := map[string]int{}
|
||||||
"Role": 3,
|
for i, n := range order {
|
||||||
"ClusterRole": 4,
|
m[n] = i
|
||||||
"RoleBinding": 5,
|
}
|
||||||
"ClusterRoleBinding": 6,
|
return m
|
||||||
}
|
}()
|
||||||
|
|
||||||
func gvkLess(i, j schema.GroupVersionKind) bool {
|
func gvkLess(i, j schema.GroupVersionKind) bool {
|
||||||
indexi, foundi := typeOrders[i.Kind]
|
indexi, foundi := typeOrders[i.Kind]
|
||||||
|
|||||||
Reference in New Issue
Block a user