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