fb9f35ba19bd78cc471435f1349396e7edeaff64
[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: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
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         - {{ .Release.Name }}-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         env:
59           - name: javax.net.ssl.keyStore
60             value: {{ .Values.global.env.tomcatDir }}/{{ .Values.global.truststoreFile}} 
61           - name: javax.net.ssl.keyStorePassword
62             value: {{ .Values.global.trustpass }}
63           - name: javax.net.ssl.trustStore
64             value: {{ .Values.global.env.tomcatDir }}/{{ .Values.global.truststoreFile}}
65           - name: javax.net.ssl.trustStorePassword
66             value: {{ .Values.global.trustpass }}
67         ports:
68         - containerPort: {{ .Values.service.internalPort }}
69         - containerPort: {{ .Values.service.internalPort2 }}
70         - containerPort: {{ .Values.service.internalPort3 }}
71         - containerPort: {{ .Values.service.internalPort4 }}
72         {{- if eq .Values.liveness.enabled true }}
73         livenessProbe:
74           tcpSocket:
75             port: {{ .Values.service.internalPort }}
76           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
77           periodSeconds: {{ .Values.liveness.periodSeconds }}
78         {{ end -}}
79         readinessProbe:
80           tcpSocket:
81             port: {{ .Values.service.internalPort }}
82           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
83           periodSeconds: {{ .Values.readiness.periodSeconds }}
84         volumeMounts:
85         - mountPath: /etc/localtime
86           name: localtime
87           readOnly: true
88         - name: properties-onapportal
89           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
90           subPath: fusion.properties
91         - name: properties-onapportal
92           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
93           subPath: openid-connect.properties
94         - name: properties-onapportal
95           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
96           subPath: system.properties
97         - name: properties-onapportal
98           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
99           subPath: portal.properties
100         - name: properties-onapportal
101           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
102           subPath: music.properties
103         - name: properties-onapportal
104           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
105           subPath: logback.xml
106         - name: properties-onapportal
107           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
108           subPath: server.xml
109         - name: authz-onapportal
110           mountPath: "{{ .Values.global.env.tomcatDir }}/{{ .Values.global.keystoreFile}}"
111           subPath: {{ .Values.global.keystoreFile}}
112         - name: authz-onapportal
113           mountPath: "{{ .Values.global.env.tomcatDir }}/{{ .Values.global.truststoreFile}}"
114           subPath: {{ .Values.global.truststoreFile}}          
115         - name: var-log-onap
116           mountPath: /var/log/onap
117         resources:
118 {{ include "common.resources" . | indent 12 }}
119       {{- if .Values.nodeSelector }}
120       nodeSelector:
121 {{ toYaml .Values.nodeSelector | indent 10 }}
122       {{- end -}}
123       {{- if .Values.affinity }}
124       affinity:
125 {{ toYaml .Values.affinity | indent 10 }}
126       {{- end }}
127       - name: filebeat-onap
128         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
129         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
130         volumeMounts:
131         - mountPath: /usr/share/filebeat/filebeat.yml
132           name: filebeat-conf
133           subPath: filebeat.yml
134         - name: portal-data-filebeat
135           mountPath: /usr/share/filebeat/data
136         - name: var-log-onap
137           mountPath: /var/log/onap
138       volumes:
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: authz-onapportal
147           secret:
148             secretName: {{ include "common.fullname" . }}-authz-onapportal
149         - name: filebeat-conf
150           configMap:
151             name: portal-filebeat
152         - name: var-log-onap
153           emptyDir: {}
154         - name: portal-data-filebeat
155           emptyDir: {}
156         - name: portal-tomcat-logs
157           emptyDir: {}
158       imagePullSecrets:
159       - name: "{{ include "common.namespace" . }}-docker-registry-key"