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