fix: correct webhook order to match Kubernetes admission flow

Place APIService before webhooks, with MutatingWebhookConfiguration
before ValidatingWebhookConfiguration to match standard admission control.

Signed-off-by: Mike Delucchi <git@zanuka.com>
pull/30701/head
Mike Delucchi 6 months ago
parent 1003a3c93f
commit e1425f1aa5

@ -64,18 +64,19 @@ var InstallOrder KindSortOrder = []string{
"CronJob", "CronJob",
"IngressClass", "IngressClass",
"Ingress", "Ingress",
"APIService",
"MutatingWebhookConfiguration", "MutatingWebhookConfiguration",
"ValidatingWebhookConfiguration", "ValidatingWebhookConfiguration",
"APIService",
} }
// UninstallOrder is the order in which manifests should be uninstalled (by Kind). // UninstallOrder is the order in which manifests should be uninstalled (by Kind).
// //
// Those occurring earlier in the list get uninstalled before those occurring later in the list. // Those occurring earlier in the list get uninstalled before those occurring later in the list.
var UninstallOrder KindSortOrder = []string{ var UninstallOrder KindSortOrder = []string{
"APIService", // For uninstall, we remove validation before mutation to ensure webhooks don't block removal
"ValidatingWebhookConfiguration", "ValidatingWebhookConfiguration",
"MutatingWebhookConfiguration", "MutatingWebhookConfiguration",
"APIService",
"Ingress", "Ingress",
"IngressClass", "IngressClass",
"Service", "Service",

@ -188,8 +188,8 @@ func TestKindSorter(t *testing.T) {
order KindSortOrder order KindSortOrder
expected string expected string
}{ }{
{"install", InstallOrder, "FaAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvMVw!"}, {"install", InstallOrder, "FaAbcC3deEf1gh2iIjJkKlLmnopqrxstuUvwMV!"},
{"uninstall", UninstallOrder, "wVMvUmutsxrqponLlKkJjIi2hg1fEed3CcbAaF!"}, {"uninstall", UninstallOrder, "VMwvUmutsxrqponLlKkJjIi2hg1fEed3CcbAaF!"},
} { } {
var buf bytes.Buffer var buf bytes.Buffer
t.Run(test.description, func(t *testing.T) { t.Run(test.description, func(t *testing.T) {

Loading…
Cancel
Save