blob: e8c96cee7744c86fefa75ae982ded349fd1ac754 [file] [log] [blame]
ramverma1a3b8ad2019-02-25 12:45:11 +00001apiVersion: extensions/v1beta1
2kind: Deployment
Bruno Sakoto0644c262020-05-22 16:56:35 -04003metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
ramverma1a3b8ad2019-02-25 12:45:11 +00004spec:
Bruno Sakoto0644c262020-05-22 16:56:35 -04005 selector: {{- include "common.selectors" . | nindent 4 }}
ramverma1a3b8ad2019-02-25 12:45:11 +00006 replicas: {{ .Values.replicaCount }}
7 template:
Bruno Sakoto0644c262020-05-22 16:56:35 -04008 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
ramverma1a3b8ad2019-02-25 12:45:11 +00009 spec:
ramverma6acdabf2019-04-12 18:56:03 +000010 initContainers:
11 - command:
12 - /root/ready.py
13 args:
14 - --container-name
Sylvain Desbureaux4898dc02019-11-14 13:35:13 +010015 - {{ .Values.global.mariadb.service.name }}
ramverma6acdabf2019-04-12 18:56:03 +000016 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
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +020025
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 }}
Dominik Mizyn389fca12020-04-09 22:37:00 +020036 - 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 }}
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +020048 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
ramverma1a3b8ad2019-02-25 12:45:11 +000056 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"]
jhhbf7fb4d2019-08-07 16:54:41 -050061 args: ["/opt/app/policy/pap/etc/mounted/config.json"]
Bruno Sakoto0644c262020-05-22 16:56:35 -040062 ports: {{ include "common.containerPorts" . | nindent 12 }}
ramverma1a3b8ad2019-02-25 12:45:11 +000063 # 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:
Bruno Sakoto0644c262020-05-22 16:56:35 -040068 port: {{ .Values.liveness.port }}
ramverma1a3b8ad2019-02-25 12:45:11 +000069 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70 periodSeconds: {{ .Values.liveness.periodSeconds }}
71 {{ end -}}
72 readinessProbe:
73 tcpSocket:
Bruno Sakoto0644c262020-05-22 16:56:35 -040074 port: {{ .Values.readiness.port }}
ramverma1a3b8ad2019-02-25 12:45:11 +000075 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
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +020082 name: papconfig-processed
ramverma1a3b8ad2019-02-25 12:45:11 +000083 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
Krzysztof Opasiak3d9dc8b2020-03-31 23:05:16 +0200101 - name: papconfig-processed
102 emptyDir:
103 medium: Memory
ramverma1a3b8ad2019-02-25 12:45:11 +0000104 imagePullSecrets:
105 - name: "{{ include "common.namespace" . }}-docker-registry-key"