Skip to content

Commit 6593eff

Browse files
Improve UX by uncomment webhooks replacements automatically
1 parent e812c0c commit 6593eff

File tree

23 files changed

+687
-734
lines changed

23 files changed

+687
-734
lines changed

.github/workflows/test-e2e-samples.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ jobs:
3939

4040
- name: Prepare project-v4
4141
run: |
42+
# Enable [METRICS-WITH-CERTS] by uncommenting the lines in kustomization.yaml
4243
KUSTOMIZATION_FILE_PATH="testdata/project-v4/config/default/kustomization.yaml"
43-
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
4444
sed -i '47,49s/^#//' $KUSTOMIZATION_FILE_PATH
45-
# Uncomment all cert-manager injections
46-
sed -i '59,234s/^#//' $KUSTOMIZATION_FILE_PATH
47-
sed -i '236,251s/^#//' $KUSTOMIZATION_FILE_PATH
45+
sed -i '60,156s/^#//' $KUSTOMIZATION_FILE_PATH
4846
cd testdata/project-v4/
4947
go mod tidy
5048
@@ -81,17 +79,6 @@ jobs:
8179

8280
- name: Prepare project-v4-with-plugins
8381
run: |
84-
KUSTOMIZATION_FILE_PATH="testdata/project-v4-with-plugins/config/default/kustomization.yaml"
85-
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
86-
# Uncomment only ValidatingWebhookConfiguration
87-
# from cert-manager replaces; we are leaving defaulting uncommented
88-
# since this sample has no defaulting webhooks
89-
sed -i '59,77s/^#//' $KUSTOMIZATION_FILE_PATH
90-
sed -i '90,107s/^#//' $KUSTOMIZATION_FILE_PATH
91-
sed -i '120,186s/^#//' $KUSTOMIZATION_FILE_PATH
92-
# Uncomment only --conversion webhooks CA injection
93-
sed -i '219,234s/^#//' $KUSTOMIZATION_FILE_PATH
94-
sed -i '236,251s/^#//' $KUSTOMIZATION_FILE_PATH
9582
cd testdata/project-v4-with-plugins/
9683
go mod tidy
9784
@@ -128,13 +115,6 @@ jobs:
128115

129116
- name: Prepare project-v4-multigroup
130117
run: |
131-
KUSTOMIZATION_FILE_PATH="testdata/project-v4-multigroup/config/default/kustomization.yaml"
132-
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
133-
# Uncomment all cert-manager injections for webhooks only
134-
sed -i '59,77s/^#//' $KUSTOMIZATION_FILE_PATH
135-
sed -i '90,107s/^#//' $KUSTOMIZATION_FILE_PATH
136-
sed -i '120,234s/^#//' $KUSTOMIZATION_FILE_PATH
137-
sed -i '236,251s/^#//' $KUSTOMIZATION_FILE_PATH
138118
cd testdata/project-v4-multigroup
139119
go mod tidy
140120

docs/book/src/cronjob-tutorial/testdata/project/config/default/kustomization.yaml

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -116,44 +116,44 @@ replacements:
116116
delimiter: '.'
117117
index: 1
118118
create: true
119-
120-
- source: # Uncomment the following block if you have any webhook
121-
kind: Service
122-
version: v1
123-
name: webhook-service
124-
fieldPath: .metadata.name # Name of the service
125-
targets:
126-
- select:
127-
kind: Certificate
128-
group: cert-manager.io
129-
version: v1
130-
name: serving-cert
131-
fieldPaths:
132-
- .spec.dnsNames.0
133-
- .spec.dnsNames.1
134-
options:
135-
delimiter: '.'
136-
index: 0
137-
create: true
138-
- source:
139-
kind: Service
140-
version: v1
141-
name: webhook-service
142-
fieldPath: .metadata.namespace # Namespace of the service
143-
targets:
144-
- select:
145-
kind: Certificate
146-
group: cert-manager.io
147-
version: v1
148-
name: serving-cert
149-
fieldPaths:
150-
- .spec.dnsNames.0
151-
- .spec.dnsNames.1
152-
options:
153-
delimiter: '.'
154-
index: 1
155-
create: true
156-
119+
#
120+
# - source: # Uncomment the following block if you have any webhook
121+
# kind: Service
122+
# version: v1
123+
# name: webhook-service
124+
# fieldPath: .metadata.name # Name of the service
125+
# targets:
126+
# - select:
127+
# kind: Certificate
128+
# group: cert-manager.io
129+
# version: v1
130+
# name: serving-cert
131+
# fieldPaths:
132+
# - .spec.dnsNames.0
133+
# - .spec.dnsNames.1
134+
# options:
135+
# delimiter: '.'
136+
# index: 0
137+
# create: true
138+
# - source:
139+
# kind: Service
140+
# version: v1
141+
# name: webhook-service
142+
# fieldPath: .metadata.namespace # Namespace of the service
143+
# targets:
144+
# - select:
145+
# kind: Certificate
146+
# group: cert-manager.io
147+
# version: v1
148+
# name: serving-cert
149+
# fieldPaths:
150+
# - .spec.dnsNames.0
151+
# - .spec.dnsNames.1
152+
# options:
153+
# delimiter: '.'
154+
# index: 1
155+
# create: true
156+
#
157157
- source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
158158
kind: Certificate
159159
group: cert-manager.io
@@ -169,22 +169,23 @@ replacements:
169169
delimiter: '/'
170170
index: 0
171171
create: true
172-
- source:
173-
kind: Certificate
174-
group: cert-manager.io
175-
version: v1
176-
name: serving-cert
177-
fieldPath: .metadata.name
178-
targets:
179-
- select:
180-
kind: ValidatingWebhookConfiguration
181-
fieldPaths:
182-
- .metadata.annotations.[cert-manager.io/inject-ca-from]
183-
options:
184-
delimiter: '/'
185-
index: 1
186-
create: true
187172

