mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-30 03:15:05 +00:00
753_avoiding_duplicate_vals
This commit is contained in:
parent
2599b29a09
commit
d43456b681
1 changed files with 15 additions and 6 deletions
|
@ -398,13 +398,22 @@ func defaultPodControllerAnnotation(ann map[string]string) ([]byte, error) {
|
|||
|
||||
func replacePodWithPodControllers(kinds []string, controllers []string) []string {
|
||||
|
||||
var kindsWithoutPod []string
|
||||
kindMap := make(map[string]bool)
|
||||
|
||||
for _, kind := range kinds {
|
||||
if strings.ToLower(kind) == "pod" {
|
||||
continue
|
||||
}
|
||||
kindsWithoutPod = append(kindsWithoutPod, kind)
|
||||
kindMap[kind] = true
|
||||
}
|
||||
|
||||
return append(kindsWithoutPod, controllers...)
|
||||
delete(kindMap, "Pod")
|
||||
|
||||
for _, controller := range controllers {
|
||||
kindMap[controller] = true
|
||||
}
|
||||
|
||||
output := make([]string, 0, len(kindMap))
|
||||
for kind := range kindMap {
|
||||
output = append(output, kind)
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue