Merge "Update SDNC/CCSDK to Frankfurt RC2 versions"
[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: extensions/v1beta1
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   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ include "common.release" . }}
33     spec:
34       initContainers:
35       - name: {{ include "common.name" . }}-job-completion
36         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
37         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
38         command:
39         - /root/job_complete.py
40         args:
41         - --job-name
42         - {{ include "common.release" . }}-portal-db-config
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49 {{ include "common.certInitializer.initContainer" . | indent 6 }}
50       containers:
51       - name: {{ include "common.name" . }}
52         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         command: ["bash","-c"]
55         {{- if .Values.global.aafEnabled }}
56         args: ["export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0);\
57                export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
58               -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
59               /start-apache-tomcat.sh -i \"\" -n \"\" -b {{ .Values.global.env.tomcatDir }}"]
60         env:
61           - name: CATALINA_OPTS
62             value: >
63               -Djavax.net.ssl.keyStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }}"
64               -Djavax.net.ssl.trustStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }}"
65         {{- else }}
66         args: ["/start-apache-tomcat.sh -i "" -n "" -b {{ .Values.global.env.tomcatDir }}"]
67         {{- end }}
68         ports:
69         - containerPort: {{ .Values.service.internalPort }}
70         - containerPort: {{ .Values.service.internalPort2 }}
71         - containerPort: {{ .Values.service.internalPort3 }}
72         - containerPort: {{ .Values.service.internalPort4 }}
73         {{- if eq .Values.liveness.enabled true }}
74         livenessProbe:
75           tcpSocket:
76             port: {{ .Values.service.internalPort }}
77           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
78           periodSeconds: {{ .Values.liveness.periodSeconds }}
79         {{ end -}}
80         readinessProbe:
81           tcpSocket:
82             port: {{ .Values.service.internalPort }}
83           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
84           periodSeconds: {{ .Values.readiness.periodSeconds }}
85         volumeMounts:
86 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
87         - mountPath: /etc/localtime
88           name: localtime
89           readOnly: true
90         - name: properties-onapportal
91           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
92           subPath: fusion.properties
93         - name: properties-onapportal
94           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
95           subPath: openid-connect.properties
96         - name: properties-onapportal
97           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
98           subPath: system.properties
99         - name: properties-onapportal
100           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
101           subPath: portal.properties
102         - name: properties-onapportal
103           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
104           subPath: music.properties
105         - name: properties-onapportal
106           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
107           subPath: logback.xml
108         - name: properties-onapportal
109           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
110           subPath: server.xml
111         - name: properties-onapportal
112           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/web.xml"
113           subPath: web.xml
114         - name: var-log-onap
115           mountPath: /var/log/onap
116         resources:
117 {{ include "common.resources" . }}
118       {{- if .Values.nodeSelector }}
119       nodeSelector:
120 {{ toYaml .Values.nodeSelector | indent 10 }}
121       {{- end -}}
122       {{- if .Values.affinity }}
123       affinity:
124 {{ toYaml .Values.affinity | indent 10 }}
125       {{- end }}
126       - name: filebeat-onap
127         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
128         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
129         volumeMounts:
130         - mountPath: /usr/share/filebeat/filebeat.yml
131           name: filebeat-conf
132           subPath: filebeat.yml
133         - name: portal-data-filebeat
134           mountPath: /usr/share/filebeat/data
135         - name: var-log-onap
136           mountPath: /var/log/onap
137       volumes:
138 {{ include "common.certInitializer.volumes" . | indent 8 }}
139         - name: localtime
140           hostPath:
141             path: /etc/localtime
142         - name: properties-onapportal
143           configMap:
144             name: {{ include "common.fullname" . }}-onapportal
145             defaultMode: 0755
146         - name: filebeat-conf
147           configMap:
148             name: portal-filebeat
149         - name: var-log-onap
150           emptyDir: {}
151         - name: portal-data-filebeat
152           emptyDir: {}
153         - name: portal-tomcat-logs
154           emptyDir: {}
155       imagePullSecrets:
156       - name: "{{ include "common.namespace" . }}-docker-registry-key"