Skip to content

Commit 4852a8d

Browse files
authored
Merge pull request #4283 from camilamacedo86/make-easy-certmanager-uncomment
🐛 (kustomize/v2,go/v4): Move cert-manager uncomment block to top of kustomization.yaml for better visibility in new projects
2 parents 35a0f4f + 5456002 commit 4852a8d

File tree

12 files changed

+321
-327
lines changed

12 files changed

+321
-327
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ jobs:
8282
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
8383
# Uncomment only ValidatingWebhookConfiguration
8484
# from cert-manager replaces
85-
sed -i '50,80s/^#//' $KUSTOMIZATION_FILE_PATH
86-
sed -i '144,177s/^#//' $KUSTOMIZATION_FILE_PATH
85+
sed -i '50,116s/^#//' $KUSTOMIZATION_FILE_PATH
86+
sed -i '148,177s/^#//' $KUSTOMIZATION_FILE_PATH
8787
cd testdata/project-v4-with-plugins/
8888
go mod tidy
8989

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

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,41 @@ patches:
4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4949
# Uncomment the following replacements to add the cert-manager CA injection annotations
5050
replacements:
51+
- source: # Uncomment the following block if you have any webhook
52+
kind: Service
53+
version: v1
54+
name: webhook-service
55+
fieldPath: .metadata.name # Name of the service
56+
targets:
57+
- select:
58+
kind: Certificate
59+
group: cert-manager.io
60+
version: v1
61+
fieldPaths:
62+
- .spec.dnsNames.0
63+
- .spec.dnsNames.1
64+
options:
65+
delimiter: '.'
66+
index: 0
67+
create: true
68+
- source:
69+
kind: Service
70+
version: v1
71+
name: webhook-service
72+
fieldPath: .metadata.namespace # Namespace of the service
73+
targets:
74+
- select:
75+
kind: Certificate
76+
group: cert-manager.io
77+
version: v1
78+
fieldPaths:
79+
- .spec.dnsNames.0
80+
- .spec.dnsNames.1
81+
options:
82+
delimiter: '.'
83+
index: 1
84+
create: true
85+
5186
- source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
5287
kind: Certificate
5388
group: cert-manager.io
@@ -109,7 +144,7 @@ replacements:
109144
delimiter: '/'
110145
index: 1
111146
create: true
112-
147+
#
113148
# - source: # Uncomment the following block if you have a ConversionWebhook (--conversion)
114149
# kind: Certificate
115150
# group: cert-manager.io
@@ -140,38 +175,3 @@ replacements:
140175
# delimiter: '/'
141176
# index: 1
142177
# create: true
143-
#
144-
- source: # Uncomment the following block if you enable cert-manager
145-
kind: Service
146-
version: v1
147-
name: webhook-service
148-
fieldPath: .metadata.name # Name of the service
149-
targets:
150-
- select:
151-
kind: Certificate
152-
group: cert-manager.io
153-
version: v1
154-
fieldPaths:
155-
- .spec.dnsNames.0
156-
- .spec.dnsNames.1
157-
options:
158-
delimiter: '.'
159-
index: 0
160-
create: true
161-
- source:
162-
kind: Service
163-
version: v1
164-
name: webhook-service
165-
fieldPath: .metadata.namespace # Namespace of the service
166-
targets:
167-
- select:
168-
kind: Certificate
169-
group: cert-manager.io
170-
version: v1
171-
fieldPaths:
172-
- .spec.dnsNames.0
173-
- .spec.dnsNames.1
174-
options:
175-
delimiter: '.'
176-
index: 1
177-
create: true

