Relative Order of Mutating/Validating WebhookConfigs

MutatingWebhookConfig may have similar dependencies as the
ValidatingWebhookConfig. eg. a k8s cluster service. Therefore, it should
be ordered last as well.

This PR preserves the implicit ordering between CustomResources and the
webhook while introducing a relative order between the two webhooks.
i.e. MutatingWebhook should be created prior to the ValidatingWebhook

The change is an enhancement of #1104
This commit is contained in:
Asad Ali
2020-05-11 13:08:07 -07:00
parent f8ef55eeac
commit 74b45392fc
2 changed files with 5 additions and 1 deletions

View File

@@ -84,7 +84,6 @@ var orderFirst = []string{
"ResourceQuota",
"StorageClass",
"CustomResourceDefinition",
"MutatingWebhookConfiguration",
"ServiceAccount",
"PodSecurityPolicy",
"Role",
@@ -102,6 +101,7 @@ var orderFirst = []string{
"PodDisruptionBudget",
}
var orderLast = []string{
"MutatingWebhookConfiguration",
"ValidatingWebhookConfiguration",
}
var typeOrders = func() map[string]int {

View File

@@ -68,6 +68,10 @@ var lessThanTests = []struct {
Gvk{Group: "a", Version: "b", Kind: orderLast[0]}},
{Gvk{Group: "a", Version: "b", Kind: "CustomKindA"},
Gvk{Group: "a", Version: "b", Kind: "CustomKindB"}},
{Gvk{Group: "a", Version: "b", Kind: "CustomKindX"},
Gvk{Group: "a", Version: "b", Kind: "MutatingWebhookConfiguration"}},
{Gvk{Group: "a", Version: "b", Kind: "MutatingWebhookConfiguration"},
Gvk{Group: "a", Version: "b", Kind: "ValidatingWebhookConfiguration"}},
{Gvk{Group: "a", Version: "b", Kind: "CustomKindX"},
Gvk{Group: "a", Version: "b", Kind: "ValidatingWebhookConfiguration"}},
{Gvk{Group: "a", Version: "b", Kind: "APIService"},