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