Merge "[COMMON] add pre upgrade script for mariadb-galera"
[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: 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" . }}-readiness
36         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
37         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38         command:
39         - /root/ready.py
40         args:
41         - --container-name
42         - "portal-db"
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49 {{ include "common.certInitializer.initContainer" . | indent 6 }}
50       containers:
51       - name: {{ include "common.name" . }}
52         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         command: ["bash","-c"]
55         {{- if .Values.global.aafEnabled }}
56         args: ["export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0);\
57         export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
58         -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
59         /start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
60         env:
61           - name: CATALINA_OPTS
62             value: >
63               -Djavax.net.ssl.keyStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }}"
64               -Djavax.net.ssl.trustStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }}"
65         {{- else }}
66         args: ["/start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
67         {{- end }}
68         ports:
69         - containerPort: {{ .Values.service.internalPort }}
70         {{- if eq .Values.liveness.enabled true }}
71         livenessProbe:
72           tcpSocket:
73             port: {{ .Values.service.internalPort }}
74           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
75           periodSeconds: {{ .Values.liveness.periodSeconds }}
76         {{ end -}}
77         readinessProbe:
78           tcpSocket:
79             port: {{ .Values.service.internalPort }}
80           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
81           periodSeconds: {{ .Values.readiness.periodSeconds }}
82         volumeMounts:
83 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
84         - name: properties-onapportalsdk
85           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
86           subPath: server.xml
87         - mountPath: /etc/localtime
88           name: localtime
89           readOnly: true
90         - name: properties-onapportalsdk
91           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties"
92           subPath: fusion.properties
93         - name: properties-onapportalsdk
94           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/conf/system.properties"
95           subPath: system.properties
96         - name: properties-onapportalsdk
97           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/portal.properties"
98           subPath: portal.properties
99         - name: properties-onapportalsdk
100           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/music.properties"
101           subPath: music.properties
102         - name: properties-onapportalsdk
103           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/logback.xml"
104           subPath: logback.xml
105         - name: portal-tomcat-logs
106           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
107         - name: var-log-onap
108           mountPath: /var/log/onap
109         resources:
110 {{ include "common.resources" . }}
111       {{- if .Values.nodeSelector }}
112       nodeSelector:
113 {{ toYaml .Values.nodeSelector | indent 10 }}
114       {{- end -}}
115       {{- if .Values.affinity }}
116       affinity:
117 {{ toYaml .Values.affinity | indent 10 }}
118       {{- end }}
119       - name: filebeat-onap
120         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
121         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
122         volumeMounts:
123         - mountPath: /usr/share/filebeat/filebeat.yml
124           name: filebeat-conf
125           subPath: filebeat.yml
126         - name: portal-data-filebeat
127           mountPath: /usr/share/filebeat/data
128         - name: var-log-onap
129           mountPath: /var/log/onap
130       volumes:
131         - name: localtime
132           hostPath:
133             path: /etc/localtime
134         - name: properties-onapportalsdk
135           configMap:
136             name: {{ include "common.fullname" . }}-onapportalsdk
137             defaultMode: 0755
138         - name: filebeat-conf
139           configMap:
140             name: portal-filebeat
141         - name: var-log-onap
142           emptyDir: {}
143         - name: portal-data-filebeat
144           emptyDir: {}
145         - name: portal-tomcat-logs
146           emptyDir: {}
147 {{ include "common.certInitializer.volumes" . | indent 8 }}
148       imagePullSecrets:
149       - name: "{{ include "common.namespace" . }}-docker-registry-key"