Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / portal / components / portal-sdk / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018,2020 AT&T
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
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   replicas: {{ .Values.replicaCount }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40       - name: {{ include "common.name" . }}-readiness
41         image: {{ include "repositoryGenerator.image.readiness" . }}
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         command:
44         - /app/ready.py
45         args:
46         - --container-name
47         - "portal-db"
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54       - name: {{ include "common.name" . }}-portalsdk-config
55         image: {{ include "repositoryGenerator.image.envsubst" . }}
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57         command:
58         - sh
59         args:
60         - "-c"
61         - |
62           cd /config-input && \
63           for PFILE in `ls -1 *.xml`
64           do
65             cp ${PFILE} /config
66             chmod 0755 /config/${PFILE}
67           done
68           cd /config-input && \
69           for PFILE in `ls -1 *.properties`
70           do
71             envsubst <${PFILE} >/config/${PFILE}
72             chmod 0755 /config/${PFILE}
73           done
74         env:
75           - name: CASSA_USER
76             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "login") | indent 12 }}
77           - name: CASSA_PASSWORD
78             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "password") | indent 12 }}
79           - name: CIPHER_ENC_KEY
80             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cipher-enc-key" "key" "password") | indent 12 }}
81           - name: PORTAL_DB_USER
82             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "login") | indent 12 }}
83           - name: PORTAL_DB_PASSWORD
84             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "password") | indent 12 }}
85         volumeMounts:
86         - mountPath: /config-input
87           name: properties-onapportalsdk-scrubbed
88         - mountPath: /config
89           name: properties-onapportalsdk
90 {{ include "common.certInitializer.initContainer" . | indent 6 }}
91       containers:
92       - name: {{ include "common.name" . }}
93         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
94         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95         command: ["bash","-c"]
96         {{- if .Values.global.aafEnabled }}
97         args: ["export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0);\
98         export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
99         -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
100         /start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
101         env:
102           - name: CATALINA_OPTS
103             value: >
104               -Djavax.net.ssl.keyStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }}"
105               -Djavax.net.ssl.trustStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }}"
106         {{- else }}
107         args: ["/start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
108         {{- end }}
109         ports:
110         - containerPort: {{ .Values.service.internalPort }}
111         {{- if eq .Values.liveness.enabled true }}
112         livenessProbe:
113           tcpSocket:
114             port: {{ .Values.service.internalPort }}
115           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
116           periodSeconds: {{ .Values.liveness.periodSeconds }}
117         {{ end -}}
118         readinessProbe:
119           tcpSocket:
120             port: {{ .Values.service.internalPort }}
121           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
122           periodSeconds: {{ .Values.readiness.periodSeconds }}
123         volumeMounts:
124 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
125         - name: properties-onapportalsdk
126           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
127           subPath: server.xml
128         - mountPath: /etc/localtime
129           name: localtime
130           readOnly: true
131         - name: properties-onapportalsdk
132           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties"
133           subPath: fusion.properties
134         - name: properties-onapportalsdk
135           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/conf/system.properties"
136           subPath: system.properties
137         - name: properties-onapportalsdk
138           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/portal.properties"
139           subPath: portal.properties
140         - name: properties-onapportalsdk
141           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/key.properties"
142           subPath: key.properties
143         - name: properties-onapportalsdk
144           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/music.properties"
145           subPath: music.properties
146         - name: properties-onapportalsdk
147           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/logback.xml"
148           subPath: logback.xml
149         - name: portal-tomcat-logs
150           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
151         - name: var-log-onap
152           mountPath: "{{ .Values.log.path }}"
153         resources:
154 {{ include "common.resources" . }}
155       {{- if .Values.nodeSelector }}
156       nodeSelector:
157 {{ toYaml .Values.nodeSelector | indent 10 }}
158       {{- end -}}
159       {{- if .Values.affinity }}
160       affinity:
161 {{ toYaml .Values.affinity | indent 10 }}
162       {{- end }}
163       {{ include "common.log.sidecar" . | nindent 6 }}
164       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
165       volumes:
166         - name: localtime
167           hostPath:
168             path: /etc/localtime
169         - name: properties-onapportalsdk
170           emptyDir:
171             medium: Memory
172         - name: properties-onapportalsdk-scrubbed
173           configMap:
174             name: {{ include "common.fullname" . }}-onapportalsdk
175             defaultMode: 0755
176         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
177         - name: var-log-onap
178           emptyDir: {}
179         - name: portal-tomcat-logs
180           emptyDir: {}
181 {{ include "common.certInitializer.volumes" . | indent 8 }}
182       imagePullSecrets:
183       - name: "{{ include "common.namespace" . }}-docker-registry-key"