1
+ {{- $caCert := "" }}
2
+ {{- if .Values.webhook.certManager.enabled }}
3
+ {{- if not .Values.webhook.certManager.issuerName }}
4
+ ---
5
+ apiVersion : cert-manager.io/v1
6
+ kind : Issuer
7
+ metadata :
8
+ name : {{ include "cf-service-operator.fullname" . }}
9
+ labels :
10
+ {{- include "cf-service-operator.labels" . | nindent 4 }}
11
+ spec :
12
+ selfSigned : {}
13
+ {{- end }}
14
+ ---
15
+ apiVersion : cert-manager.io/v1
16
+ kind : Certificate
17
+ metadata :
18
+ name : {{ include "cf-service-operator.fullname" . }}
19
+ labels :
20
+ {{- include "cf-service-operator.labels" . | nindent 4 }}
21
+ spec :
22
+ dnsNames :
23
+ - {{ include "cf-service-operator.fullname" . }}
24
+ - {{ include "cf-service-operator.fullname" . }}.{{ .Release.Namespace }}
25
+ - {{ include "cf-service-operator.fullname" . }}.{{ .Release.Namespace }}.svc
26
+ - {{ include "cf-service-operator.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
27
+ issuerRef :
28
+ {{- if .Values.webhook.certManager.issuerName }}
29
+ {{- with .Values.webhook.certManager.issuerGroup }}
30
+ group : {{ . }}
31
+ {{- end }}
32
+ {{- with .Values.webhook.certManager.issuerKind }}
33
+ kind : {{ . }}
34
+ {{- end }}
35
+ name : {{ .Values.webhook.certManager.issuerName }}
36
+ {{- else }}
37
+ name : {{ include "cf-service-operator.fullname" . }}
38
+ {{- end }}
39
+ secretName : {{ include "cf-service-operator.fullname" . }}-tls-managed
40
+ {{- else }}
41
+ ---
42
+ apiVersion : v1
43
+ kind : Secret
44
+ metadata :
45
+ name : {{ include "cf-service-operator.fullname" . }}-tls
46
+ labels :
47
+ {{- include "cf-service-operator.labels" . | nindent 4 }}
48
+ type : Opaque
49
+ data :
50
+ {{- $data := (lookup "v1" "Secret" .Release.Namespace (printf "%s-tls" (include "cf-service-operator.fullname" .))).data }}
51
+ {{- if $data }}
52
+ {{ $data | toYaml | nindent 2 }}
53
+ {{- $caCert = index $data "ca.crt" }}
54
+ {{- else }}
55
+ {{- $cn := printf "%s.%s.svc" (include "cf-service-operator.fullname" .) .Release.Namespace }}
56
+ {{- $ca := genCA (printf "%s-ca" (include "cf-service-operator.fullname" .)) 36500 }}
57
+ {{- $cert := genSignedCert $cn nil (list $cn) 36500 $ca }}
58
+ ca.crt : {{ $ca.Cert | b64enc }}
59
+ tls.crt : {{ $cert.Cert | b64enc }}
60
+ tls.key : {{ $cert.Key | b64enc }}
61
+ {{- $caCert = $ca.Cert | b64enc }}
62
+ {{- end }}
63
+ {{- end }}
1
64
---
2
65
apiVersion : admissionregistration.k8s.io/v1
3
66
kind : MutatingWebhookConfiguration
4
67
metadata :
5
68
name : {{ include "cf-service-operator.fullname" . }}-mutate
6
69
labels :
7
70
{{- include "cf-service-operator.labels" . | nindent 4 }}
71
+ {{- if .Values.webhook.certManager.enabled }}
8
72
annotations :
9
73
cert-manager.io/inject-ca-from : {{ .Release.Namespace }}/{{ include "cf-service-operator.fullname" . }}
74
+ {{- end }}
10
75
webhooks :
11
76
- admissionReviewVersions :
12
77
- v1
13
78
clientConfig :
79
+ {{- if not .Values.webhook.certManager.enabled }}
80
+ caBundle : {{ $caCert }}
81
+ {{- end }}
14
82
service :
15
- name : {{ include "cf-service-operator.fullname" . }}-webhook
83
+ name : {{ include "cf-service-operator.fullname" . }}
16
84
namespace : {{ .Release.Namespace }}
17
85
path : /mutate-cf-cs-sap-com-v1alpha1-clusterspace
18
86
failurePolicy : Fail
@@ -32,8 +100,11 @@ webhooks:
32
100
- admissionReviewVersions :
33
101
- v1
34
102
clientConfig :
103
+ {{- if not .Values.webhook.certManager.enabled }}
104
+ caBundle : {{ $caCert }}
105
+ {{- end }}
35
106
service :
36
- name : {{ include "cf-service-operator.fullname" . }}-webhook
107
+ name : {{ include "cf-service-operator.fullname" . }}
37
108
namespace : {{ .Release.Namespace }}
38
109
path : /mutate-cf-cs-sap-com-v1alpha1-servicebinding
39
110
failurePolicy : Fail
@@ -53,8 +124,11 @@ webhooks:
53
124
- admissionReviewVersions :
54
125
- v1
55
126
clientConfig :
127
+ {{- if not .Values.webhook.certManager.enabled }}
128
+ caBundle : {{ $caCert }}
129
+ {{- end }}
56
130
service :
57
- name : {{ include "cf-service-operator.fullname" . }}-webhook
131
+ name : {{ include "cf-service-operator.fullname" . }}
58
132
namespace : {{ .Release.Namespace }}
59
133
path : /mutate-cf-cs-sap-com-v1alpha1-serviceinstance
60
134
failurePolicy : Fail
@@ -74,8 +148,11 @@ webhooks:
74
148
- admissionReviewVersions :
75
149
- v1
76
150
clientConfig :
151
+ {{- if not .Values.webhook.certManager.enabled }}
152
+ caBundle : {{ $caCert }}
153
+ {{- end }}
77
154
service :
78
- name : {{ include "cf-service-operator.fullname" . }}-webhook
155
+ name : {{ include "cf-service-operator.fullname" . }}
79
156
namespace : {{ .Release.Namespace }}
80
157
path : /mutate-cf-cs-sap-com-v1alpha1-space
81
158
failurePolicy : Fail
@@ -99,14 +176,19 @@ metadata:
99
176
name : {{ include "cf-service-operator.fullname" . }}-validate
100
177
labels :
101
178
{{- include "cf-service-operator.labels" . | nindent 4 }}
179
+ {{- if .Values.webhook.certManager.enabled }}
102
180
annotations :
103
181
cert-manager.io/inject-ca-from : {{ .Release.Namespace }}/{{ include "cf-service-operator.fullname" . }}
182
+ {{- end }}
104
183
webhooks :
105
184
- admissionReviewVersions :
106
185
- v1
107
186
clientConfig :
187
+ {{- if not .Values.webhook.certManager.enabled }}
188
+ caBundle : {{ $caCert }}
189
+ {{- end }}
108
190
service :
109
- name : {{ include "cf-service-operator.fullname" . }}-webhook
191
+ name : {{ include "cf-service-operator.fullname" . }}
110
192
namespace : {{ .Release.Namespace }}
111
193
path : /validate-cf-cs-sap-com-v1alpha1-clusterspace
112
194
failurePolicy : Fail
@@ -126,8 +208,11 @@ webhooks:
126
208
- admissionReviewVersions :
127
209
- v1
128
210
clientConfig :
211
+ {{- if not .Values.webhook.certManager.enabled }}
212
+ caBundle : {{ $caCert }}
213
+ {{- end }}
129
214
service :
130
- name : {{ include "cf-service-operator.fullname" . }}-webhook
215
+ name : {{ include "cf-service-operator.fullname" . }}
131
216
namespace : {{ .Release.Namespace }}
132
217
path : /validate-cf-cs-sap-com-v1alpha1-servicebinding
133
218
failurePolicy : Fail
@@ -147,8 +232,11 @@ webhooks:
147
232
- admissionReviewVersions :
148
233
- v1
149
234
clientConfig :
235
+ {{- if not .Values.webhook.certManager.enabled }}
236
+ caBundle : {{ $caCert }}
237
+ {{- end }}
150
238
service :
151
- name : {{ include "cf-service-operator.fullname" . }}-webhook
239
+ name : {{ include "cf-service-operator.fullname" . }}
152
240
namespace : {{ .Release.Namespace }}
153
241
path : /validate-cf-cs-sap-com-v1alpha1-serviceinstance
154
242
failurePolicy : Fail
@@ -168,8 +256,11 @@ webhooks:
168
256
- admissionReviewVersions :
169
257
- v1
170
258
clientConfig :
259
+ {{- if not .Values.webhook.certManager.enabled }}
260
+ caBundle : {{ $caCert }}
261
+ {{- end }}
171
262
service :
172
- name : {{ include "cf-service-operator.fullname" . }}-webhook
263
+ name : {{ include "cf-service-operator.fullname" . }}
173
264
namespace : {{ .Release.Namespace }}
174
265
path : /validate-cf-cs-sap-com-v1alpha1-space
175
266
failurePolicy : Fail
@@ -185,44 +276,4 @@ webhooks:
185
276
resources :
186
277
- spaces
187
278
sideEffects : None
188
- timeoutSeconds : 10
189
- ---
190
- apiVersion : v1
191
- kind : Service
192
- metadata :
193
- name : {{ include "cf-service-operator.fullname" . }}-webhook
194
- labels :
195
- {{- include "cf-service-operator.labels" . | nindent 4 }}
196
- spec :
197
- ports :
198
- - port : 443
199
- protocol : TCP
200
- targetPort : 9443
201
- selector :
202
- {{- include "cf-service-operator.selectorLabels" . | nindent 4 }}
203
- ---
204
- apiVersion : cert-manager.io/v1
205
- kind : Issuer
206
- metadata :
207
- name : {{ include "cf-service-operator.fullname" . }}
208
- labels :
209
- {{- include "cf-service-operator.labels" . | nindent 4 }}
210
- spec :
211
- selfSigned : {}
212
- ---
213
- apiVersion : cert-manager.io/v1
214
- kind : Certificate
215
- metadata :
216
- name : {{ include "cf-service-operator.fullname" . }}
217
- labels :
218
- {{- include "cf-service-operator.labels" . | nindent 4 }}
219
- spec :
220
- dnsNames :
221
- - {{ include "cf-service-operator.fullname" . }}-webhook
222
- - {{ include "cf-service-operator.fullname" . }}-webhook.{{ .Release.Namespace }}
223
- - {{ include "cf-service-operator.fullname" . }}-webhook.{{ .Release.Namespace }}.svc
224
- - {{ include "cf-service-operator.fullname" . }}-webhook.{{ .Release.Namespace }}.svc.cluster.local
225
- issuerRef :
226
- kind : Issuer
227
- name : {{ include "cf-service-operator.fullname" . }}
228
- secretName : {{ include "cf-service-operator.fullname" . }}-tls
279
+ timeoutSeconds : 10
0 commit comments