173+
# - source:
174+
# kind: Certificate
175+
# group: cert-manager.io
176+
# version: v1
177+
# name: serving-cert
178+
# fieldPath: .metadata.name
179+
# targets:
180+
# - select:
181+
# kind: ValidatingWebhookConfiguration
182+
# fieldPaths:
183+
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
184+
# options:
185+
# delimiter: '/'
186+
# index: 1
187+
# create: true
188+
#
188189
- source: # Uncomment the following block if you have a DefaultingWebhook (--defaulting )
189190
kind: Certificate
190191
group: cert-manager.io
@@ -200,21 +201,22 @@ replacements:
200201
delimiter: '/'
201202
index: 0
202203
create: true
203-
- source:
204-
kind: Certificate
205-
group: cert-manager.io
206-
version: v1
207-
name: serving-cert
208-
fieldPath: .metadata.name
209-
targets:
210-
- select:
211-
kind: MutatingWebhookConfiguration
212-
fieldPaths:
213-
- .metadata.annotations.[cert-manager.io/inject-ca-from]
214-
options:
215-
delimiter: '/'
216-
index: 1
217-
create: true
204+
205+
# - source:
206+
# kind: Certificate
207+
# group: cert-manager.io
208+
# version: v1
209+
# name: serving-cert
210+
# fieldPath: .metadata.name
211+
# targets:
212+
# - select:
213+
# kind: MutatingWebhookConfiguration
214+
# fieldPaths:
215+
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
216+
# options:
217+
# delimiter: '/'
218+
# index: 1
219+
# create: true
218220
#
219221
# - source: # Uncomment the following block if you have a ConversionWebhook (--conversion)
220222
# kind: Certificate

docs/book/src/cronjob-tutorial/testdata/project/dist/install.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,8 +4253,8 @@ metadata:
42534253
namespace: project-system
42544254
spec:
42554255
dnsNames:
4256-
- project-webhook-service.project-system.svc
4257-
- project-webhook-service.project-system.svc.cluster.local
4256+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
4257+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
42584258
issuerRef:
42594259
kind: Issuer
42604260
name: project-selfsigned-issuer
@@ -4309,7 +4309,7 @@ apiVersion: admissionregistration.k8s.io/v1
43094309
kind: MutatingWebhookConfiguration
43104310
metadata:
43114311
annotations:
4312-
cert-manager.io/inject-ca-from: project-system/project-serving-cert
4312+
cert-manager.io/inject-ca-from: project-system
43134313
name: project-mutating-webhook-configuration
43144314
webhooks:
43154315
- admissionReviewVersions:
@@ -4337,7 +4337,7 @@ apiVersion: admissionregistration.k8s.io/v1
43374337
kind: ValidatingWebhookConfiguration
43384338
metadata:
43394339
annotations:
4340-
cert-manager.io/inject-ca-from: project-system/project-serving-cert
4340+
cert-manager.io/inject-ca-from: project-system
43414341
name: project-validating-webhook-configuration
43424342
webhooks:
43434343
- admissionReviewVersions:

docs/book/src/multiversion-tutorial/testdata/project/config/crd/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ patches:
1313

