Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / vid / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Copyright © 2020 Samsung Electronics
4 # Copyright © 2021 Orange
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:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
41       - command:
42         - /app/ready.py
43         args:
44         - --job-name
45         - {{ include "common.fullname" . }}-mariadb-init-config-job
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52         image: {{ include "repositoryGenerator.image.readiness" . }}
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         name: {{ include "common.name" . }}-readiness
55       containers:
56         - name: {{ include "common.name" . }}
57           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
58           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59           {{- if .Values.global.aafEnabled }}
60           command:
61           - sh
62           args:
63           - -c
64           - |
65             export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
66             export VID_TRUSTSTORE_PLAIN_PASSWORD=${VID_TRUSTSTORE_PASSWORD}
67             export VID_TRUSTSTORE_PASSWORD=`java -cp /usr/local/tomcat/webapps/vid/WEB-INF/lib/jetty-util-9.4.20.v20190813.jar org.eclipse.jetty.util.security.Password ${VID_TRUSTSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"`
68             /tmp/vid/localize.sh
69           {{- end }}
70           ports:
71           - containerPort: {{ .Values.service.internalPort }}
72           # disable liveness probe when breakpoints set in debugger
73           # so K8s doesn't restart unresponsive container
74           {{- if eq .Values.liveness.enabled true }}
75           livenessProbe:
76             tcpSocket:
77               port: {{ .Values.service.internalPort }}
78             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
79             periodSeconds: {{ .Values.liveness.periodSeconds }}
80           {{ end -}}
81           readinessProbe:
82             tcpSocket:
83               port: {{ .Values.service.internalPort }}
84             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
85             periodSeconds: {{ .Values.readiness.periodSeconds }}
86           env:
87             - name: ASDC_CLIENT_REST_HOST
88               value: sdc-be.{{ include "common.namespace" . }}
89             - name: ASDC_CLIENT_REST_AUTH
90               value: "{{ .Values.config.asdcclientrestauth }}"
91             - name: ASDC_CLIENT_REST_PORT
92               value: "{{ .Values.config.asdcclientrestport }}"
93             - name: ASDC_CLIENT_REST_PROTOCOL
94               value: "https"
95             - name: VID_AAI_URL
96               value: https://aai.{{ include "common.namespace" . }}:{{ .Values.config.vidaaiport }}
97             - name: VID_ECOMP_SHARED_CONTEXT_REST_URL
98               value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/context
99             - name: VID_MSO_SERVER_URL
100               value: http://so.{{ include "common.namespace" . }}:{{ .Values.config.msoport }}/onap/so/infra
101             - name: VID_MSO_PASS
102               value: "{{ .Values.config.vidmsopass }}"
103             - name: MSO_DME2_SERVER_URL
104               value: "{{ .Values.config.msodme2serverurl }}"
105             - name: MSO_DME2_ENABLED
106               value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }}
107             - name: VID_ECOMP_REDIRECT_URL
108               value: https://{{ .Values.config.portalhost }}:{{ .Values.config.onapport }}/ONAPPORTAL/login.htm
109             - name: VID_ECOMP_REST_URL
110               value: https://portal-app:{{ .Values.config.onapportrest }}/ONAPPORTAL/auxapi
111             - name: VID_ROLE_ACCESS_CENTRALIZED
112               value: "{{ .Values.config.roleaccesscentralized }}"
113             - name: VID_CONTACT_US_LINK
114               value: "{{ .Values.config.vidcontactuslink }}"
115             - name: VID_UEB_URL_LIST
116               value: message-router.{{ include "common.namespace" . }}
117             - name: VID_MYSQL_HOST
118               value: {{  include "common.mariadbService" . }}
119             - name: VID_MYSQL_PORT
120               value: "{{ include "common.mariadbPort" . }}"
121             - name: VID_MYSQL_DBNAME
122               value: {{ index .Values "mariadb-galera" "db" "name" }}
123             - name: VID_MYSQL_USER
124               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 14 }}
125             - name: VID_MYSQL_PASS
126               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 14 }}
127             - name: VID_MYSQL_MAXCONNECTIONS
128               value: "{{ .Values.config.vidmysqlmaxconnections }}"
129             {{- if .Values.global.aafEnabled }}
130             - name: VID_KEYSTORE_FILENAME
131               value: "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.fqi_namespace }}.jks"
132             - name: VID_TRUSTSTORE_FILENAME
133               value: "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.fqi_namespace }}.trust.jks"
134             {{- end }}
135           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
136           - mountPath: /etc/localtime
137             name: localtime
138             readOnly: true
139           - mountPath: "{{ .Values.log.path }}"
140             name: vid-logs
141           - mountPath: /tmp/logback.xml
142             name: vid-logback
143             subPath: logback.xml
144           - mountPath: /opt/app/vid
145             name: vid-cache
146           resources:
147 {{ include "common.resources" . | indent 12 }}
148         {{- if .Values.nodeSelector }}
149         nodeSelector:
150 {{ toYaml .Values.nodeSelector | indent 10 }}
151         {{- end -}}
152         {{- if .Values.affinity }}
153         affinity:
154 {{ toYaml .Values.affinity | indent 10 }}
155         {{- end }}
156       # side car containers
157         {{ include "common.log.sidecar" . | nindent 8 }}
158       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
159         - name: localtime
160           hostPath:
161             path: /etc/localtime
162         {{ include "common.log.volumes" . | nindent 8 }}
163         - name: vid-cache
164           emptyDir: {}
165         - name: vid-logs
166           emptyDir: {}
167         - name: vid-logback
168           configMap:
169             name: {{ include "common.fullname" . }}-log-configmap
170       imagePullSecrets:
171       - name: "{{ include "common.namespace" . }}-docker-registry-key"