blob: 13b8774f47515337249e44032ac5d90562d1f730 [file] [log] [blame]
Jakub Latuseka0b0d972020-10-21 13:36:30 +02001{{/*
toshrajbhardwajf4fc1c62018-08-06 07:35:14 +00002# Copyright © 2018 ZTE
3# Modifications Copyright © 2018 AT&T, Amdocs, Bell Canada
JunyiDue3fccd42022-09-28 16:56:13 +08004# Modifications Copyright © 2022 CMCC Corporation
vaibhav_16dec14d51612018-03-28 07:48:35 +00005# 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.
Jakub Latuseka0b0d972020-10-21 13:36:30 +020016*/}}
vaibhav_16dec14d51612018-03-28 07:48:35 +000017
Grzegorz-Lisb5717032020-07-28 09:57:43 +020018apiVersion: apps/v1
vaibhav_16dec14d51612018-03-28 07:48:35 +000019kind: Deployment
JunyiDue3fccd42022-09-28 16:56:13 +080020metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
vaibhav_16dec14d51612018-03-28 07:48:35 +000021spec:
JunyiDue3fccd42022-09-28 16:56:13 +080022 selector: {{- include "common.selectors" . | nindent 4 }}
vaibhav_16dec14d51612018-03-28 07:48:35 +000023 replicas: {{ .Values.replicaCount }}
24 template:
25 metadata:
JunyiDue3fccd42022-09-28 16:56:13 +080026 {{- include "common.templateMetadata" . | nindent 6 }}
vaibhav_16dec14d51612018-03-28 07:48:35 +000027 spec:
JunyiDue3fccd42022-09-28 16:56:13 +080028 {{ include "common.podSecurityContext" . | indent 6 | trim }}
29 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +010030 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
JunyiDue3fccd42022-09-28 16:56:13 +080031 - command:
32 - sh
33 args:
34 - -c
35 - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
36 env:
37 - name: KEYSTORE_PASSWORD
38 value: "${KEYSTORE_PASSWORD}"
39 - name: POSTGRES_USERNAME
40 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
41 - name: POSTGRES_PASSWORD
42 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
43 volumeMounts:
44 - mountPath: /config-input
45 name: init-data-input
46 - mountPath: /config
47 name: init-data
48 image: {{ include "repositoryGenerator.image.envsubst" . }}
49 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50 name: {{ include "common.name" . }}-update-config
51
52 - command:
53 - /app/ready.py
54 args:
55 - --container-name
56 - "{{ .Values.postgres.nameOverride }}"
57 env:
58 - name: NAMESPACE
59 valueFrom:
60 fieldRef:
61 apiVersion: v1
62 fieldPath: metadata.namespace
63 image: {{ include "repositoryGenerator.image.readiness" . }}
64 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65 name: {{ include "common.name" . }}-readiness
vaibhav_16dec14d51612018-03-28 07:48:35 +000066 containers:
67 - name: {{ include "common.name" . }}
Sylvain Desbureaux666bedf2020-11-19 17:38:23 +010068 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
vaibhav_16dec14d51612018-03-28 07:48:35 +000069 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +010070 command:
71 - sh
72 args:
73 - -c
74 - |
75 export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
76 bash /uui/run.sh
vaibhav_16dec14d51612018-03-28 07:48:35 +000077 ports:
78 - containerPort: {{ .Values.service.internalPort }}
79 # disable liveness probe when breakpoints set in debugger
80 # so K8s doesn't restart unresponsive container
81 {{- if eq .Values.liveness.enabled true }}
82 livenessProbe:
83 tcpSocket:
84 port: {{ .Values.service.internalPort }}
85 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86 periodSeconds: {{ .Values.liveness.periodSeconds }}
JunyiDue3fccd42022-09-28 16:56:13 +080087 {{- end }}
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +010088 resources: {{ include "common.resources" . | nindent 12 }}
vaibhav_16dec14d51612018-03-28 07:48:35 +000089 readinessProbe:
90 tcpSocket:
91 port: {{ .Values.service.internalPort }}
92 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
93 periodSeconds: {{ .Values.readiness.periodSeconds }}
94 env:
95 - name: MSB_ADDR
96 value: {{tpl .Values.msbaddr .}}
97 - name: MR_ADDR
98 value: {{tpl .Values.mraddr .}}
JunyiDue3fccd42022-09-28 16:56:13 +080099 - name: POSTGRES_IP
100 value: {{.Values.postgres.service.name2}}
101 - name: POSTGRES_PORT
102 value: "$(UUI_SERVER_POSTGRES_SERVICE_PORT)"
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +0100103 - name: SPRING_OPTS
104 value: --spring.config.location=file:/config/application.properties
JunyiDue3fccd42022-09-28 16:56:13 +0800105 - name: POSTGRES_DB_NAME
106 value: {{ .Values.postgres.config.pgDatabase }}
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +0100107 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
108 - mountPath: /uui/run.sh
109 name: entrypoint
110 subPath: run.sh
111 - mountPath: /config/application.properties
JunyiDue3fccd42022-09-28 16:56:13 +0800112 name: init-data
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +0100113 subPath: application.properties
JunyiDue3fccd42022-09-28 16:56:13 +0800114 volumes:
115 - name: init-data-input
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +0100116 configMap:
117 name: {{ include "common.fullname" . }}
JunyiDue3fccd42022-09-28 16:56:13 +0800118 - name: init-data
119 emptyDir:
120 medium: Memory
Sylvain Desbureauxe6a1a372021-02-25 18:07:55 +0100121 - name: entrypoint
122 configMap:
123 name: {{ include "common.fullname" . }}-entrypoint
124 defaultMode: 0755
JunyiDue3fccd42022-09-28 16:56:13 +0800125 {{ include "common.certInitializer.volumes" . | nindent 6 }}
vaibhav_16dec14d51612018-03-28 07:48:35 +0000126 imagePullSecrets:
127 - name: "{{ include "common.namespace" . }}-docker-registry-key"