Skip to content

Commit

Permalink
Remove vestigial kustomize var refs
Browse files Browse the repository at this point in the history
This patch removes the use of vestigial kustomize
var references. These taught kustomize about sources
of variables used elsewhere and have been made obsolete
by the use of the new replacements directive.
  • Loading branch information
akutz committed Oct 18, 2024
1 parent a426900 commit 7f4836b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 38 deletions.
2 changes: 1 addition & 1 deletion config/certmanager/certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
name: serving-cert
namespace: system
spec:
# WEBHOOK_SERVICE_NAME_PLACEHOLDER and WEBHOOK_SERVICE_NAMESPACE_PLACEHOLDER will be substituted by kustomize
Expand Down
1 change: 1 addition & 0 deletions config/certmanager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- certificate.yaml

Expand Down
13 changes: 1 addition & 12 deletions config/certmanager/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# nameReference teaches Kustomize which fields represent a resource name.
nameReference:
- kind: Issuer
group: cert-manager.io
fieldSpecs:
- kind: Certificate
group: cert-manager.io
path: spec/issuerRef/name

varReference:
- kind: Certificate
group: cert-manager.io
path: spec/commonName
- kind: Certificate
group: cert-manager.io
path: spec/dnsNames
- kind: Certificate
group: cert-manager.io
path: spec/secretName
6 changes: 2 additions & 4 deletions config/crd/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
# nameReference teaches Kustomize which fields represent a resource name.
nameReference:
- kind: Service
version: v1
Expand All @@ -7,11 +7,9 @@ nameReference:
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name

# namespace teaches Kustomize which fields represent a resource namespace.
namespace:
- kind: CustomResourceDefinition
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
3 changes: 0 additions & 3 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

configurations:
- kustomizeconfig.yaml

resources:
- ../crd
- ../manager
Expand Down
13 changes: 0 additions & 13 deletions config/default/kustomizeconfig.yaml

This file was deleted.

7 changes: 2 additions & 5 deletions config/webhook/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# 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 teaches Kustomize which fields represent a resource name.
nameReference:
- kind: Service
version: v1
Expand All @@ -11,6 +10,7 @@ nameReference:
group: admissionregistration.k8s.io
path: webhooks/clientConfig/service/name

# namespace teaches Kustomize which fields represent a resource namespace.
namespace:
- kind: MutatingWebhookConfiguration
group: admissionregistration.k8s.io
Expand All @@ -20,6 +20,3 @@ namespace:
group: admissionregistration.k8s.io
path: webhooks/clientConfig/service/namespace
create: true

varReference:
- path: metadata/annotations

0 comments on commit 7f4836b

Please sign in to comment.