Skip to content

Commit e4dc313

Browse files
authored
Inject the webhook CA into the validated CRDs (#429) (#430)
1 parent 26ec4de commit e4dc313

9 files changed

+35
-13
lines changed

config/crd-hub/kustomization.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ patches:
1212

1313
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1414
# patches here are for enabling the CA injection for each CRD
15-
#- path: patches/cainjection_in_managedclustermodules.yaml
15+
- path: patches/cainjection_in_managedclustermodules.yaml
1616
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
1717

config/crd-hub/patches/cainjection_in_managedclustermodules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ metadata:
55
annotations:
66
# `default` and `serving-cert` may be substituted by kustomize
77
cert-manager.io/inject-ca-from: default/serving-cert
8-
name: managedclustermodules.kmm.sigs.x-k8s.io
8+
name: managedclustermodules.hub.kmm.sigs.x-k8s.io

config/crd-hub/patches/webhook_in_managedclustermodules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
5-
name: managedclustermodules.kmm.sigs.x-k8s.io
5+
name: managedclustermodules.hub.kmm.sigs.x-k8s.io
66
spec:
77
conversion:
88
strategy: Webhook

config/crd/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ patches:
1818

1919
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
2020
# patches here are for enabling the CA injection for each CRD
21-
#- path: patches/cainjection_in_modules.yaml
22-
#- path: patches/cainjection_in_managedclustermodules.yaml
21+
- path: patches/cainjection_in_modules.yaml
22+
#- path: patches/cainjection_in_preflightvalidations.yaml
2323
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
2424

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

config/crd/patches/cainjection_in_managedclustermodules.yaml renamed to config/crd/patches/cainjection_in_preflightvalidations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ metadata:
55
annotations:
66
# `default` and `serving-cert` may be substituted by kustomize
77
cert-manager.io/inject-ca-from: default/serving-cert
8-
name: managedclustermodules.kmm.sigs.x-k8s.io
8+
name: preflightvalidations.kmm.sigs.x-k8s.io

config/crd/patches/webhook_in_managedclustermodules.yaml renamed to config/crd/patches/webhook_in_preflightvalidations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
5-
name: managedclustermodules.kmm.sigs.x-k8s.io
5+
name: preflightvalidations.kmm.sigs.x-k8s.io
66
spec:
77
conversion:
88
strategy: Webhook

config/default-hub/kustomization.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ replacements:
4040
kind: Certificate
4141
fieldPath: metadata.namespace
4242
targets:
43+
- select:
44+
kind: CustomResourceDefinition
45+
fieldPaths:
46+
- metadata.annotations.[cert-manager.io/inject-ca-from]
47+
options:
48+
delimiter: /
4349
- select:
4450
kind: ValidatingWebhookConfiguration
4551
fieldPaths:
@@ -50,6 +56,13 @@ replacements:
5056
kind: Certificate
5157
fieldPath: metadata.name
5258
targets:
59+
- select:
60+
kind: CustomResourceDefinition
61+
fieldPaths:
62+
- metadata.annotations.[cert-manager.io/inject-ca-from]
63+
options:
64+
delimiter: /
65+
index: 1
5366
- select:
5467
kind: ValidatingWebhookConfiguration
5568
fieldPaths:

config/default/kustomization.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ replacements:
3939
kind: Certificate
4040
fieldPath: metadata.namespace
4141
targets:
42+
- select:
43+
kind: CustomResourceDefinition
44+
name: modules.kmm.sigs.x-k8s.io
45+
fieldPaths:
46+
- metadata.annotations.[cert-manager.io/inject-ca-from]
47+
options:
48+
delimiter: /
4249
- select:
4350
kind: ValidatingWebhookConfiguration
4451
fieldPaths:
@@ -49,6 +56,14 @@ replacements:
4956
kind: Certificate
5057
fieldPath: metadata.name
5158
targets:
59+
- select:
60+
kind: CustomResourceDefinition
61+
name: modules.kmm.sigs.x-k8s.io
62+
fieldPaths:
63+
- metadata.annotations.[cert-manager.io/inject-ca-from]
64+
options:
65+
delimiter: /
66+
index: 1
5267
- select:
5368
kind: ValidatingWebhookConfiguration
5469
fieldPaths:

config/manager-base/kustomization.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ images:
1010
newTag: latest
1111

1212
patches:
13-
# Protect the /metrics endpoint by putting it behind auth.
14-
# If you want your controller-manager to expose the /metrics
15-
# endpoint w/o any authn/z, please comment the following line.
1613
- path: manager_auth_proxy_patch.yaml
17-
18-
# Mount the controller config file for loading manager configurations
19-
# through a ComponentConfig type
2014
- path: manager_config_patch.yaml
2115

2216
configurations:

0 commit comments

Comments
 (0)