From a8b02d4dec83b89be46cdcb71e9a0cc481d4b67e Mon Sep 17 00:00:00 2001 From: Matthew Booth Date: Fri, 21 Nov 2025 08:25:57 +0000 Subject: [PATCH] Remove invalid kustomizeconfig from config/webhook This change has no effect on the output of this kustomization, but fixes a bug which can be triggered when using it 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 | 26 -------------------------- 2 files changed, 29 deletions(-) delete mode 100644 config/webhook/kustomizeconfig.yaml diff --git a/config/webhook/kustomization.yaml b/config/webhook/kustomization.yaml index 4e6732d9810..fe7a9cf4c6f 100644 --- a/config/webhook/kustomization.yaml +++ b/config/webhook/kustomization.yaml @@ -3,6 +3,3 @@ kind: Kustomization 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 39a1cc6f211..00000000000 --- a/config/webhook/kustomizeconfig.yaml +++ /dev/null @@ -1,26 +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 -