[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / portal / components / portal-sdk / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018,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" . }}-readiness
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         - --container-name
45         - "portal-db"
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 -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 -b {{ .Values.global.env.tomcatDir }}"]
70         {{- end }}
71         ports:
72         - containerPort: {{ .Values.service.internalPort }}
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         - name: properties-onapportalsdk
88           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
89           subPath: server.xml
90         - mountPath: /etc/localtime
91           name: localtime
92           readOnly: true
93         - name: properties-onapportalsdk
94           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties"
95           subPath: fusion.properties
96         - name: properties-onapportalsdk
97           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/conf/system.properties"
98           subPath: system.properties
99         - name: properties-onapportalsdk
100           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/portal.properties"
101           subPath: portal.properties
102         - name: properties-onapportalsdk
103           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/music.properties"
104           subPath: music.properties
105         - name: properties-onapportalsdk
106           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/logback.xml"
107           subPath: logback.xml
108         - name: portal-tomcat-logs
109           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
110         - name: var-log-onap
111           mountPath: /var/log/onap
112         resources:
113 {{ include "common.resources" . }}
114       {{- if .Values.nodeSelector }}
115       nodeSelector:
116 {{ toYaml .Values.nodeSelector | indent 10 }}
117       {{- end -}}
118       {{- if .Values.affinity }}
119       affinity:
120 {{ toYaml .Values.affinity | indent 10 }}
121       {{- end }}
122       - name: filebeat-onap
123         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
124         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
125         volumeMounts:
126         - mountPath: /usr/share/filebeat/filebeat.yml
127           name: filebeat-conf
128           subPath: filebeat.yml
129         - name: portal-data-filebeat
130           mountPath: /usr/share/filebeat/data
131         - name: var-log-onap
132           mountPath: /var/log/onap
133       volumes:
134         - name: localtime
135           hostPath:
136             path: /etc/localtime
137         - name: properties-onapportalsdk
138           configMap:
139             name: {{ include "common.fullname" . }}-onapportalsdk
140             defaultMode: 0755
141         - name: filebeat-conf
142           configMap:
143             name: portal-filebeat
144         - name: var-log-onap
145           emptyDir: {}
146         - name: portal-data-filebeat
147           emptyDir: {}
148         - name: portal-tomcat-logs
149           emptyDir: {}
150 {{ include "common.certInitializer.volumes" . | indent 8 }}
151       imagePullSecrets:
152       - name: "{{ include "common.namespace" . }}-docker-registry-key"