diff --git a/pkg/controllers/webhook/utils.go b/pkg/controllers/webhook/utils.go index 40fe259b55..4cc330b100 100644 --- a/pkg/controllers/webhook/utils.go +++ b/pkg/controllers/webhook/utils.go @@ -86,6 +86,10 @@ func (wh *webhook) buildRulesWithOperations(final map[string][]admissionregistra continue } + slices.SortFunc(operations, func(a, b admissionregistrationv1.OperationType) int { + return cmp.Compare(a, b) + }) + rules = append(rules, admissionregistrationv1.RuleWithOperations{ Rule: admissionregistrationv1.Rule{ APIGroups: []string{gv.Group}, diff --git a/test/conformance/chainsaw/webhook-configurations/webhook-registeration/webhook.yaml b/test/conformance/chainsaw/webhook-configurations/webhook-registeration/webhook.yaml index 2924b1115c..86d9040843 100644 --- a/test/conformance/chainsaw/webhook-configurations/webhook-registeration/webhook.yaml +++ b/test/conformance/chainsaw/webhook-configurations/webhook-registeration/webhook.yaml @@ -17,10 +17,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - pods - pods/ephemeralcontainers diff --git a/test/conformance/chainsaw/webhooks/all-scale/webhooks.yaml b/test/conformance/chainsaw/webhooks/all-scale/webhooks.yaml index 07c43a20f7..b9803d075c 100644 --- a/test/conformance/chainsaw/webhooks/all-scale/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/all-scale/webhooks.yaml @@ -11,10 +11,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*/scale' scope: '*' diff --git a/test/conformance/chainsaw/webhooks/clusterpolicy/webhooks.yaml b/test/conformance/chainsaw/webhooks/clusterpolicy/webhooks.yaml index 281adc9a9f..65f2fd4fac 100644 --- a/test/conformance/chainsaw/webhooks/clusterpolicy/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/clusterpolicy/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*' - pods/ephemeralcontainers diff --git a/test/conformance/chainsaw/webhooks/double-wildcard/webhooks.yaml b/test/conformance/chainsaw/webhooks/double-wildcard/webhooks.yaml index 13b2b04673..9c6be5ad9c 100644 --- a/test/conformance/chainsaw/webhooks/double-wildcard/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/double-wildcard/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*/*' scope: '*' diff --git a/test/conformance/chainsaw/webhooks/dyn-op-validate-multiple/webhooks.yaml b/test/conformance/chainsaw/webhooks/dyn-op-validate-multiple/webhooks.yaml index 49a5840dcf..663d61d274 100644 --- a/test/conformance/chainsaw/webhooks/dyn-op-validate-multiple/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/dyn-op-validate-multiple/webhooks.yaml @@ -11,9 +11,9 @@ webhooks: apiVersions: - v1 operations: + - CONNECT - CREATE - UPDATE - - CONNECT resources: - configmaps scope: Namespaced diff --git a/test/conformance/chainsaw/webhooks/only-pod/webhooks.yaml b/test/conformance/chainsaw/webhooks/only-pod/webhooks.yaml index 239d24359c..6d02990ce0 100644 --- a/test/conformance/chainsaw/webhooks/only-pod/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/only-pod/webhooks.yaml @@ -11,10 +11,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - pods - pods/ephemeralcontainers diff --git a/test/conformance/chainsaw/webhooks/pod-all-subresources/webhooks.yaml b/test/conformance/chainsaw/webhooks/pod-all-subresources/webhooks.yaml index 1a1b357447..677edeb0de 100644 --- a/test/conformance/chainsaw/webhooks/pod-all-subresources/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/pod-all-subresources/webhooks.yaml @@ -11,10 +11,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - pods/attach - pods/binding diff --git a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-different-resource-group/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-different-resource-group/webhooks.yaml index 16efe5042c..cbb00e009f 100644 --- a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-different-resource-group/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-different-resource-group/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - configmaps scope: Namespaced @@ -24,10 +24,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - customresourcedefinitions scope: '*' diff --git a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-clusterscoped-resources/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-clusterscoped-resources/webhooks.yaml index 16efe5042c..cbb00e009f 100644 --- a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-clusterscoped-resources/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-clusterscoped-resources/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - configmaps scope: Namespaced @@ -24,10 +24,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - customresourcedefinitions scope: '*' diff --git a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-resources/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-resources/webhooks.yaml index bd8efe5cdc..bd4d739c2c 100644 --- a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-resources/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-namespaced-resources/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - 'v1' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - 'configmaps' - 'secrets' diff --git a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-same-resource/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-same-resource/webhooks.yaml index ba197fde8e..9f38803a2d 100644 --- a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-same-resource/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-same-resource/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - 'v1' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - 'configmaps' scope: 'Namespaced' diff --git a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-wildcard-resource/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-wildcard-resource/webhooks.yaml index 281adc9a9f..65f2fd4fac 100644 --- a/test/conformance/chainsaw/webhooks/policy-clusterpolicy-wildcard-resource/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-clusterpolicy-wildcard-resource/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*' - pods/ephemeralcontainers diff --git a/test/conformance/chainsaw/webhooks/policy-different-resource-group/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-different-resource-group/webhooks.yaml index 58fb6ac425..a61f36afb5 100644 --- a/test/conformance/chainsaw/webhooks/policy-different-resource-group/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-different-resource-group/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - configmaps scope: Namespaced @@ -24,10 +24,10 @@ webhooks: apiVersions: - v1 operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - deployments scope: Namespaced diff --git a/test/conformance/chainsaw/webhooks/policy-wildcard-resource/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy-wildcard-resource/webhooks.yaml index 281adc9a9f..65f2fd4fac 100644 --- a/test/conformance/chainsaw/webhooks/policy-wildcard-resource/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy-wildcard-resource/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*' - pods/ephemeralcontainers diff --git a/test/conformance/chainsaw/webhooks/policy/webhooks.yaml b/test/conformance/chainsaw/webhooks/policy/webhooks.yaml index 544aa42117..c1627084d9 100644 --- a/test/conformance/chainsaw/webhooks/policy/webhooks.yaml +++ b/test/conformance/chainsaw/webhooks/policy/webhooks.yaml @@ -12,10 +12,10 @@ webhooks: apiVersions: - '*' operations: - - CREATE - - UPDATE - - DELETE - CONNECT + - CREATE + - DELETE + - UPDATE resources: - '*' - pods/ephemeralcontainers