docs/book/src/getting-started/testdata/project/config/default/kustomization.yaml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,41 @@ patches:
4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4949
# Uncomment the following replacements to add the cert-manager CA injection annotations
5050
#replacements:
51+
# - source: # Uncomment the following block if you have any webhook
52+
# kind: Service
53+
# version: v1
54+
# name: webhook-service
55+
# fieldPath: .metadata.name # Name of the service
56+
# targets:
57+
# - select:
58+
# kind: Certificate
59+
# group: cert-manager.io
60+
# version: v1
61+
# fieldPaths:
62+
# - .spec.dnsNames.0
63+
# - .spec.dnsNames.1
64+
# options:
65+
# delimiter: '.'
66+
# index: 0
67+
# create: true
68+
# - source:
69+
# kind: Service
70+
# version: v1
71+
# name: webhook-service
72+
# fieldPath: .metadata.namespace # Namespace of the service
73+
# targets:
74+
# - select:
75+
# kind: Certificate
76+
# group: cert-manager.io
77+
# version: v1
78+
# fieldPaths:
79+
# - .spec.dnsNames.0
80+
# - .spec.dnsNames.1
81+
# options:
82+
# delimiter: '.'
83+
# index: 1
84+
# create: true
85+
#
5186
# - source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
5287
# kind: Certificate
5388
# group: cert-manager.io
@@ -140,38 +175,3 @@ patches:
140175
# delimiter: '/'
141176
# index: 1
142177
# create: true
143-
#
144-
# - source: # Uncomment the following block if you enable cert-manager
145-
# kind: Service
146-
# version: v1
147-
# name: webhook-service
148-
# fieldPath: .metadata.name # Name of the service
149-
# targets:
150-
# - select:
151-
# kind: Certificate
152-
# group: cert-manager.io
153-
# version: v1
154-
# fieldPaths:
155-
# - .spec.dnsNames.0
156-
# - .spec.dnsNames.1
157-
# options:
158-
# delimiter: '.'
159-
# index: 0
160-
# create: true
161-
# - source:
162-
# kind: Service
163-
# version: v1
164-
# name: webhook-service
165-
# fieldPath: .metadata.namespace # Namespace of the service
166-
# targets:
167-
# - select:
168-
# kind: Certificate
169-
# group: cert-manager.io
170-
# version: v1
171-
# fieldPaths:
172-
# - .spec.dnsNames.0
173-
# - .spec.dnsNames.1
174-
# options:
175-
# delimiter: '.'
176-
# index: 1
177-
# create: true

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,41 @@ patches:
4848
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
4949
# Uncomment the following replacements to add the cert-manager CA injection annotations
5050
replacements:
51+
- source: # Uncomment the following block if you have any webhook
52+
kind: Service
53+
version: v1
54+
name: webhook-service
55+
fieldPath: .metadata.name # Name of the service
56+
targets:
57+
- select:
58+
kind: Certificate
59+
group: cert-manager.io
60+
version: v1
61+
fieldPaths:
62+
- .spec.dnsNames.0
63+
- .spec.dnsNames.1
64+
options:
65+
delimiter: '.'
66+
index: 0
67+
create: true
68+
- source:
69+
kind: Service
70+
version: v1
71+
name: webhook-service
72+
fieldPath: .metadata.namespace # Namespace of the service
73+
targets:
74+
- select:
75+
kind: Certificate
76+
group: cert-manager.io
77+
version: v1
78+
fieldPaths:
79+
- .spec.dnsNames.0
80+
- .spec.dnsNames.1
81+
options:
82+
delimiter: '.'
83+
index: 1
84+
create: true
85+
5186
- source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
5287
kind: Certificate
5388
group: cert-manager.io
@@ -140,38 +175,3 @@ replacements:
140175
delimiter: '/'
141176
index: 1
142177
create: true
143-
144-
- source: # Uncomment the following block if you enable cert-manager
145-
kind: Service
146-
version: v1
147-
name: webhook-service
148-
fieldPath: .metadata.name # Name of the service
149-
targets:
150-
- select:
151-
kind: Certificate
152-
group: cert-manager.io
153-
version: v1
154-
fieldPaths:
155-
- .spec.dnsNames.0
156-
- .spec.dnsNames.1
157-
options:
158-
delimiter: '.'
159-
index: 0
160-
create: true
161-
- source:
162-
kind: Service
163-
version: v1
164-
name: webhook-service
165-
fieldPath: .metadata.namespace # Namespace of the service
166-
targets:
167-
- select:
168-
kind: Certificate
169-
group: cert-manager.io
170-
version: v1
171-
fieldPaths:
172-
- .spec.dnsNames.0
173-
- .spec.dnsNames.1
174-
options:
175-
delimiter: '.'
176-
index: 1
177-
create: true

