Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / uui / components / uui-server / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 ZTE
3 # Modifications Copyright © 2018 AT&T, Amdocs, Bell Canada
4 # Modifications Copyright © 2022 CMCC Corporation
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
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   replicas: {{ .Values.replicaCount }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       {{ include "common.podSecurityContext" . | indent 6 | trim }}
28       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
29       initContainers:
30       - command:
31         - sh
32         args:
33         - -c
34         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
35         env:
36         - name: KEYSTORE_PASSWORD
37           value: "${KEYSTORE_PASSWORD}"
38         - name: POSTGRES_USERNAME
39           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
40         - name: POSTGRES_PASSWORD
41           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
42         volumeMounts:
43         - mountPath: /config-input
44           name: init-data-input
45         - mountPath: /config
46           name: init-data
47         image: {{ include "repositoryGenerator.image.envsubst" . }}
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-update-config
50
51       - command:
52         - /app/ready.py
53         args:
54         - --service-name
55         - "{{ .Values.postgres.service.name2 }}"
56         env:
57         - name: NAMESPACE
58           valueFrom:
59             fieldRef:
60               apiVersion: v1
61               fieldPath: metadata.namespace
62         image: {{ include "repositoryGenerator.image.readiness" . }}
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         name: {{ include "common.name" . }}-readiness
65         resources:
66           limits:
67             cpu: "100m"
68             memory: "500Mi"
69           requests:
70             cpu: "3m"
71             memory: "20Mi"
72       containers:
73         - name: {{ include "common.name" . }}
74           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
75           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76           command:
77           - sh
78           args:
79           - -c
80           - |
81             bash /uui/run.sh
82           ports: {{ include "common.containerPorts" . | nindent 10  }}
83           # disable liveness probe when breakpoints set in debugger
84           # so K8s doesn't restart unresponsive container
85           {{- if eq .Values.liveness.enabled true }}
86           livenessProbe:
87             tcpSocket:
88               port: {{ .Values.service.internalPort }}
89             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90             periodSeconds: {{ .Values.liveness.periodSeconds }}
91           {{- end }}
92           resources: {{ include "common.resources" . | nindent 12 }}
93           readinessProbe:
94             tcpSocket:
95               port: {{ .Values.service.internalPort }}
96             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
97             periodSeconds: {{ .Values.readiness.periodSeconds }}
98           env:
99           - name: MSB_ADDR
100             value: {{tpl .Values.msbaddr .}}
101           - name: MR_ADDR
102             value: {{tpl .Values.mraddr .}}
103           - name: POSTGRES_IP
104             value: {{.Values.postgres.service.name2}}
105           - name: POSTGRES_PORT
106             value: "$(UUI_SERVER_POSTGRES_SERVICE_PORT)"
107           - name: SPRING_OPTS
108             value: --spring.config.location=file:/config/application.properties
109           - name: POSTGRES_DB_NAME
110             value: {{ .Values.postgres.config.pgDatabase }}
111           volumeMounts:
112           - mountPath: /uui/run.sh
113             name: entrypoint
114             subPath: run.sh
115           - mountPath: /config/application.properties
116             name: init-data
117             subPath: application.properties
118       volumes:
119       - name: init-data-input
120         configMap:
121           name: {{ include "common.fullname" . }}
122       - name: init-data
123         emptyDir:
124           medium: Memory
125       - name: entrypoint
126         configMap:
127           name: {{ include "common.fullname" . }}-entrypoint
128           defaultMode: 0755
129       {{- include "common.imagePullSecrets" . | nindent 6 }}