[COMMON] new logConfiguration chart
[oom.git] / kubernetes / policy / charts / pap / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
4 spec:
5   selector: {{- include "common.selectors" . | nindent 4 }}
6   replicas: {{ .Values.replicaCount }}
7   template:
8     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
9     spec:
10       initContainers:
11       - command:
12         - /root/ready.py
13         args:
14         - --container-name
15         - {{ .Values.global.mariadb.service.name }}
16         env:
17         - name: NAMESPACE
18           valueFrom:
19             fieldRef:
20               apiVersion: v1
21               fieldPath: metadata.namespace
22         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
23         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
24         name: {{ include "common.name" . }}-readiness
25
26       - command:
27         - sh
28         args:
29         - -c
30         - "export SQL_PASSWORD_BASE64=`echo -n ${SQL_PASSWORD} | base64`; cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
31         env:
32         - name: SQL_USER
33           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
34         - name: SQL_PASSWORD
35           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
36         - name: RESTSERVER_USER
37           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-secret" "key" "login") | indent 10 }}
38         - name: RESTSERVER_PASSWORD
39           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-secret" "key" "password") | indent 10 }}
40         - name: API_USER
41           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-secret" "key" "login") | indent 10 }}
42         - name: API_PASSWORD
43           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-secret" "key" "password") | indent 10 }}
44         - name: DISTRIBUTION_USER
45           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "distribution-secret" "key" "login") | indent 10 }}
46         - name: DISTRIBUTION_PASSWORD
47           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "distribution-secret" "key" "password") | indent 10 }}
48         volumeMounts:
49         - mountPath: /config-input
50           name: papconfig
51         - mountPath: /config
52           name: papconfig-processed
53         image: "{{ .Values.global.envsubstImage }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         name: {{ include "common.name" . }}-update-config
56       containers:
57         - name: {{ include "common.name" . }}
58           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
59           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60           command: ["/opt/app/policy/pap/bin/policy-pap.sh"]
61           args: ["/opt/app/policy/pap/etc/mounted/config.json"]
62           ports: {{ include "common.containerPorts" . | nindent 12  }}
63           # disable liveness probe when breakpoints set in debugger
64           # so K8s doesn't restart unresponsive container
65           {{- if eq .Values.liveness.enabled true }}
66           livenessProbe:
67             tcpSocket:
68               port: {{ .Values.liveness.port }}
69             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.liveness.periodSeconds }}
71           {{ end -}}
72           readinessProbe:
73             tcpSocket:
74               port: {{ .Values.readiness.port }}
75             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.readiness.periodSeconds }}
77           volumeMounts:
78           - mountPath: /etc/localtime
79             name: localtime
80             readOnly: true
81           - mountPath: /opt/app/policy/pap/etc/mounted
82             name: papconfig-processed
83           resources:
84 {{ include "common.resources" . | indent 12 }}
85         {{- if .Values.nodeSelector }}
86         nodeSelector:
87 {{ toYaml .Values.nodeSelector | indent 10 }}
88         {{- end -}}
89         {{- if .Values.affinity }}
90         affinity:
91 {{ toYaml .Values.affinity | indent 10 }}
92         {{- end }}
93       volumes:
94         - name: localtime
95           hostPath:
96              path: /etc/localtime
97         - name: papconfig
98           configMap:
99             name: {{ include "common.fullname" . }}-configmap
100             defaultMode: 0755
101         - name: papconfig-processed
102           emptyDir:
103             medium: Memory
104       imagePullSecrets:
105       - name: "{{ include "common.namespace" . }}-docker-registry-key"