Skip to content

Commit a995561

Browse files
committed
config: Enable manifest items for validating webhook.
1 parent 45cae9b commit a995561

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

config/crd/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ patchesStrategicMerge:
1212
# patches here are for enabling the conversion webhook for each CRD
1313
#- patches/webhook_in_postgresconfigs.yaml
1414
#- patches/webhook_in_postgrespublications.yaml
15-
#- patches/webhook_in_postgresgrants.yaml
15+
- patches/webhook_in_postgresgrants.yaml
1616
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1717

1818
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
1919
# patches here are for enabling the CA injection for each CRD
2020
#- patches/cainjection_in_postgresconfigs.yaml
2121
#- patches/cainjection_in_postgrespublications.yaml
22-
#- patches/cainjection_in_postgresgrants.yaml
22+
- patches/cainjection_in_postgresgrants.yaml
2323
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
2424

2525
# the following config is for teaching kustomize how to do kustomization for CRDs.

config/default/kustomization.yaml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ bases:
1818
- ../manager
1919
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2020
# crd/kustomization.yaml
21-
#- ../webhook
21+
- ../webhook
2222
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
23-
#- ../certmanager
23+
- ../certmanager
2424
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2525
#- ../prometheus
2626

@@ -36,39 +36,39 @@ patchesStrategicMerge:
3636

3737
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3838
# crd/kustomization.yaml
39-
#- manager_webhook_patch.yaml
39+
- manager_webhook_patch.yaml
4040

4141
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
4242
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
4343
# 'CERTMANAGER' needs to be enabled to use ca injection
44-
#- webhookcainjection_patch.yaml
44+
- webhookcainjection_patch.yaml
4545

4646
# the following config is for teaching kustomize how to do var substitution
4747
vars:
4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
49-
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
50-
# objref:
51-
# kind: Certificate
52-
# group: cert-manager.io
53-
# version: v1
54-
# name: serving-cert # this name should match the one in certificate.yaml
55-
# fieldref:
56-
# fieldpath: metadata.namespace
57-
#- name: CERTIFICATE_NAME
58-
# objref:
59-
# kind: Certificate
60-
# group: cert-manager.io
61-
# version: v1
62-
# name: serving-cert # this name should match the one in certificate.yaml
63-
#- name: SERVICE_NAMESPACE # namespace of the service
64-
# objref:
65-
# kind: Service
66-
# version: v1
67-
# name: webhook-service
68-
# fieldref:
69-
# fieldpath: metadata.namespace
70-
#- name: SERVICE_NAME
71-
# objref:
72-
# kind: Service
73-
# version: v1
74-
# name: webhook-service
49+
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
50+
objref:
51+
kind: Certificate
52+
group: cert-manager.io
53+
version: v1
54+
name: serving-cert # this name should match the one in certificate.yaml
55+
fieldref:
56+
fieldpath: metadata.namespace
57+
- name: CERTIFICATE_NAME
58+
objref:
59+
kind: Certificate
60+
group: cert-manager.io
61+
version: v1
62+
name: serving-cert # this name should match the one in certificate.yaml
63+
- name: SERVICE_NAMESPACE # namespace of the service
64+
objref:
65+
kind: Service
66+
version: v1
67+
name: webhook-service
68+
fieldref:
69+
fieldpath: metadata.namespace
70+
- name: SERVICE_NAME
71+
objref:
72+
kind: Service
73+
version: v1
74+
name: webhook-service

config/default/manager_webhook_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: controller-manager
5-
namespace: system
5+
namespace: postgres-config-system
66
spec:
77
template:
88
spec:

config/default/webhookcainjection_patch.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# This patch add annotation to admission webhook config and
22
# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize.
3-
apiVersion: admissionregistration.k8s.io/v1
4-
kind: MutatingWebhookConfiguration
5-
metadata:
6-
name: mutating-webhook-configuration
7-
annotations:
8-
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
9-
---
3+
# apiVersion: admissionregistration.k8s.io/v1
4+
# kind: MutatingWebhookConfiguration
5+
# metadata:
6+
# name: mutating-webhook-configuration
7+
# annotations:
8+
# cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
9+
# ---
1010
apiVersion: admissionregistration.k8s.io/v1
1111
kind: ValidatingWebhookConfiguration
1212
metadata:

config/webhook/manifests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ webhooks:
1212
clientConfig:
1313
service:
1414
name: webhook-service
15-
namespace: system
15+
namespace: postgres-config-system
1616
path: /validate-postgres-glints-com-v1alpha1-postgresgrant
1717
failurePolicy: Fail
1818
name: vpostgresgrant.kb.io

config/webhook/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
kind: Service
44
metadata:
55
name: webhook-service
6-
namespace: system
6+
namespace: postgres-config-system
77
spec:
88
ports:
99
- port: 443

0 commit comments

Comments
 (0)