Merge "Bump version of readiness image"
[oom.git] / kubernetes / policy / charts / policy-distribution / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ include "common.release" . }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   template:
14     metadata:
15       labels:
16         app: {{ include "common.name" . }}
17         release: {{ include "common.release" . }}
18     spec:
19       initContainers:
20       - command:
21         - sh
22         args:
23         - -c
24         - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
25         env:
26         - name: RESTSERVER_USER
27           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
28         - name: RESTSERVER_PASSWORD
29           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
30         - name: API_USER
31           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "login") | indent 10 }}
32         - name: API_PASSWORD
33           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "apiparameters-creds" "key" "password") | indent 10 }}
34         - name: PAP_USER
35           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "login") | indent 10 }}
36         - name: PAP_PASSWORD
37           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "papparameters-creds" "key" "password") | indent 10 }}
38         - name: SDCBE_USER
39           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "login") | indent 10 }}
40         - name: SDCBE_PASSWORD
41           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdcbe-creds" "key" "password") | indent 10 }}
42         volumeMounts:
43         - mountPath: /config-input
44           name: distributionconfig-input
45         - mountPath: /config
46           name: distributionconfig
47         image: "{{ .Values.global.envsubstImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-update-config
50       containers:
51         - name: {{ include "common.name" . }}
52           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           command: ["/opt/app/policy/distribution/bin/policy-dist.sh"]
55           args: ["/opt/app/policy/distribution/etc/mounted/config.json"]
56           ports:
57           - containerPort: {{ .Values.service.internalPort }}
58           # disable liveness probe when breakpoints set in debugger
59           # so K8s doesn't restart unresponsive container
60           {{- if eq .Values.liveness.enabled true }}
61           livenessProbe:
62             tcpSocket:
63               port: {{ .Values.service.internalPort }}
64             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
65             periodSeconds: {{ .Values.liveness.periodSeconds }}
66           {{ end -}}
67           readinessProbe:
68             tcpSocket:
69               port: {{ .Values.service.internalPort }}
70             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
71             periodSeconds: {{ .Values.readiness.periodSeconds }}
72           volumeMounts:
73           - mountPath: /etc/localtime
74             name: localtime
75             readOnly: true
76           - mountPath: /opt/app/policy/distribution/etc/mounted
77             name: distributionconfig
78           resources:
79 {{ include "common.resources" . | indent 12 }}
80         {{- if .Values.nodeSelector }}
81         nodeSelector:
82 {{ toYaml .Values.nodeSelector | indent 10 }}
83         {{- end -}}
84         {{- if .Values.affinity }}
85         affinity:
86 {{ toYaml .Values.affinity | indent 10 }}
87         {{- end }}
88       volumes:
89         - name: localtime
90           hostPath:
91              path: /etc/localtime
92         - name: distributionconfig-input
93           configMap:
94             name: {{ include "common.fullname" . }}-configmap
95             defaultMode: 0755
96         - name: distributionconfig
97           emptyDir:
98             medium: Memory
99       imagePullSecrets:
100       - name: "{{ include "common.namespace" . }}-docker-registry-key"