[COMMON] Fix condition equality bashisms
[oom.git] / kubernetes / cps / templates / deployment.yaml
1 {{/*
2 # Copyright (C) 2021 Pantheon.tech, Orange
3 # Modifications Copyright (C) 2021 Bell Canada.
4 # Modifications Copyright (C) 2021 Nordix Foundation. All rights reserved.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 spec:
23   replicas: {{ .Values.replicaCount }}
24   selector: {{- include "common.selectors" . | nindent 4 }}
25   template:
26     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
27     spec:
28       {{ include "common.podSecurityContext" . | indent 6 | trim}}
29       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
30       initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
31       - name: {{ include "common.name" . }}-update-config
32         image: {{ include "repositoryGenerator.image.envsubst" . }}
33         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34         command:
35             - sh
36         args:
37           - -c
38           - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
39         env:
40           - name: DB_USERNAME
41             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
42           - name: DB_PASSWORD
43             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
44           - name: LIQUIBASE_LABELS
45             value: {{ .Values.config.liquibaseLabels }}
46         volumeMounts:
47           - mountPath: /config-input
48             name: init-data-input
49           - mountPath: /config
50             name: init-data
51       containers:
52       - name: {{ include "common.name" . }}
53         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         ports: {{ include "common.containerPorts" . | nindent 10  }}
56         {{ include "common.containerSecurityContext" . | indent 8 | trim }}
57         # disable liveness probe when breakpoints set in debugger
58         # so K8s doesn't restart unresponsive container
59         {{- if eq .Values.liveness.enabled true }}
60         livenessProbe:
61           httpGet:
62             port: {{ .Values.liveness.port }}
63             path: {{ .Values.liveness.path }}
64           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
65           periodSeconds: {{ .Values.liveness.periodSeconds }}
66         {{ end -}}
67         readinessProbe:
68           httpGet:
69             port: {{ .Values.readiness.port }}
70             path: {{ .Values.readiness.path }}
71           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72           periodSeconds: {{ .Values.readiness.periodSeconds }}
73         env:
74           - name: CPS_USERNAME
75             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }}
76           - name: CPS_PASSWORD
77             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }}
78         resources: {{ include "common.resources" . | nindent 10 }}
79         {{- if .Values.nodeSelector }}
80         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
81         {{- end }}
82         {{- if .Values.affinity }}
83         affinity: {{ toYaml .Values.affinity | nindent 12 }}
84         {{- end }}
85         volumeMounts:
86           - mountPath: /app/resources/application.yml
87             subPath: application.yml
88             name: init-data
89           - mountPath: /app/resources/logback.xml
90             subPath: logback.xml
91             name: init-data
92           - mountPath: /tmp
93             name: init-temp
94       volumes:
95         - name: init-data-input
96           configMap:
97             name: {{ include "common.fullname" . }}
98         - name: init-data
99           emptyDir:
100             medium: Memory
101         - name: init-temp
102           emptyDir: {}
103       imagePullSecrets:
104         - name: "{{ include "common.namespace" . }}-docker-registry-key"