blob: e1f699eccff7f43bdd57b95a127935f56efff967 [file] [log] [blame]
Chenfei Gao9292e882019-02-27 22:14:45 -05001apiVersion: extensions/v1beta1
2kind: Deployment
3metadata:
4 name: {{ include "common.fullname" . }}
5 namespace: {{ include "common.namespace" . }}
6 labels:
7 app: {{ include "common.name" . }}
8 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +01009 release: {{ include "common.release" . }}
Chenfei Gao9292e882019-02-27 22:14:45 -050010 heritage: {{ .Release.Service }}
11spec:
12 replicas: {{ .Values.replicaCount }}
13 template:
14 metadata:
15 labels:
16 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010017 release: {{ include "common.release" . }}
Chenfei Gao9292e882019-02-27 22:14:45 -050018 spec:
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040019 initContainers:
20 - command:
21 - /root/ready.py
22 args:
23 - --container-name
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010024 - {{ include "common.release" . }}-galera-config
Chenfei Gao8fdac3a2019-04-12 14:39:40 -040025 env:
26 - name: NAMESPACE
27 valueFrom:
28 fieldRef:
29 apiVersion: v1
30 fieldPath: metadata.namespace
31 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
32 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
33 name: {{ include "common.name" . }}-readiness
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020034
35 - command:
36 - sh
37 args:
38 - -c
39 - "export SQL_PASSWORD_BASE64=`echo -n ${SQL_PASSWORD} | base64`; cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
40 env:
41 - name: SQL_USER
Dominik Mizyn11038102020-04-14 17:14:42 +020042 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "login") | indent 12 }}
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020043 - name: SQL_PASSWORD
Dominik Mizyn11038102020-04-14 17:14:42 +020044 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "password") | indent 12 }}
45 - name: RESTSERVER_USER
46 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 12 }}
47 - name: RESTSERVER_PASSWORD
48 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 12 }}
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020049 volumeMounts:
50 - mountPath: /config-input
51 name: apiconfig
52 - mountPath: /config
53 name: apiconfig-processed
54 image: "{{ .Values.global.envsubstImage }}"
55 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56 name: {{ include "common.name" . }}-update-config
57
Chenfei Gao9292e882019-02-27 22:14:45 -050058 containers:
59 - name: {{ include "common.name" . }}
60 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
61 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62 command: ["/opt/app/policy/api/bin/policy-api.sh"]
63 args: ["/opt/app/policy/api/etc/mounted/config.json"]
64 ports:
65 - containerPort: {{ .Values.service.internalPort }}
66 # disable liveness probe when breakpoints set in debugger
67 # so K8s doesn't restart unresponsive container
68 {{- if eq .Values.liveness.enabled true }}
69 livenessProbe:
70 tcpSocket:
71 port: {{ .Values.service.internalPort }}
72 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
73 periodSeconds: {{ .Values.liveness.periodSeconds }}
74 {{ end -}}
75 readinessProbe:
76 tcpSocket:
77 port: {{ .Values.service.internalPort }}
78 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
79 periodSeconds: {{ .Values.readiness.periodSeconds }}
80 volumeMounts:
81 - mountPath: /etc/localtime
82 name: localtime
83 readOnly: true
84 - mountPath: /opt/app/policy/api/etc/mounted
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +020085 name: apiconfig-processed
Chenfei Gao9292e882019-02-27 22:14:45 -050086 resources:
87{{ include "common.resources" . | indent 12 }}
88 {{- if .Values.nodeSelector }}
89 nodeSelector:
90{{ toYaml .Values.nodeSelector | indent 10 }}
91 {{- end -}}
92 {{- if .Values.affinity }}
93 affinity:
94{{ toYaml .Values.affinity | indent 10 }}
95 {{- end }}
96 volumes:
97 - name: localtime
98 hostPath:
99 path: /etc/localtime
100 - name: apiconfig
101 configMap:
102 name: {{ include "common.fullname" . }}-configmap
103 defaultMode: 0755
Krzysztof Opasiak09d1b312020-03-31 23:44:22 +0200104 - name: apiconfig-processed
105 emptyDir:
106 medium: Memory
Chenfei Gao9292e882019-02-27 22:14:45 -0500107 imagePullSecrets:
108 - name: "{{ include "common.namespace" . }}-docker-registry-key"