[PORTAL] Move portal subcharts to components
[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       {{- if .Values.global.aafEnabled }}
50 {{ include "common.aaf-config" . | indent 6 }}
51       {{- end }}
52       containers:
53       - name: {{ include "common.name" . }}
54         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         command: ["bash","-c"]
57         {{- if .Values.global.aafEnabled }}
58         args: ["export $(grep '^c' {{ .Values.aafConfig.credsPath }}/mycreds.prop | xargs -0);\
59         export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
60         -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
61         /start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
62         env:
63           - name: CATALINA_OPTS
64             value: >
65               -Djavax.net.ssl.keyStore="{{ .Values.aafConfig.credsPath }}/{{ .Values.aafConfig.keystoreFile }}"
66               -Djavax.net.ssl.trustStore="{{ .Values.aafConfig.credsPath }}/{{ .Values.aafConfig.truststoreFile }}"
67         {{- else }}
68         args: ["/start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
69         {{- end }}
70         ports:
71         - containerPort: {{ .Values.service.internalPort }}
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         {{- if .Values.global.aafEnabled }}
86 {{ include "common.aaf-config-volume-mountpath" . | indent 8 }}
87         {{- end }}
88         - name: properties-onapportalsdk
89           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
90           subPath: server.xml
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - name: properties-onapportalsdk
95           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties"
96           subPath: fusion.properties
97         - name: properties-onapportalsdk
98           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/conf/system.properties"
99           subPath: system.properties
100         - name: properties-onapportalsdk
101           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/portal.properties"
102           subPath: portal.properties
103         - name: properties-onapportalsdk
104           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/music.properties"
105           subPath: music.properties
106         - name: properties-onapportalsdk
107           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/logback.xml"
108           subPath: logback.xml
109         - name: portal-tomcat-logs
110           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
111         - name: var-log-onap
112           mountPath: /var/log/onap
113         resources:
114 {{ include "common.resources" . }}
115       {{- if .Values.nodeSelector }}
116       nodeSelector:
117 {{ toYaml .Values.nodeSelector | indent 10 }}
118       {{- end -}}
119       {{- if .Values.affinity }}
120       affinity:
121 {{ toYaml .Values.affinity | indent 10 }}
122       {{- end }}
123       - name: filebeat-onap
124         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
125         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
126         volumeMounts:
127         - mountPath: /usr/share/filebeat/filebeat.yml
128           name: filebeat-conf
129           subPath: filebeat.yml
130         - name: portal-data-filebeat
131           mountPath: /usr/share/filebeat/data
132         - name: var-log-onap
133           mountPath: /var/log/onap
134       volumes:
135         - name: localtime
136           hostPath:
137             path: /etc/localtime
138         - name: properties-onapportalsdk
139           configMap:
140             name: {{ include "common.fullname" . }}-onapportalsdk
141             defaultMode: 0755
142         - name: filebeat-conf
143           configMap:
144             name: portal-filebeat
145         - name: var-log-onap
146           emptyDir: {}
147         - name: portal-data-filebeat
148           emptyDir: {}
149         - name: portal-tomcat-logs
150           emptyDir: {}
151         {{- if .Values.global.aafEnabled }}
152 {{ include "common.aaf-config-volumes" . | indent 8 }}
153         {{- end }}
154       imagePullSecrets:
155       - name: "{{ include "common.namespace" . }}-docker-registry-key"