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