Merge "[A1POLICYMANAGEMENT] Guilin version bump"
[oom.git] / kubernetes / portal / components / portal-app / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2020 AT&T
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       - name: {{ include "common.name" . }}-job-completion
39         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
40         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
41         command:
42         - /app/ready.py
43         args:
44         - --job-name
45         - {{ include "common.release" . }}-portal-db-config
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52       - name: {{ include "common.name" . }}-portal-config
53         image: "{{ .Values.global.envsubstImage }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         command: ["/bin/sh"]
56         args: [ "-c", "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"]
57         env:
58           - name: CASSA_USER
59             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "login") | indent 12 }}
60           - name: CASSA_PASSWORD
61             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "password") | indent 12 }}
62           - name: CIPHER_ENC_KEY
63             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cipher-enc-key" "key" "password") | indent 12 }}
64         volumeMounts:
65         - mountPath: /config-input
66           name: properties-onapportal-scrubbed
67         - mountPath: /config
68           name: properties-onapportal
69 {{ include "common.certInitializer.initContainer" . | indent 6 }}
70       containers:
71       - name: {{ include "common.name" . }}
72         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
73         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         command: ["bash","-c"]
75         {{- if .Values.global.aafEnabled }}
76         args: ["export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0);\
77                export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
78               -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
79               /start-apache-tomcat.sh -i \"\" -n \"\" -b {{ .Values.global.env.tomcatDir }}"]
80         env:
81           - name: CATALINA_OPTS
82             value: >
83               -Djavax.net.ssl.keyStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }}"
84               -Djavax.net.ssl.trustStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }}"
85         {{- else }}
86         args: ["/start-apache-tomcat.sh -i "" -n "" -b {{ .Values.global.env.tomcatDir }}"]
87         {{- end }}
88         ports:
89         - containerPort: {{ .Values.service.internalPort }}
90         - containerPort: {{ .Values.service.internalPort2 }}
91         - containerPort: {{ .Values.service.internalPort3 }}
92         - containerPort: {{ .Values.service.internalPort4 }}
93         {{- if eq .Values.liveness.enabled true }}
94         livenessProbe:
95           tcpSocket:
96             port: {{ .Values.service.internalPort }}
97           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
98           periodSeconds: {{ .Values.liveness.periodSeconds }}
99         {{ end -}}
100         readinessProbe:
101           tcpSocket:
102             port: {{ .Values.service.internalPort }}
103           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
104           periodSeconds: {{ .Values.readiness.periodSeconds }}
105         volumeMounts:
106 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
107         - mountPath: /etc/localtime
108           name: localtime
109           readOnly: true
110         - name: properties-onapportal
111           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
112           subPath: fusion.properties
113         - name: properties-onapportal
114           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
115           subPath: openid-connect.properties
116         - name: properties-onapportal
117           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
118           subPath: system.properties
119         - name: properties-onapportal
120           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
121           subPath: portal.properties
122         - name: properties-onapportal
123           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/key.properties"
124           subPath: key.properties
125         - name: properties-onapportal
126           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
127           subPath: music.properties
128         - name: properties-onapportal
129           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
130           subPath: logback.xml
131         - name: properties-onapportal
132           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
133           subPath: server.xml
134         - name: properties-onapportal
135           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/web.xml"
136           subPath: web.xml
137         - name: properties-onapportal
138           mountPath: "{{ .Values.global.env.tomcatDir }}/temp"
139         - name: var-log-onap
140           mountPath: /var/log/onap
141         resources:
142 {{ include "common.resources" . }}
143       {{- if .Values.nodeSelector }}
144       nodeSelector:
145 {{ toYaml .Values.nodeSelector | indent 10 }}
146       {{- end -}}
147 {{- if .Values.affinity }}
148       affinity:
149 {{ toYaml .Values.affinity | indent 10 }}
150       {{- end }}
151       - name: filebeat-onap
152         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
153         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
154         volumeMounts:
155         - mountPath: /usr/share/filebeat/filebeat.yml
156           name: filebeat-conf
157           subPath: filebeat.yml
158         - name: portal-data-filebeat
159           mountPath: /usr/share/filebeat/data
160         - name: var-log-onap
161           mountPath: /var/log/onap
162       volumes:
163 {{ include "common.certInitializer.volumes" . | indent 8 }}
164         - name: localtime
165           hostPath:
166             path: /etc/localtime
167         - name: properties-onapportal
168           emptyDir:
169             medium: Memory
170         - name: properties-onapportal-scrubbed
171           configMap:
172             name: {{ include "common.fullname" . }}-onapportal
173             defaultMode: 0755
174         - name: filebeat-conf
175           configMap:
176             name: portal-filebeat
177         - name: var-log-onap
178           emptyDir: {}
179         - name: portal-data-filebeat
180           emptyDir: {}
181         - name: portal-tomcat-logs
182           emptyDir: {}
183       imagePullSecrets:
184       - name: "{{ include "common.namespace" . }}-docker-registry-key"