14bbd3c7f6a113ec2b6b11b8585aecaecb74bc7d
[oom.git] / kubernetes / portal / charts / 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       {{- if .Values.global.aafEnabled }}
50 {{ include "common.aaf-config" . | indent 6 }}
51       {{- end }}
52       containers:
53       - name: {{ include "common.name" . }}
54         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         command: ["bash","-c"]
57         {{- if .Values.global.aafEnabled }}
58         args: ["export $(grep '^c' {{ .Values.aafConfig.credsPath }}/mycreds.prop | xargs -0);\
59                export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
60               -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
61               /start-apache-tomcat.sh -i \"\" -n \"\" -b {{ .Values.global.env.tomcatDir }}"]
62         env:
63           - name: _CATALINA_OPTS
64             value: >
65               -Djavax.net.ssl.keyStore="{{ .Values.aafConfig.credsPath }}/{{ .Values.aafConfig.keystoreFile }}"
66               -Djavax.net.ssl.trustStore="{{ .Values.aafConfig.credsPath }}/{{ .Values.aafConfig.truststoreFile }}"
67         {{- else }}
68         args: ["/start-apache-tomcat.sh -i "" -n "" -b {{ .Values.global.env.tomcatDir }}"]
69         {{- end }}
70         ports:
71         - containerPort: {{ .Values.service.internalPort }}
72         - containerPort: {{ .Values.service.internalPort2 }}
73         - containerPort: {{ .Values.service.internalPort3 }}
74         - containerPort: {{ .Values.service.internalPort4 }}
75         {{- if eq .Values.liveness.enabled true }}
76         livenessProbe:
77           tcpSocket:
78             port: {{ .Values.service.internalPort }}
79           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
80           periodSeconds: {{ .Values.liveness.periodSeconds }}
81         {{ end -}}
82         readinessProbe:
83           tcpSocket:
84             port: {{ .Values.service.internalPort }}
85           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
86           periodSeconds: {{ .Values.readiness.periodSeconds }}
87         volumeMounts:
88         {{- if .Values.global.aafEnabled }}
89 {{ include "common.aaf-config-volume-mountpath" . | indent 8 }}
90         {{- end }}
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - name: properties-onapportal
95           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
96           subPath: fusion.properties
97         - name: properties-onapportal
98           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
99           subPath: openid-connect.properties
100         - name: properties-onapportal
101           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
102           subPath: system.properties
103         - name: properties-onapportal
104           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
105           subPath: portal.properties
106         - name: properties-onapportal
107           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
108           subPath: music.properties
109         - name: properties-onapportal
110           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
111           subPath: logback.xml
112         - name: properties-onapportal
113           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
114           subPath: server.xml
115         - name: properties-onapportal
116           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/web.xml"
117           subPath: web.xml
118         - name: var-log-onap
119           mountPath: /var/log/onap
120         resources:
121 {{ include "common.resources" . }}
122       {{- if .Values.nodeSelector }}
123       nodeSelector:
124 {{ toYaml .Values.nodeSelector | indent 10 }}
125       {{- end -}}
126       {{- if .Values.affinity }}
127       affinity:
128 {{ toYaml .Values.affinity | indent 10 }}
129       {{- end }}
130       - name: filebeat-onap
131         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
132         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
133         volumeMounts:
134         - mountPath: /usr/share/filebeat/filebeat.yml
135           name: filebeat-conf
136           subPath: filebeat.yml
137         - name: portal-data-filebeat
138           mountPath: /usr/share/filebeat/data
139         - name: var-log-onap
140           mountPath: /var/log/onap
141       volumes:
142         {{- if .Values.global.aafEnabled }}
143 {{ include "common.aaf-config-volumes" . | indent 8 }}
144         {{- end }}
145         - name: localtime
146           hostPath:
147             path: /etc/localtime
148         - name: properties-onapportal
149           configMap:
150             name: {{ include "common.fullname" . }}-onapportal
151             defaultMode: 0755
152         - name: filebeat-conf
153           configMap:
154             name: portal-filebeat
155         - name: var-log-onap
156           emptyDir: {}
157         - name: portal-data-filebeat
158           emptyDir: {}
159         - name: portal-tomcat-logs
160           emptyDir: {}
161       imagePullSecrets:
162       - name: "{{ include "common.namespace" . }}-docker-registry-key"