[CONSUL] Add limits to consul chart.
[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       - name: {{ include "common.name" . }}-portal-config
53         image: "{{ .Values.global.envsubstImage }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         command:
56         - sh
57         args:
58         - "-c"
59         - |
60           cd /config-input && \
61           for PFILE in `ls -1 *.xml`
62           do
63             cp ${PFILE} /config
64             chmod 0755 /config/${PFILE}
65           done
66           cd /config-input && \
67           for PFILE in `ls -1 *.properties`
68           do
69             envsubst <${PFILE} >/config/${PFILE}
70             chmod 0755 /config/${PFILE}
71           done
72         env:
73           - name: CASSA_USER
74             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "login") | indent 12 }}
75           - name: CASSA_PASSWORD
76             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-cass" "key" "password") | indent 12 }}
77           - name: CIPHER_ENC_KEY
78             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cipher-enc-key" "key" "password") | indent 12 }}
79           - name: PORTAL_DB_USER
80             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "login") | indent 12 }}
81           - name: PORTAL_DB_PASSWORD
82             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "password") | indent 12 }}
83         volumeMounts:
84         - mountPath: /config-input
85           name: properties-onapportal-scrubbed
86         - mountPath: /config
87           name: properties-onapportal
88 {{ include "common.certInitializer.initContainer" . | indent 6 }}
89       containers:
90       - name: {{ include "common.name" . }}
91         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
92         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93         command: ["bash","-c"]
94         {{- if .Values.global.aafEnabled }}
95         args: ["export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0);\
96                export _JAVA_OPTIONS=\"-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
97               -Djavax.net.ssl.keyStorePassword=$cadi_keystore_password_p12\";\
98               /start-apache-tomcat.sh -i \"\" -n \"\" -b {{ .Values.global.env.tomcatDir }}"]
99         env:
100           - name: CATALINA_OPTS
101             value: >
102               -Djavax.net.ssl.keyStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }}"
103               -Djavax.net.ssl.trustStore="{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }}"
104         {{- else }}
105         args: ["/start-apache-tomcat.sh -i "" -n "" -b {{ .Values.global.env.tomcatDir }}"]
106         {{- end }}
107         ports:
108         - containerPort: {{ .Values.service.internalPort }}
109         - containerPort: {{ .Values.service.internalPort2 }}
110         - containerPort: {{ .Values.service.internalPort3 }}
111         - containerPort: {{ .Values.service.internalPort4 }}
112         {{- if eq .Values.liveness.enabled true }}
113         livenessProbe:
114           tcpSocket:
115             port: {{ .Values.service.internalPort }}
116           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
117           periodSeconds: {{ .Values.liveness.periodSeconds }}
118         {{ end -}}
119         readinessProbe:
120           tcpSocket:
121             port: {{ .Values.service.internalPort }}
122           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
123           periodSeconds: {{ .Values.readiness.periodSeconds }}
124         volumeMounts:
125 {{ include "common.certInitializer.volumeMount" . | indent 8 }}
126         - mountPath: /etc/localtime
127           name: localtime
128           readOnly: true
129         - name: properties-onapportal
130           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties"
131           subPath: fusion.properties
132         - name: properties-onapportal
133           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/openid-connect.properties"
134           subPath: openid-connect.properties
135         - name: properties-onapportal
136           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/conf/system.properties"
137           subPath: system.properties
138         - name: properties-onapportal
139           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/portal.properties"
140           subPath: portal.properties
141         - name: properties-onapportal
142           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/key.properties"
143           subPath: key.properties
144         - name: properties-onapportal
145           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/music.properties"
146           subPath: music.properties
147         - name: properties-onapportal
148           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/classes/logback.xml"
149           subPath: logback.xml
150         - name: properties-onapportal
151           mountPath: "{{ .Values.global.env.tomcatDir }}/conf/server.xml"
152           subPath: server.xml
153         - name: properties-onapportal
154           mountPath: "{{ .Values.global.env.tomcatDir }}/webapps/ONAPPORTAL/WEB-INF/web.xml"
155           subPath: web.xml
156         - name: properties-onapportal
157           mountPath: "{{ .Values.global.env.tomcatDir }}/temp"
158         - name: var-log-onap
159           mountPath: /var/log/onap
160         resources:
161 {{ include "common.resources" . }}
162       {{- if .Values.nodeSelector }}
163       nodeSelector:
164 {{ toYaml .Values.nodeSelector | indent 10 }}
165       {{- end -}}
166 {{- if .Values.affinity }}
167       affinity:
168 {{ toYaml .Values.affinity | indent 10 }}
169       {{- end }}
170       - name: filebeat-onap
171         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
172         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
173         volumeMounts:
174         - mountPath: /usr/share/filebeat/filebeat.yml
175           name: filebeat-conf
176           subPath: filebeat.yml
177         - name: portal-data-filebeat
178           mountPath: /usr/share/filebeat/data
179         - name: var-log-onap
180           mountPath: /var/log/onap
181       volumes:
182 {{ include "common.certInitializer.volumes" . | indent 8 }}
183         - name: localtime
184           hostPath:
185             path: /etc/localtime
186         - name: properties-onapportal
187           emptyDir:
188             medium: Memory
189         - name: properties-onapportal-scrubbed
190           configMap:
191             name: {{ include "common.fullname" . }}-onapportal
192             defaultMode: 0755
193         - name: filebeat-conf
194           configMap:
195             name: portal-filebeat
196         - name: var-log-onap
197           emptyDir: {}
198         - name: portal-data-filebeat
199           emptyDir: {}
200         - name: portal-tomcat-logs
201           emptyDir: {}
202       imagePullSecrets:
203       - name: "{{ include "common.namespace" . }}-docker-registry-key"