Skip to content

Commit df77bbc

Browse files
Consolidate cert-manager kustomize pieces into the one component
1 parent 2abd785 commit df77bbc

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed

config/certmanager/kustomization.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
apiVersion: kustomize.config.k8s.io/v1beta1
2-
kind: Kustomization
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
33
configurations:
44
- kustomizeconfig.yaml
55
resources:
66
- certificate.yaml
7+
patches:
8+
# patches here are for enabling the CA injection for each CRD
9+
- path: cainjection_in_targetgroupbindings_patch.yaml
10+
- path: cainjection_in_ingressclassparams_patch.yaml
11+
# This patch add annotation to admission webhook config and
12+
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
13+
- target:
14+
kind: (MutatingWebhookConfiguration|ValidatingWebhookConfiguration)
15+
patch: |-
16+
apiVersion: admissionregistration.k8s.io/v1
17+
kind: dummy
18+
metadata:
19+
name: webhook
20+
annotations:
21+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)

config/crd/kustomization.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,3 @@ patches:
1919
#- path: patches/webhook_in_targetgroupbindings.yaml
2020
#- path: patches/webhook_in_ingressclassparams.yaml
2121
# +kubebuilder:scaffold:crdkustomizewebhookpatch
22-
23-
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
24-
# patches here are for enabling the CA injection for each CRD
25-
#- path: patches/cainjection_in_targetgroupbindings.yaml
26-
#- path: patches/cainjection_in_ingressclassparams.yaml
27-
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
28-

config/default/kustomization.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,18 @@ resources:
2222
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2323
# crd/kustomization.yaml
2424
- ../webhook
25-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
25+
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
26+
#- ../prometheus
27+
28+
components:
29+
# To disable cert-manager comment out the following line, the 'webhook' component is required
2630
- ../certmanager
27-
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
28-
#- ../prometheus
2931

3032
patches:
3133
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3234
# crd/kustomization.yaml
3335
- path: controller_webhook_patch.yaml
3436

35-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
36-
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
37-
# 'CERTMANAGER' needs to be enabled to use ca injection
38-
# This patch add annotation to admission webhook config and
39-
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
40-
- target:
41-
kind: (MutatingWebhookConfiguration|ValidatingWebhookConfiguration)
42-
patch: |-
43-
apiVersion: admissionregistration.k8s.io/v1
44-
kind: dummy
45-
metadata:
46-
name: webhook
47-
annotations:
48-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
49-
5037
# the following config is for teaching kustomize how to do var substitution
5138
vars:
5239
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.

0 commit comments

Comments
 (0)