-
Notifications
You must be signed in to change notification settings - Fork 18
/
deployment.yaml
358 lines (349 loc) · 11.5 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
{{ $hasKerberos := false }}
{{ if .Values.kerberos }}
{{ if .Values.kerberos.enabled }}
{{ $hasKerberos = true }}
{{ else }}
{{ $hasKerberos = false }}
{{ end }}
{{ else }}
{{ $hasKerberos = false }}
{{ end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: openunison-{{ .Release.Name }}
app.kubernetes.io/name: openunison
app.kubernetes.io/instance: openunison-{{ .Release.Name }}
app.kubernetes.io/component: application
app.kubernetes.io/part-of: openunison
name: openunison-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
annotations:
argocd.argoproj.io/sync-wave: "30"
spec:
progressDeadlineSeconds: 600
replicas: {{ .Values.openunison.replicas }}
revisionHistoryLimit: 10
selector:
matchLabels:
application: openunison-{{ .Release.Name }}
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
application: openunison-{{ .Release.Name }}
app: openunison-{{ .Release.Name }}
app.kubernetes.io/name: openunison
app.kubernetes.io/instance: openunison-{{ .Release.Name }}
app.kubernetes.io/component: application
app.kubernetes.io/part-of: openunison
spec:
{{ if .Values.network.enableHostNetwork }}
hostNetwork: true
{{ else }}
hostNetwork: false
{{ end }}
containers:
- env:
{{ if $hasKerberos }}
- name: JAVA_OPTS
value: "-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -DunisonEnvironmentFile=/etc/openunison/ou.env -Djavax.net.ssl.trustStore=/etc/openunison/cacerts.jks -Dpolyglot.engine.WarnInterpreterOnly=false -Djava.security.krb5.conf=/etc/krb5-local/krb5.conf -Djava.security.krb5.debug=true -Djava.security.auth.login.config=/etc/krb5-local/SQLJDBCDriver.conf"
{{ else }}
- name: JAVA_OPTS
value: "-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -DunisonEnvironmentFile=/etc/openunison/ou.env -Djavax.net.ssl.trustStore=/etc/openunison/cacerts.jks -Dpolyglot.engine.WarnInterpreterOnly=false"
{{ end }}
- name: fortriggerupdates
value: changeme
{{ if $hasKerberos }}
- name: KRB5_CONFIG
value: /etc/krb5-local/krb5.conf
- name: KRB5RCACHEDIR
value: /dev/shm
- name: KRB5CCNAME
value: /dev/shm/ccache
{{ end }}
{{ if .Values.openunison.env }}
{{ range $k,$v := .Values.openunison.env }}
- name: {{ $k }}
value: "{{ $v }}"
{{ end }}
{{ end }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
{{ if .Capabilities.APIVersions.Has "project.openshift.io/v1/Project" }}
runAsNonRoot: true
{{ else }}
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
runAsUser: 431
runAsGroup: 433
{{ end }}
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.openunison.imagePullPolicy }}
livenessProbe:
exec:
command:
{{ if .Values.services.liveness_probe }}
{{ range $line := .Values.services.liveness_probe }}
- {{ $line }}
{{ end }}
{{ else }}
- /usr/local/openunison/bin/check_alive.sh
- "https://127.0.0.1:8443/auth/idp/k8sIdp/.well-known/openid-configuration"
- "issuer"
- "https://127.0.0.1:8443/check_alive"
- "alive"
{{ end }}
failureThreshold: 10
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
name: openunison-{{ .Release.Name }}
ports:
- containerPort: 8080
name: http
protocol: TCP
- containerPort: 8443
name: https
protocol: TCP
readinessProbe:
exec:
command:
{{ if .Values.services.readiness_probe }}
{{ range $line := .Values.services.readiness_probe }}
- {{ $line }}
{{ end }}
{{ else }}
- /usr/local/openunison/bin/check_alive.sh
- "https://127.0.0.1:8443/auth/idp/k8sIdp/.well-known/openid-configuration"
- "issuer"
- "https://127.0.0.1:8443/check_alive"
- "alive"
{{ end }}
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
{{ if .Values.services.resources }}
resources:
{{ if .Values.services.resources.requests }}
requests:
{{ if .Values.services.resources.requests.memory }}
memory: {{ .Values.services.resources.requests.memory | quote }}
{{ end }}
{{ if .Values.services.resources.requests.cpu }}
cpu: {{ .Values.services.resources.requests.cpu | quote }}
{{ end }}
{{ end }}
{{ if .Values.services.resources.limits }}
limits:
{{ if .Values.services.resources.limits.memory }}
memory: {{ .Values.services.resources.limits.memory | quote }}
{{ end }}
{{ if .Values.services.resources.limits.cpu }}
cpu: {{ .Values.services.resources.limits.cpu | quote }}
{{ end }}
{{ end }}
{{ end }}
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
volumeMounts:
- mountPath: "/usr/local/openunison/.config"
name: local-config
- mountPath: "/etc/openunison"
name: secret-volume
readOnly: true
{{ if .Values.saml }}
{{ if .Values.saml.metadata_xml_b64 }}
- mountPath: "/etc/saml2"
name: "saml2-metadata"
readOnly: true
{{ end }}
{{ end }}
{{ if .Values.myvd_configmap }}
- mountPath: "/etc/myvd"
name: "myvd-volume"
readOnly: true
{{ end }}
{{ if .Values.services.enable_tokenrequest | default false }}
- mountPath: /var/run/secrets/tokens
name: ou-token
{{ end }}
{{ if .Values.openunison.html.logosConfigMap }}
- mountPath: /usr/local/openunison/work/webapp/auth/forms/logos
name: custom-logos
readOnly: true
- mountPath: /usr/local/openunison/work/webapp/auth/forms/images
name: custom-logos-2
readOnly: true
{{ end }}
{{ if .Values.openunison.debugConfigMap }}
- mountPath: /usr/local/openunison/work/webapp/WEB-INF/classes
name: custom-debug
readOnly: true
{{ end }}
{{ if $hasKerberos }}
- mountPath: /etc/krb5-local
name: krb
readOnly: true
{{ end }}
{{ if $hasKerberos }}
- image: {{ .Values.kerberos.sidecar_image }}
name: krb-sidecar
{{ if not .Values.kerberos.keytab }}
command:
- /reinit-pwd.sh
{{ end }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
{{ if .Capabilities.APIVersions.Has "project.openshift.io/v1/Project" }}
runAsNonRoot: true
{{ else }}
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
runAsUser: 431
runAsGroup: 433
{{ end }}
env:
- name: KRB5CCNAME
value: /dev/shm/ccache
- name: KRB5_CONFIG
value: /etc/krb5-local/krb5.conf
- name: REKINIT_PERIOD
value: "3600"
- name: SECRETS
value: /etc/krb5-keytabs
{{ if .Values.kerberos.keytab }}
- name: KEYTAB
value: {{ .Values.kerberos.keytab }}
{{ end }}
- name: PRINCIPAL
value: {{ .Values.kerberos.principal }}
- name: KRB5RCACHEDIR
value: /dev/shm
volumeMounts:
- mountPath: /etc/krb5-local
name: krb
readOnly: true
- mountPath: /etc/krb5-keytabs
name: krb-keytab
readOnly: true
{{ end }}
automountServiceAccountToken: {{ not (.Values.services.enable_tokenrequest | default false) }}
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
serviceAccount: openunison-{{ .Release.Name }}
{{ if .Capabilities.APIVersions.Has "project.openshift.io/v1/Project" }}
securityContext:
runAsNonRoot: true
{{ else }}
securityContext:
fsGroup: 433
supplementalGroups: [433]
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true
runAsUser: 431
runAsGroup: 433
{{ end }}
volumes:
- name: local-config
emptyDir: {}
- name: secret-volume
secret:
defaultMode: 420
secretName: {{ .Release.Name }}
{{ if .Values.saml }}
{{ if .Values.saml.metadata_xml_b64 }}
- name: saml2-metadata
configMap:
name: saml2-metadata
{{ end }}
{{ end }}
{{ if .Values.myvd_configmap }}
- name: myvd-volume
configMap:
name: {{ .Values.myvd_configmap | quote }}
{{ end }}
{{ if .Values.services.enable_tokenrequest | default false }}
- name: ou-token
projected:
defaultMode: 420
sources:
- serviceAccountToken:
audience: {{ .Values.services.token_request_audience | default "https://kubernetes.default.svc.cluster.local" }}
expirationSeconds: {{ .Values.services.token_request_expiration_seconds | default 60000 }}
path: "ou-token"
- configMap:
items:
- key: "ca.crt"
path: "ca.crt"
name: "kube-root-ca.crt"
{{ end }}
{{ if .Values.openunison.html.logosConfigMap }}
- name: custom-logos
configMap:
name: {{ .Values.openunison.html.logosConfigMap | quote }}
- name: custom-logos-2
configMap:
name: {{ .Values.openunison.html.logosConfigMap | quote }}
{{ end }}
{{ if .Values.openunison.debugConfigMap }}
- name: custom-debug
configMap:
name: {{ .Values.openunison.debugConfigMap | quote }}
{{ end }}
{{ if $hasKerberos }}
- name: krb
configMap:
name: kerb-config
- name: krb-keytab
secret:
secretName: kerb-keytab{{ .Values.openunison.secret_ext }}
{{ end }}
{{- if .Values.services.tolerations }}
tolerations:
{{- range .Values.services.tolerations }}
- {{- if .key }}
key: {{ .key }}
{{- end }}
{{- if .effect }}
effect: {{ .effect }}
{{- end }}
{{- if .operator }}
operator: {{ .operator }}
{{- end }}
{{- if .value }}
value: {{ .value }}
{{- end }}
{{- end }}
{{- end }}
{{ $length := len .Values.services.node_selectors }}
{{ if eq $length 0 }}
nodeSelector: {}
{{ else }}
nodeSelector: {{ range $key,$value := .Values.services.node_selectors }}
{{ $key }}: {{ $value | quote }}
{{ end }}
{{ end }}
{{ if .Values.services.pullSecret }}
imagePullSecrets:
- name: {{ .Values.services.pullSecret | quote }}
{{ end }}