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