Merge "[AAI] Uses new tpls for repos / images"
[oom.git] / kubernetes / aai / components / aai-search-data / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
3 # Modifications Copyright © 2020 Orange
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37       name: {{ include "common.name" . }}
38     spec:
39     {{ if .Values.global.installSidecarSecurity }}
40       initContainers:
41         - name: {{ .Values.global.tproxyConfig.name }}
42           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.tproxyConfig.image }}
43           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44           securityContext:
45             privileged: true
46     {{ end }}
47       containers:
48       - name: {{ include "common.name" . }}
49         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         env:
52         - name: CONFIG_HOME
53           value: /opt/app/search-data-service/config/
54         - name: KEY_STORE_PASSWORD
55           value: {{ .Values.config.keyStorePassword }}
56         - name: KEY_MANAGER_PASSWORD
57           value: {{ .Values.config.keyManagerPassword }}
58         volumeMounts:
59         - mountPath: /etc/localtime
60           name: localtime
61           readOnly: true
62         - mountPath: /opt/app/search-data-service/config/filter-config.json
63           subPath: filter-config.json
64           name: {{ include "common.fullname" . }}-service-config
65         - mountPath: /opt/app/search-data-service/config/elastic-search.properties
66           subPath: elastic-search.properties
67           name: {{ include "common.fullname" . }}-service-config
68         - mountPath: /opt/app/search-data-service/config/analysis-config.json
69           subPath: analysis-config.json
70           name: {{ include "common.fullname" . }}-service-config
71         - mountPath: /opt/app/search-data-service/config/es-payload-translation.json
72           subPath: es-payload-translation.json
73           name: {{ include "common.fullname" . }}-service-config
74         - mountPath: /opt/app/search-data-service/config/dynamic-custom-template.json
75           subPath: dynamic-custom-template.json
76           name: {{ include "common.fullname" . }}-service-config
77         - mountPath: /opt/app/search-data-service/config/auth/tomcat_keystore
78           subPath: tomcat_keystore
79           name: {{ include "common.fullname" . }}-service-auth-config
80         - mountPath: /opt/app/search-data-service/config/auth/search_policy.json
81           subPath: search_policy.json
82           name: {{ include "common.fullname" . }}-search-policy-config
83         - mountPath: /var/log/onap
84           name: {{ include "common.fullname" . }}-service-logs
85         - mountPath: /opt/app/search-data-service/bundleconfig/etc/logback.xml
86           name: {{ include "common.fullname" . }}-service-log-conf
87           subPath: logback.xml
88         ports:
89         - containerPort: {{ .Values.service.internalPort }}
90         # disable liveness probe when breakpoints set in debugger
91         # so K8s doesn't restart unresponsive container
92         {{- if eq .Values.liveness.enabled true }}
93         livenessProbe:
94           tcpSocket:
95             port: {{ .Values.service.internalPort }}
96           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
97           periodSeconds: {{ .Values.liveness.periodSeconds }}
98         {{ end -}}
99         readinessProbe:
100           tcpSocket:
101             port: {{ .Values.service.internalPort }}
102           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
103           periodSeconds: {{ .Values.readiness.periodSeconds }}
104         resources:
105 {{ include "common.resources" . }}
106       {{- if .Values.nodeSelector }}
107       nodeSelector:
108 {{ toYaml .Values.nodeSelector | indent 8 }}
109       {{- end -}}
110       {{- if .Values.affinity }}
111       affinity:
112 {{ toYaml .Values.affinity | indent 8 }}
113       {{- end }}
114
115       # side car containers
116       - name: filebeat-onap
117         image: {{ include "repositoryGenerator.image.logging" . }}
118         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
119         volumeMounts:
120         - mountPath: /usr/share/filebeat/filebeat.yml
121           subPath: filebeat.yml
122           name: filebeat-conf
123         - mountPath: /var/log/onap
124           name: {{ include "common.fullname" . }}-service-logs
125         - mountPath: /usr/share/filebeat/data
126           name: {{ include "common.fullname" . }}-service-filebeat
127
128     {{ if .Values.global.installSidecarSecurity }}
129       - name: {{ .Values.global.rproxy.name }}
130         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.rproxy.image }}
131         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
132         env:
133         - name: CONFIG_HOME
134           value: "/opt/app/rproxy/config"
135         - name: KEY_STORE_PASSWORD
136           value: {{ .Values.config.keyStorePassword }}
137         - name: spring_profiles_active
138           value: {{ .Values.global.rproxy.activeSpringProfiles }}
139         volumeMounts:
140         - name: {{ include "common.fullname" . }}-rproxy-config
141           mountPath: /opt/app/rproxy/config/forward-proxy.properties
142           subPath: forward-proxy.properties
143         - name: {{ include "common.fullname" . }}-rproxy-config
144           mountPath: /opt/app/rproxy/config/primary-service.properties
145           subPath: primary-service.properties
146         - name: {{ include "common.fullname" . }}-rproxy-config
147           mountPath: /opt/app/rproxy/config/reverse-proxy.properties
148           subPath: reverse-proxy.properties
149         - name: {{ include "common.fullname" . }}-rproxy-config
150           mountPath: /opt/app/rproxy/config/cadi.properties
151           subPath: cadi.properties
152         - name: {{ include "common.fullname" . }}-rproxy-log-config
153           mountPath: /opt/app/rproxy/config/logback-spring.xml
154           subPath: logback-spring.xml
155         - name: {{ include "common.fullname" . }}-rproxy-auth-certs
156           mountPath: /opt/app/rproxy/config/auth/tomcat_keystore
157           subPath: tomcat_keystore
158         - name: {{ include "common.fullname" . }}-rproxy-auth-certs
159           mountPath: /opt/app/rproxy/config/auth/client-cert.p12
160           subPath: client-cert.p12
161         - name: {{ include "common.fullname" . }}-rproxy-uri-auth-config
162           mountPath: /opt/app/rproxy/config/auth/uri-authorization.json
163           subPath: uri-authorization.json
164         - name: {{ include "common.fullname" . }}-rproxy-auth-certs
165           mountPath: /opt/app/rproxy/config/auth/org.onap.aai.p12
166           subPath: org.onap.aai.p12
167         - name: {{ include "common.fullname" . }}-rproxy-security-config
168           mountPath: /opt/app/rproxy/config/security/keyfile
169           subPath: keyfile
170
171         ports:
172         - containerPort: {{ .Values.global.rproxy.port }}
173
174       - name: {{ .Values.global.fproxy.name }}
175         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.fproxy.image }}
176         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
177         env:
178         - name: CONFIG_HOME
179           value: "/opt/app/fproxy/config"
180         - name: KEY_STORE_PASSWORD
181           value: {{ .Values.config.keyStorePassword }}
182         - name: TRUST_STORE_PASSWORD
183           value: {{ .Values.config.trustStorePassword }}
184         - name: spring_profiles_active
185           value: {{ .Values.global.fproxy.activeSpringProfiles }}
186         volumeMounts:
187         - name: {{ include "common.fullname" . }}-fproxy-config
188           mountPath: /opt/app/fproxy/config/fproxy.properties
189           subPath: fproxy.properties
190         - name: {{ include "common.fullname" . }}-fproxy-log-config
191           mountPath: /opt/app/fproxy/config/logback-spring.xml
192           subPath: logback-spring.xml
193         - name: {{ include "common.fullname" . }}-fproxy-auth-certs
194           mountPath: /opt/app/fproxy/config/auth/fproxy_truststore
195           subPath: fproxy_truststore
196         - name: {{ include "common.fullname" . }}-fproxy-auth-certs
197           mountPath: /opt/app/fproxy/config/auth/tomcat_keystore
198           subPath: tomcat_keystore
199         - name: {{ include "common.fullname" . }}-fproxy-auth-certs
200           mountPath: /opt/app/fproxy/config/auth/client-cert.p12
201           subPath: client-cert.p12
202         ports:
203         - containerPort: {{ .Values.global.fproxy.port }}
204     {{ end }}
205
206       volumes:
207       - name: localtime
208         hostPath:
209           path: /etc/localtime
210       - name: {{ include "common.fullname" . }}-service-config
211         configMap:
212           name: {{ include "common.fullname" . }}
213       - name: {{ include "common.fullname" . }}-service-auth-config
214         secret:
215           secretName: {{ include "common.fullname" . }}-keystone
216       - name: {{ include "common.fullname" . }}-search-policy-config
217         secret:
218           secretName: {{ include "common.fullname" . }}-policy
219       - name: filebeat-conf
220         configMap:
221           name: aai-filebeat
222       - name: {{ include "common.fullname" . }}-service-logs
223         emptyDir: {}
224       - name: {{ include "common.fullname" . }}-service-filebeat
225         emptyDir: {}
226       - name: {{ include "common.fullname" . }}-service-log-conf
227         configMap:
228           name: {{ include "common.fullname" . }}-service-log
229     {{ if .Values.global.installSidecarSecurity }}
230       - name: {{ include "common.fullname" . }}-rproxy-config
231         configMap:
232           name: {{ include "common.fullname" . }}-rproxy-config
233       - name: {{ include "common.fullname" . }}-rproxy-log-config
234         configMap:
235           name: {{ include "common.fullname" . }}-rproxy-log-config
236       - name: {{ include "common.fullname" . }}-rproxy-uri-auth-config
237         configMap:
238           name: {{ include "common.fullname" . }}-rproxy-uri-auth-config
239       - name: {{ include "common.fullname" . }}-rproxy-auth-config
240         secret:
241           secretName: {{ include "common.fullname" . }}-rproxy-auth-config
242       - name: {{ include "common.fullname" . }}-rproxy-auth-certs
243         secret:
244           secretName: aai-rproxy-auth-certs
245       - name: {{ include "common.fullname" . }}-rproxy-security-config
246         secret:
247           secretName: aai-rproxy-security-config
248       - name: {{ include "common.fullname" . }}-fproxy-config
249         configMap:
250           name: {{ include "common.fullname" . }}-fproxy-config
251       - name: {{ include "common.fullname" . }}-fproxy-log-config
252         configMap:
253           name: {{ include "common.fullname" . }}-fproxy-log-config
254       - name: {{ include "common.fullname" . }}-fproxy-auth-certs
255         secret:
256           secretName: aai-fproxy-auth-certs
257     {{ end }}
258       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
259       imagePullSecrets:
260       - name: "{{ include "common.namespace" . }}-docker-registry-key"