Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / portal / components / portal-app / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 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" . }}-job-completion
41         image: {{ include "repositoryGenerator.image.readiness" . }}
42         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
43         command:
44         - /app/ready.py
45         args:
46         - --job-name
47         - {{ include "common.release" . }}-portal-db-config
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54       - name: {{ include "common.name" . }}-portal-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-onapportal-scrubbed
88         - mountPath: /config
89           name: properties-onapportal
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 -i \"\" -n \"\" -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 -i \"\" -n \"\" -b {{ .Values.global.env.tomcatDir }}"]
108         {{- end }}
109         ports:
110         - containerPort: {{ .Values.service.internalPort }}
111         - containerPort: {{ .Values.service.internalPort2 }}
112         - containerPort: {{ .Values.service.internalPort3 }}
113         - containerPort: {{ .Values.service.internalPort4 }}
114         {{- if eq .Values.liveness.enabled true }}
115         livenessProbe:
116           tcpSocket:
117             port: {{ .Values.service.internalPort }}
118           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
119           periodSeconds: {{ .Values.liveness.periodSeconds }}
120         {{ end -}}
121         readinessProbe:
122           tcpSocket:
123             port: {{ .Values.service.internalPort }}
124           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
125           periodSeconds: {{ .Values.readiness.periodSeconds }}
126         volumeMounts:
127 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
128         - mountPath: /etc/localtime
129           name: localtime
130           readOnly: true
131         - name: properties-onapportal
132           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
133           subPath: fusion.properties
134         - name: properties-onapportal
135           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
136           subPath: openid-connect.properties
137         - name: properties-onapportal
138           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
139           subPath: system.properties
140         - name: properties-onapportal
141           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
142           subPath: portal.properties
143         - name: properties-onapportal
144           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/key.properties"
145           subPath: key.properties
146         - name: properties-onapportal
147           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
148           subPath: music.properties
149         - name: properties-onapportal
150           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
151           subPath: logback.xml
152         - name: properties-onapportal
153           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
154           subPath: server.xml
155         - name: properties-onapportal
156           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/web.xml"
157           subPath: web.xml
158         - name: properties-onapportal
159           mountPath: "{{ .Values.global.env.tomcatDir }}/temp"
160         - name: var-log-onap
161           mountPath: "{{ .Values.log.path }}"
162         resources:
163 {{ include "common.resources" . }}
164       {{- if .Values.nodeSelector }}
165       nodeSelector:
166 {{ toYaml .Values.nodeSelector | indent 10 }}
167       {{- end -}}
168 {{- if .Values.affinity }}
169       affinity:
170 {{ toYaml .Values.affinity | indent 10 }}
171       {{- end }}
172       {{ include "common.log.sidecar" . | nindent 6 }}
173       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
174       volumes:
175 {{ include "common.certInitializer.volumes" . | indent 8 }}
176         - name: localtime
177           hostPath:
178             path: /etc/localtime
179         - name: properties-onapportal
180           emptyDir:
181             medium: Memory
182         - name: properties-onapportal-scrubbed
183           configMap:
184             name: {{ include "common.fullname" . }}-onapportal
185             defaultMode: 0755
186         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix . )) | nindent 8 }}
187         - name: var-log-onap
188           emptyDir: {}
189         - name: portal-tomcat-logs
190           emptyDir: {}
191       imagePullSecrets:
192       - name: "{{ include "common.namespace" . }}-docker-registry-key"