1
0
Fork 0
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:
shravan 2020-04-04 21:06:55 +05:30
parent 2599b29a09
commit d43456b681

View file

@ -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
}