diff --git a/pkg/webhooks/policymutation.go b/pkg/webhooks/policymutation.go index 7dfef34588..7211306adf 100644 --- a/pkg/webhooks/policymutation.go +++ b/pkg/webhooks/policymutation.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "reflect" + "sort" "strconv" "strings" @@ -415,5 +416,9 @@ func replacePodWithPodControllers(kinds []string, controllers []string) []string output = append(output, kind) } + sort.Slice(output, func(i, j int) bool { + return output[i] < output[j] + }) + return output }