Merge "Add support for metal LB in DNS deploy script"
[oom.git] / kubernetes / portal / charts / 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       - name: {{ include "common.name" . }}-aaf-readiness
51         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         command:
54           - /root/ready.py
55         args:
56           - --container-name
57           - aaf-locate
58           - --container-name
59           - aaf-cm
60         env:
61           - name: NAMESPACE
62             valueFrom:
63               fieldRef:
64                 apiVersion: v1
65                 fieldPath: metadata.namespace
66       - name: {{ include "common.name" . }}-aaf-config
67         image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69         command: ["bash","-c"]
70         args: ["/opt/app/aaf_config/bin/agent.sh;/opt/app/aaf_config/bin/agent.sh local showpass \
71         {{.Values.aafConfig.fqi}} {{ .Values.aafConfig.fqdn }} > {{ .Values.persistence.aafCredsPath }}/mycreds.prop"]
72         volumeMounts:
73           - mountPath: {{ .Values.persistence.aafCredsPath }}
74             name: {{ include "common.fullname" . }}-aaf-config-vol
75         env:
76           - name: APP_FQI
77             value: "{{ .Values.aafConfig.fqi }}"
78           - name: aaf_locate_url
79             value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
80           - name: aaf_locator_container
81             value: "{{ .Values.global.aafLocatorContainer }}"
82           - name: aaf_locator_container_ns
83             value: "{{ .Release.Namespace }}"
84           - name: aaf_locator_fqdn
85             value: "{{ .Values.aafConfig.fqdn }}"
86           - name: aaf_locator_public_fqdn
87             value: "{{.Values.aafConfig.publicFqdn}}"
88           - name: aaf_locator_app_ns
89             value: "{{ .Values.global.aafAppNs }}"
90           - name: DEPLOY_FQI
91             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-deploy-creds" "key" "login") | indent 12 }}
92           - name: DEPLOY_PASSWORD
93             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "aaf-deploy-creds" "key" "password") | indent 12 }}
94           - name: cadi_longitude
95             value: "{{ .Values.aafConfig.cadiLongitude }}"
96           - name: cadi_latitude
97             value: "{{ .Values.aafConfig.cadiLatitude }}"
98       {{ end }}
99       containers:
100       - name: {{ include "common.name" . }}
101         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
102         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
103         command: ["bash","-c"]
104         {{- if .Values.global.aafEnabled }}
105         args: ["export $(grep '^c' {{ .Values.persistence.aafCredsPath }}/mycreds.prop | xargs -0);\
106         export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
107         -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
108         cat /dev/null > {{ .Values.persistence.aafCredsPath }}/mycreds.prop;\
109         /start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
110         env:
111           - name: _CATALINA_OPTS
112             value: >
113               -Djavax.net.ssl.keyStore="{{ .Values.persistence.aafCredsPath }}/{{ .Values.aafConfig.keystoreFile }}"
114               -Djavax.net.ssl.trustStore="{{ .Values.persistence.aafCredsPath }}/{{ .Values.aafConfig.truststoreFile }}"
115         {{- else }}
116         args: ["/start-apache-tomcat.sh -b {{ .Values.global.env.tomcatDir }}"]
117         {{- end }}
118         ports:
119         - containerPort: {{ .Values.service.internalPort }}
120         {{- if eq .Values.liveness.enabled true }}
121         livenessProbe:
122           tcpSocket:
123             port: {{ .Values.service.internalPort }}
124           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
125           periodSeconds: {{ .Values.liveness.periodSeconds }}
126         {{ end -}}
127         readinessProbe:
128           tcpSocket:
129             port: {{ .Values.service.internalPort }}
130           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
131           periodSeconds: {{ .Values.readiness.periodSeconds }}
132         volumeMounts:
133         {{- if .Values.global.aafEnabled }}
134         - mountPath: {{ .Values.persistence.aafCredsPath }}
135           name: {{ include "common.fullname" . }}-aaf-config-vol
136         {{- end }}
137         - name: properties-onapportalsdk
138           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
139           subPath: server.xml
140         - mountPath: /etc/localtime
141           name: localtime
142           readOnly: true
143         - name: properties-onapportalsdk
144           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties"
145           subPath: fusion.properties
146         - name: properties-onapportalsdk
147           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/conf/system.properties"
148           subPath: system.properties
149         - name: properties-onapportalsdk
150           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/portal.properties"
151           subPath: portal.properties
152         - name: properties-onapportalsdk
153           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/music.properties"
154           subPath: music.properties
155         - name: properties-onapportalsdk
156           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTALSDK/WEB-INF/classes/logback.xml"
157           subPath: logback.xml
158         - name: portal-tomcat-logs
159           mountPath: "{{ .Values.global.env.tomcatDir }}/logs"
160         - name: var-log-onap
161           mountPath: /var/log/onap
162         resources:
163 {{ include "common.resources" . | indent 12 }}
164       {{- if .Values.nodeSelector }}
165       nodeSelector:
166 {{ toYaml .Values.nodeSelector | indent 10 }}
167       {{- end -}}
168       {{- if .Values.affinity }}
169       affinity:
170 {{ toYaml .Values.affinity | indent 10 }}
171       {{- end }}
172       - name: filebeat-onap
173         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
174         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
175         volumeMounts:
176         - mountPath: /usr/share/filebeat/filebeat.yml
177           name: filebeat-conf
178           subPath: filebeat.yml
179         - name: portal-data-filebeat
180           mountPath: /usr/share/filebeat/data
181         - name: var-log-onap
182           mountPath: /var/log/onap
183       volumes:
184         - name: localtime
185           hostPath:
186             path: /etc/localtime
187         - name: properties-onapportalsdk
188           configMap:
189             name: {{ include "common.fullname" . }}-onapportalsdk
190             defaultMode: 0755
191         - name: filebeat-conf
192           configMap:
193             name: portal-filebeat
194         - name: var-log-onap
195           emptyDir: {}
196         - name: portal-data-filebeat
197           emptyDir: {}
198         - name: portal-tomcat-logs
199           emptyDir: {}
200         {{- if .Values.global.aafEnabled }}
201         - name: {{ include "common.fullname" . }}-aaf-config-vol
202           emptyDir:
203             medium: Memory
204         {{- end }}
205       imagePullSecrets:
206       - name: "{{ include "common.namespace" . }}-docker-registry-key"