From c850219b55e1c60e71151c0299e64d44245937f9 Mon Sep 17 00:00:00 2001 From: Matthew Booth Date: Fri, 21 Nov 2025 10:33:35 +0000 Subject: [PATCH] Remove invalid kustomizeconfig from config/webhook This change has no effect on the output of this kustomization because the removed configuration was redundant. However, it fixes a bug which can be triggered when using this kustomization as a base for another kustomization. kustomizeconfig contained 3 directives: * nameReference * namespace * varReference varReference is redundant because vars are no longer used in this kustomize: they are deprecated and usage was removed some time ago. nameReference is redundant because the specified configuration is already in kustomize's defaults. However, nameReference is the only important transformation here. namespace is incorrect. It directs the namespace transformer to update webhooks/clientConfig/service/namespace. However, this is not the intended function of the namespace transformer: it should only set the namespace directly on objects and allow references to be updated automatically by nameReference. Configuring it to update a reference directly leaves kustomize with inconsistent internal state. Depending on execution order this can cause a subsequent transformation to fail to update the reference when it makes further changes to the Service object. --- config/webhook/kustomization.yaml | 3 --- config/webhook/kustomizeconfig.yaml | 25 ------------------------- 2 files changed, 28 deletions(-) delete mode 100644 config/webhook/kustomizeconfig.yaml diff --git a/config/webhook/kustomization.yaml b/config/webhook/kustomization.yaml index 9cf26134e4..36d4cc6e40 100644 --- a/config/webhook/kustomization.yaml +++ b/config/webhook/kustomization.yaml @@ -1,6 +1,3 @@ resources: - manifests.yaml - service.yaml - -configurations: -- kustomizeconfig.yaml diff --git a/config/webhook/kustomizeconfig.yaml b/config/webhook/kustomizeconfig.yaml deleted file mode 100644 index 25e21e3c96..0000000000 --- a/config/webhook/kustomizeconfig.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# the following config is for teaching kustomize where to look at when substituting vars. -# It requires kustomize v2.1.0 or newer to work properly. -nameReference: -- kind: Service - version: v1 - fieldSpecs: - - kind: MutatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/name - - kind: ValidatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/name - -namespace: -- kind: MutatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/namespace - create: true -- kind: ValidatingWebhookConfiguration - group: admissionregistration.k8s.io - path: webhooks/clientConfig/service/namespace - create: true - -varReference: -- path: metadata/annotations