hack/docs/internal/cronjob-tutorial/generate_cronjob.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,6 @@ func (sp *Sample) updateKustomization() {
596596
certmanagerForWebhooks, `#`)
597597
hackutils.CheckError("fixing default/kustomization", err)
598598

599-
err = pluginutil.UncommentCode(
600-
filepath.Join(sp.ctx.Dir, "config/default/kustomization.yaml"),
601-
webhookServiceDefaultKustomize, `#`)
602-
hackutils.CheckError("fixing default/kustomization", err)
603-
604599
err = pluginutil.UncommentCode(
605600
filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"),
606601
`#- path: patches/cainjection_in_cronjobs.yaml`, `#`)

hack/docs/internal/cronjob-tutorial/sample.go

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,41 @@ const CronjobSample = `
3434
restartPolicy: OnFailure`
3535

3636
const certmanagerForWebhooks = `#replacements:
37+
# - source: # Uncomment the following block if you have any webhook
38+
# kind: Service
39+
# version: v1
40+
# name: webhook-service
41+
# fieldPath: .metadata.name # Name of the service
42+
# targets:
43+
# - select:
44+
# kind: Certificate
45+
# group: cert-manager.io
46+
# version: v1
47+
# fieldPaths:
48+
# - .spec.dnsNames.0
49+
# - .spec.dnsNames.1
50+
# options:
51+
# delimiter: '.'
52+
# index: 0
53+
# create: true
54+
# - source:
55+
# kind: Service
56+
# version: v1
57+
# name: webhook-service
58+
# fieldPath: .metadata.namespace # Namespace of the service
59+
# targets:
60+
# - select:
61+
# kind: Certificate
62+
# group: cert-manager.io
63+
# version: v1
64+
# fieldPaths:
65+
# - .spec.dnsNames.0
66+
# - .spec.dnsNames.1
67+
# options:
68+
# delimiter: '.'
69+
# index: 1
70+
# create: true
71+
#
3772
# - source: # Uncomment the following block if you have a ValidatingWebhook (--programmatic-validation)
3873
# kind: Certificate
3974
# group: cert-manager.io
@@ -94,40 +129,4 @@ const certmanagerForWebhooks = `#replacements:
94129
# options:
95130
# delimiter: '/'
96131
# index: 1
97-
# create: true
98-
#`
99-
100-
const webhookServiceDefaultKustomize = `# - source: # Uncomment the following block if you enable cert-manager
101-
# kind: Service
102-
# version: v1
103-
# name: webhook-service
104-
# fieldPath: .metadata.name # Name of the service
105-
# targets:
106-
# - select:
107-
# kind: Certificate
108-
# group: cert-manager.io
109-
# version: v1
110-
# fieldPaths:
111-
# - .spec.dnsNames.0
112-
# - .spec.dnsNames.1
113-
# options:
114-
# delimiter: '.'
115-
# index: 0
116-
# create: true
117-
# - source:
118-
# kind: Service
119-
# version: v1
120-
# name: webhook-service
121-
# fieldPath: .metadata.namespace # Namespace of the service
122-
# targets:
123-
# - select:
124-
# kind: Certificate
125-
# group: cert-manager.io
126-
# version: v1
127-
# fieldPaths:
128-
# - .spec.dnsNames.0
129-
# - .spec.dnsNames.1
130-
# options:
131-
# delimiter: '.'
132-
# index: 1
133132
# create: true`

hack/docs/internal/multiversion-tutorial/kustomize.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ limitations under the License.
1616

1717
package multiversion
1818

19-
const caConversionCRDDefaultKustomize = `# - source: # Uncomment the following block if you have a ConversionWebhook (--conversion)
19+
const caConversionCRDDefaultKustomize = `#
20+
# - source: # Uncomment the following block if you have a ConversionWebhook (--conversion)
2021
# kind: Certificate
2122
# group: cert-manager.io
2223
# version: v1
@@ -45,5 +46,4 @@ const caConversionCRDDefaultKustomize = `# - source: # Uncomment the following b
4546
# options:
4647
# delimiter: '/'
4748
# index: 1
48-
# create: true
49-
#`
49+
# create: true`

0 commit comments

Comments
 (0)