Skip to content

Commit

Permalink
Merge pull request #758 from akutz/feature/remove-var-reference
Browse files Browse the repository at this point in the history
🌱 Remove vestigial kustomize var refs
  • Loading branch information
akutz authored Oct 18, 2024
2 parents a426900 + 7f4836b commit bddeb3b
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 bddeb3b

Please sign in to comment.