Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / cps / components / cps-temporal / templates / deployment.yaml
1 {{/*
2 # ============LICENSE_START=======================================================
3 #  Copyright (c) 2021 Bell Canada.
4 # Modifications Copyright © 2022-2023 Nordix Foundation
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 #  SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20 */}}
21
22 apiVersion: apps/v1
23 kind: Deployment
24 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   minReadySeconds: {{ index .Values.minReadySeconds }}
28   strategy:
29     type: {{ index .Values.updateStrategy.type }}
30     rollingUpdate:
31       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
32       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
33   selector: {{- include "common.selectors" . | nindent 4 }}
34   template:
35     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
36     spec:
37       {{ include "common.podSecurityContext" . | indent 6 | trim}}
38       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
39       initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
40       - name: {{ include "common.name" . }}-update-config
41         image: {{ include "repositoryGenerator.image.envsubst" . }}
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         command:
44             - sh
45         args:
46           - -c
47           - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
48         env:
49           - name: DB_USERNAME
50             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
51           - name: DB_PASSWORD
52             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
53           - name: APP_USERNAME
54             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }}
55           - name: APP_PASSWORD
56             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }}
57           - name: SASL_JAAS_CONFIG
58             valueFrom:
59               secretKeyRef:
60                 name: {{ include "common.name" . }}-ku
61                 key: sasl.jaas.config
62         volumeMounts:
63           - mountPath: /config-input
64             name: init-data-input
65           - mountPath: /config
66             name: init-data
67       containers:
68       - name: {{ include "common.name" . }}
69         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
70         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71         ports: {{ include "common.containerPorts" . | nindent 10  }}
72         {{ include "common.containerSecurityContext" . | indent 8 | trim }}
73         # disable liveness probe when breakpoints set in debugger
74         # so K8s doesn't restart unresponsive container
75         {{- if eq .Values.liveness.enabled true }}
76         livenessProbe:
77           httpGet:
78             port: {{ .Values.liveness.port }}
79             path: {{ .Values.liveness.path }}
80           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
81           periodSeconds: {{ .Values.liveness.periodSeconds }}
82         {{ end -}}
83         readinessProbe:
84           httpGet:
85             port: {{ .Values.readiness.port }}
86             path: {{ .Values.readiness.path }}
87           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
88           periodSeconds: {{ .Values.readiness.periodSeconds }}
89         env:
90           - name: SPRING_PROFILES_ACTIVE
91             value: {{ .Values.config.spring.profile }}
92         resources: {{ include "common.resources" . | nindent 10 }}
93         {{- if .Values.nodeSelector }}
94         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
95         {{- end }}
96         {{- if .Values.affinity }}
97         affinity: {{ toYaml .Values.affinity | nindent 12 }}
98         {{- end }}
99         volumeMounts:
100           - mountPath: /app/resources/application-helm.yml
101             subPath: application-helm.yml
102             name: init-data
103           - mountPath: /app/resources/logback.xml
104             subPath: logback.xml
105             name: init-data
106           - mountPath: /tmp
107             name: init-temp
108       volumes:
109         - name: init-data-input
110           configMap:
111             name: {{ include "common.fullname" . }}
112         - name: init-data
113           emptyDir:
114             medium: Memory
115         - name: init-temp
116           emptyDir: {}
117       {{- include "common.imagePullSecrets" . | nindent 6 }}