deployment.yaml 14.2 KB
Newer Older
Sandro Mathys's avatar
Sandro Mathys committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "shibboleth-sp.fullname" . }}
  labels:
    {{- include "shibboleth-sp.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "shibboleth-sp.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
18
19
20
21
22
23
24
25
26
27
        {{- if .Values.deployment.automaticPodRollout.always }}
        automaticPodRollout/always: {{ randAlphaNum 5 | quote }}
        {{- end }}
        {{- if .Values.deployment.automaticPodRollout.onConfigMapChange }}
        automaticPodRollout/configmap-apache: {{ include (print $.Template.BasePath "/configmap-apache.yaml") . | sha256sum }}
        automaticPodRollout/configmap-shibboleth: {{ include (print $.Template.BasePath "/configmap-shibboleth.yaml") . | sha256sum }}
        {{- end }}
        {{- with .Values.podAnnotations }}
        {{- . | toYaml | nindent 8 }}
        {{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
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
      labels:
        {{- include "shibboleth-sp.selectorLabels" . | nindent 8 }}
    spec:
      {{- if .Values.imagePullSecrets }}
      imagePullSecrets:
      {{- with .Values.imagePullSecrets }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- end }}
      {{- if .Values.podSecurityContext }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      {{- end }}
      {{- if .Values.podAntiAffinityPreset }}
      affinity:
        podAntiAffinity:
          {{- if eq .Values.podAntiAffinityPreset "hard" }}
          requiredDuringSchedulingIgnoredDuringExecution:
            labelSelector:
              matchLabels:
                {{- include "shibboleth-sp.selectorLabels" . | nindent 16 }}
            topologyKey: "kubernetes.io/hostname"
          {{- else if eq .Values.podAntiAffinityPreset "soft" }}
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    {{- include "shibboleth-sp.selectorLabels" . | nindent 20 }}
                topologyKey: "kubernetes.io/hostname"
          {{- end }}
      {{- end }}
      serviceAccountName: {{ include "shibboleth-sp.serviceAccountName" . }}
      initContainers:
        - name: shibboleth-init
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
65
66
          image: "{{ include "shibboleth-sp.backend.image" . }}"
          imagePullPolicy: "{{ include "shibboleth-sp.backend.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
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
          command: ["shibd", "-t"]
          resources:
            {{- toYaml .Values.backend.resources | nindent 12 }}
          volumeMounts:
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
              subPath: shibboleth2.xml
              mountPath: /etc/shibboleth/shibboleth2.xml
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
              subPath: shibd.logger
              mountPath: /etc/shibboleth/shibd.logger
              readOnly: true
            {{- if .Values.backend.shibboleth.sessionCache.enabled }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-sealer-keys
              subPath: sealer.keys
              mountPath: /etc/shibboleth/sealer.keys
              readOnly: true
            {{- end }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-active-certs
              subPath: tls.crt
              mountPath: /etc/shibboleth/sp-cert-active.pem
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-active-certs
              subPath: tls.key
              mountPath: /etc/shibboleth/sp-key-active.pem
              readOnly: true
            {{- if .Values.backend.shibboleth.applicationDefaults.credentialResolver.additionalSecretName }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-additional-certs
              subPath: tls.crt
              mountPath: /etc/shibboleth/sp-cert-additional.pem
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-additional-certs
              subPath: tls.key
              mountPath: /etc/shibboleth/sp-key-additional.pem
              readOnly: true
            {{- end }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-cache
              mountPath: /var/cache/shibboleth
              readOnly: false
            {{- if .Values.backend.volumeMounts }}
107
            {{- .Values.backend.volumeMounts | toYaml | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
108
109
110
111
            {{- end }}
        - name: apache-init
          securityContext:
            {{- toYaml .Values.frontend.securityContext | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
112
113
          image: "{{ include "shibboleth-sp.frontend.image" . }}"
          imagePullPolicy: "{{ include "shibboleth-sp.frontend.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
          command: ["apachectl", "configtest"]
          resources:
            {{- toYaml .Values.frontend.resources | nindent 12 }}
          volumeMounts:
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-base
              subPath: base.conf
              mountPath: /etc/apache2/apache2.conf
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-config
              mountPath: /etc/apache2/conf-enabled
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-modules
              mountPath: /etc/apache2/mods-enabled
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-sites
              mountPath: /etc/apache2/sites-enabled
              readOnly: true
            {{- if .Values.frontend.volumeMounts }}
132
            {{- .Values.frontend.volumeMounts | toYaml | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
133
134
            {{- end }}
        {{- if .Values.initContainers }}
135
        {{- .Values.initContainers | toYaml | nindent 8 }}
Sandro Mathys's avatar
Sandro Mathys committed
136
137
138
139
140
        {{- end }}
      containers:
        - name: shibboleth
          securityContext:
            {{- toYaml .Values.backend.securityContext | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
141
142
          image: "{{ include "shibboleth-sp.backend.image" . }}"
          imagePullPolicy: "{{ include "shibboleth-sp.backend.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
143
144
145
146
          env:
            - name: SHIBSP_LISTENER_ADDRESS
              value: "/dev/shm/shibd.sock"
          command: ["shibd", "-f", "-F"]
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
          # This port is actually exposed by the apache container, but it's accessible  from this
          # container anyway. Because it's easier to probe liveness and readiness of the shibd
          # through Apache, it makes sense to create this named port on this containers as well.
          ports:
            - name: apache
              containerPort: 8080
              protocol: TCP
          {{- if .Values.backend.workaround.readinessProbe.enabled }}
          {{- if .Values.backend.readinessProbe }}
          readinessProbe:
            {{- .Values.backend.readinessProbe | toYaml | nindent 12 }}
          {{- end }}
          {{- end }}
          {{- if .Values.backend.workaround.livenessProbe.enabled }}
          {{- if .Values.backend.livenessProbe }}
          livenessProbe:
            {{- .Values.backend.livenessProbe | toYaml | nindent 12 }}
          {{- end }}
          {{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
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
          resources:
            {{- toYaml .Values.backend.resources | nindent 12 }}
          volumeMounts:
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
              subPath: shibboleth2.xml
              mountPath: /etc/shibboleth/shibboleth2.xml
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
              subPath: shibd.logger
              mountPath: /etc/shibboleth/shibd.logger
              readOnly: true
            {{- if .Values.backend.shibboleth.sessionCache.enabled }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-sealer-keys
              subPath: sealer.keys
              mountPath: /etc/shibboleth/sealer.keys
              readOnly: true
            {{- end }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-active-certs
              subPath: tls.crt
              mountPath: /etc/shibboleth/sp-cert-active.pem
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-active-certs
              subPath: tls.key
              mountPath: /etc/shibboleth/sp-key-active.pem
              readOnly: true
            {{- if .Values.backend.shibboleth.applicationDefaults.credentialResolver.additionalSecretName }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-additional-certs
              subPath: tls.crt
              mountPath: /etc/shibboleth/sp-cert-additional.pem
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-additional-certs
              subPath: tls.key
              mountPath: /etc/shibboleth/sp-key-additional.pem
              readOnly: true
            {{- end }}
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-cache
              mountPath: /var/cache/shibboleth
              readOnly: false
            {{- if .Values.backend.volumeMounts }}
205
            {{- .Values.backend.volumeMounts | toYaml | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
206
207
208
209
            {{- end }}
        - name: apache
          securityContext:
            {{- toYaml .Values.frontend.securityContext | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
210
211
          image: "{{ include "shibboleth-sp.frontend.image" . }}"
          imagePullPolicy: "{{ include "shibboleth-sp.frontend.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
212
213
214
215
216
217
218
219
          env:
            - name: SHIBSP_LISTENER_ADDRESS
              value: "/dev/shm/shibd.sock"
          command: ["apachectl", "-D", "FOREGROUND"]
          ports:
            - name: apache
              containerPort: 8080
              protocol: TCP
220
221
          {{- if .Values.frontend.workaround.readinessProbe.enabled }}
          {{- if .Values.frontend.readinessProbe }}
Sandro Mathys's avatar
Sandro Mathys committed
222
          readinessProbe:
223
224
225
226
227
            {{- .Values.frontend.readinessProbe | toYaml | nindent 12 }}
          {{- end }}
          {{- end }}
          {{- if .Values.frontend.workaround.livenessProbe.enabled }}
          {{- if .Values.frontend.livenessProbe }}
Sandro Mathys's avatar
Sandro Mathys committed
228
          livenessProbe:
229
230
231
            {{- .Values.frontend.livenessProbe | toYaml | nindent 12 }}
          {{- end }}
          {{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
          resources:
            {{- toYaml .Values.frontend.resources | nindent 12 }}
          volumeMounts:
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-base
              subPath: base.conf
              mountPath: /etc/apache2/apache2.conf
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-config
              mountPath: /etc/apache2/conf-enabled
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-modules
              mountPath: /etc/apache2/mods-enabled
              readOnly: true
            - name: {{ include "shibboleth-sp.frontend.fullname" . }}-sites
              mountPath: /etc/apache2/sites-enabled
              readOnly: true
            - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
              subPath: shibboleth2.xml
              mountPath: /etc/shibboleth/shibboleth2.xml
              readOnly: true
            {{- if .Values.frontend.volumeMounts }}
253
            {{- .Values.frontend.volumeMounts | toYaml | nindent 12 }}
Sandro Mathys's avatar
Sandro Mathys committed
254
255
            {{- end }}
        {{- if .Values.containers }}
256
        {{- .Values.containers | toYaml | nindent 8 }}
Sandro Mathys's avatar
Sandro Mathys committed
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
        {{- end }}
      volumes:
        - name: {{ include "shibboleth-sp.backend.fullname" . }}-config
          configMap:
            {{- if .Values.backend.shibboleth.configMap }}
            name: {{ tpl .Values.backend.shibboleth.configMap . }}
            {{- else }}
            name: {{ include "shibboleth-sp.backend.fullname" . }}-config
            {{- end }}
        - name: {{ include "shibboleth-sp.backend.fullname" . }}-active-certs
          secret:
            secretName: {{ tpl .Values.backend.shibboleth.applicationDefaults.credentialResolver.activeSecretName . }}
        {{- if .Values.backend.shibboleth.applicationDefaults.credentialResolver.additionalSecretName }}
        - name: {{ include "shibboleth-sp.backend.fullname" . }}-additional-certs
          secret:
            secretName: {{ tpl .Values.backend.shibboleth.applicationDefaults.credentialResolver.additionalSecretName . }}
        {{- end }}
        {{- if .Values.backend.shibboleth.sessionCache.enabled }}
        - name: {{ include "shibboleth-sp.backend.fullname" . }}-sealer-keys
Sandro Mathys's avatar
Sandro Mathys committed
276
277
          secret:
            secretName: {{ include "shibboleth-sp.sealerKeys.secretName" . }}
Sandro Mathys's avatar
Sandro Mathys committed
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
        {{- end }}
        - name: {{ include "shibboleth-sp.backend.fullname" . }}-cache
          emptyDir: {}
        - name: {{ include "shibboleth-sp.frontend.fullname" . }}-base
          configMap:
            {{- if .Values.frontend.apache.baseConfigMap }}
            name: {{ tpl .Values.frontend.apache.baseConfigMap . }}
            {{- else }}
            name: {{ include "shibboleth-sp.frontend.fullname" . }}-base
            {{- end }}
        - name: {{ include "shibboleth-sp.frontend.fullname" . }}-config
          configMap:
            {{- if .Values.frontend.apache.mainConfigMap }}
            name: {{ tpl .Values.frontend.apache.mainConfigMap . }}
            {{- else }}
            name: {{ include "shibboleth-sp.frontend.fullname" . }}-config
            {{- end }}
        - name: {{ include "shibboleth-sp.frontend.fullname" . }}-modules
          configMap:
            {{- if .Values.frontend.apache.modulesConfigMap }}
            name: {{ tpl .Values.frontend.apache.modulesConfigMap . }}
            {{- else }}
            name: {{ include "shibboleth-sp.frontend.fullname" . }}-modules
            {{- end }}
        - name: {{ include "shibboleth-sp.frontend.fullname" . }}-sites
          configMap:
            {{- if .Values.frontend.apache.sitesConfigMap }}
            name: {{ tpl .Values.frontend.apache.sitesConfigMap . }}
            {{- else }}
            name: {{ include "shibboleth-sp.frontend.fullname" . }}-sites
            {{- end }}
        {{- if .Values.volumes }}
310
        {{- tpl (.Values.volumes | toYaml) . | nindent 8 }}
Sandro Mathys's avatar
Sandro Mathys committed
311
312
313
        {{- end }}
      dnsPolicy: ClusterFirst
      restartPolicy: Always