1414
# [WEBHOOK] To enable webhook, uncomment the following section
1515
# the following config is for teaching kustomize how to do kustomization for CRDs.
16-
configurations:
17-
- kustomizeconfig.yaml
16+
#configurations:
17+
#- kustomizeconfig.yaml

docs/book/src/multiversion-tutorial/testdata/project/config/default/kustomization.yaml

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -116,44 +116,44 @@ replacements:
116116
delimiter: '.'
117117
index: 1
118118
create: true
119-
120-
- source: # Uncomment the following block if you have any webhook
121-
kind: Service
122-
version: v1
123-
name: webhook-service
124-
fieldPath: .metadata.name # Name of the service
125-
targets:
126-
- select:
127-
kind: Certificate
128-
group: cert-manager.io
129-
version: v1
130-
name: serving-cert
131-
fieldPaths:
132-
- .spec.dnsNames.0
133-
- .spec.dnsNames.1
134-
options:
135-
delimiter: '.'
136-
index: 0
137-
create: true
138-
- source:
139-
kind: Service
140-
version: v1
141-
name: webhook-service
142-
fieldPath: .metadata.namespace # Namespace of the service
143-
targets:
144-
- select:
145-
kind: Certificate
146-
group: cert-manager.io
147-
version: v1
148-
name: serving-cert
149-
fieldPaths:
150-
- .spec.dnsNames.0
151-
- .spec.dnsNames.1
152-
options:
153-
delimiter: '.'
154-
index: 1
155-
create: true
156-
119+
#
120+
# - source: # Uncomment the following block if you have any webhook
121+
# kind: Service
122+
# version: v1
123+
# name: webhook-service
124+
# fieldPath: .metadata.name # Name of the service
125+
# targets:
126+
# - select:
127+
# kind: Certificate
128+
# group: cert-manager.io
129+
# version: v1
130+
# name: serving-cert
131+
# fieldPaths:
132+
# - .spec.dnsNames.0
133+
# - .spec.dnsNames.1
134+
# options:
135+
# delimiter: '.'
136+
# index: 0
137+
# create: true
138+
# - source:
139+
# kind: Service
140+
# version: v1
141+
# name: webhook-service
142+
# fieldPath: .metadata.namespace # Namespace of the service
143+
# targets:
144+
# - select:
145+
# kind: Certificate
146+
# group: cert-manager.io
147+
# version: v1
148+
# name: serving-cert
149+
# fieldPaths:
150+
# - .spec.dnsNames.0
151+
# - .spec.dnsNames.1
152+
# options:
153+
# delimiter: '.'
154+
# index: 1
155+
# create: true
156+
#
157157
- source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
158158
kind: Certificate
159159
group: cert-manager.io
@@ -169,6 +169,7 @@ replacements:
169169
delimiter: '/'
170170
index: 0
171171
create: true
172+
172173
- source:
173174
kind: Certificate
174175
group: cert-manager.io
@@ -185,6 +186,7 @@ replacements:
185186
index: 1
186187
create: true
187188

189+
#
188190
- source: # Uncomment the following block if you have a DefaultingWebhook (--defaulting )
189191
kind: Certificate
190192
group: cert-manager.io
@@ -200,6 +202,7 @@ replacements:
200202
delimiter: '/'
201203
index: 0
202204
create: true
205+
203206
- source:
204207
kind: Certificate
205208
group: cert-manager.io
@@ -216,6 +219,7 @@ replacements:
216219
index: 1
217220
create: true
218221

222+
#
219223
- source: # Uncomment the following block if you have a ConversionWebhook (--conversion)
220224
kind: Certificate
221225
group: cert-manager.io
@@ -250,3 +254,4 @@ replacements:
250254
index: 1
251255
create: true
252256
# +kubebuilder:scaffold:crdkustomizecainjectionname
257+

docs/book/src/multiversion-tutorial/testdata/project/dist/install.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
webhook:
2121
clientConfig:
2222
service:
23-
name: project-webhook-service
23+
name: webhook-service
2424
namespace: project-system
2525
path: /convert
2626
conversionReviewVersions:
@@ -8105,8 +8105,8 @@ metadata:
81058105
namespace: project-system
81068106
spec:
81078107
dnsNames:
8108-
- project-webhook-service.project-system.svc
8109-
- project-webhook-service.project-system.svc.cluster.local
8108+
- SERVICE_NAME.SERVICE_NAMESPACE.svc
8109+
- SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local
81108110
issuerRef:
81118111
kind: Issuer
81128112
name: project-selfsigned-issuer

0 commit comments

Comments
 (0)