Merge "Fix inconsistent repository references"
[oom.git] / kubernetes / aai / charts / aai-traversal / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ .Release.Name }}
35       name: {{ include "common.name" . }}
36       annotations:
37         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
38         msb.onap.org/service-info: '[
39           {
40               "serviceName": "_aai-generic-query",
41               "version": "v11",
42               "url": "/aai/v11/search/generic-query",
43               "protocol": "REST",
44               "port": "8446",
45               "enable_ssl": true,
46               "lb_policy":"ip_hash",
47               "visualRange": "1",
48               "path": "/aai/v11/search/generic-query"
49           },
50           {
51               "serviceName": "_aai-generic-query",
52               "version": "v12",
53               "url": "/aai/v12/search/generic-query",
54               "protocol": "REST",
55               "port": "8446",
56               "enable_ssl": true,
57               "lb_policy":"ip_hash",
58               "visualRange": "1",
59               "path": "/aai/v12/search/generic-query"
60           },
61           {
62               "serviceName": "_aai-generic-query",
63               "version": "v13",
64               "url": "/aai/v13/search/generic-query",
65               "protocol": "REST",
66               "port": "8446",
67               "enable_ssl": true,
68               "lb_policy":"ip_hash",
69               "visualRange": "1",
70               "path": "/aai/v13/search/generic-query"
71           },
72           {
73               "serviceName": "_aai-nodes-query",
74               "version": "v11",
75               "url": "/aai/v11/search/nodes-query",
76               "protocol": "REST",
77               "port": "8446",
78               "enable_ssl": true,
79               "lb_policy":"ip_hash",
80               "visualRange": "1",
81               "path": "/aai/v11/search/nodes-query"
82           },
83           {
84               "serviceName": "_aai-nodes-query",
85               "version": "v12",
86               "url": "/aai/v12/search/nodes-query",
87               "protocol": "REST",
88               "port": "8446",
89               "enable_ssl": true,
90               "lb_policy":"ip_hash",
91               "visualRange": "1",
92               "path": "/aai/v12/search/nodes-query"
93           },
94           {
95               "serviceName": "_aai-nodes-query",
96               "version": "v13",
97               "url": "/aai/v13/search/nodes-query",
98               "protocol": "REST",
99               "port": "8446",
100               "enable_ssl": true,
101               "lb_policy":"ip_hash",
102               "visualRange": "1",
103               "path": "/aai/v13/search/nodes-query"
104           },
105           {
106               "serviceName": "_aai-query",
107               "version": "v11",
108               "url": "/aai/v11/query",
109               "protocol": "REST",
110               "port": "8446",
111               "enable_ssl": true,
112               "lb_policy":"ip_hash",
113               "visualRange": "1",
114               "path": "/aai/v11/query"
115           },
116           {
117               "serviceName": "_aai-query",
118               "version": "v12",
119               "url": "/aai/v12/query",
120               "protocol": "REST",
121               "port": "8446",
122               "enable_ssl": true,
123               "lb_policy":"ip_hash",
124               "visualRange": "1",
125               "path": "/aai/v12/query"
126           },
127           {
128               "serviceName": "_aai-query",
129               "version": "v13",
130               "url": "/aai/v13/query",
131               "protocol": "REST",
132               "port": "8446",
133               "enable_ssl": true,
134               "lb_policy":"ip_hash",
135               "visualRange": "1",
136               "path": "/aai/v13/query"
137           },
138           {
139               "serviceName": "_aai-named-query",
140               "url": "/aai/search",
141               "protocol": "REST",
142               "port": "8446",
143               "enable_ssl": true,
144               "lb_policy":"ip_hash",
145               "visualRange": "1",
146               "path": "/aai/search"
147           },
148           {
149               "serviceName": "aai-generic-query",
150               "version": "v11",
151               "url": "/aai/v11/search/generic-query",
152               "protocol": "REST",
153               "port": "8446",
154               "enable_ssl": true,
155               "lb_policy":"ip_hash",
156               "visualRange": "1"
157           },
158           {
159               "serviceName": "aai-generic-query",
160               "version": "v12",
161               "url": "/aai/v12/search/generic-query",
162               "protocol": "REST",
163               "port": "8446",
164               "enable_ssl": true,
165               "lb_policy":"ip_hash",
166               "visualRange": "1"
167           },
168           {
169               "serviceName": "aai-generic-query",
170               "version": "v13",
171               "url": "/aai/v13/search/generic-query",
172               "protocol": "REST",
173               "port": "8446",
174               "enable_ssl": true,
175               "lb_policy":"ip_hash",
176               "visualRange": "1"
177           },
178           {
179               "serviceName": "aai-nodes-query",
180               "version": "v11",
181               "url": "/aai/v11/search/nodes-query",
182               "protocol": "REST",
183               "port": "8446",
184               "enable_ssl": true,
185               "lb_policy":"ip_hash",
186               "visualRange": "1"
187           },
188           {
189               "serviceName": "aai-nodes-query",
190               "version": "v12",
191               "url": "/aai/v12/search/nodes-query",
192               "protocol": "REST",
193               "port": "8446",
194               "enable_ssl": true,
195               "lb_policy":"ip_hash",
196               "visualRange": "1"
197           },
198           {
199               "serviceName": "aai-nodes-query",
200               "version": "v13",
201               "url": "/aai/v13/search/nodes-query",
202               "protocol": "REST",
203               "port": "8446",
204               "enable_ssl": true,
205               "lb_policy":"ip_hash",
206               "visualRange": "1"
207           },
208           {
209               "serviceName": "aai-query",
210               "version": "v11",
211               "url": "/aai/v11/query",
212               "protocol": "REST",
213               "port": "8446",
214               "enable_ssl": true,
215               "lb_policy":"ip_hash",
216               "visualRange": "1"
217           },
218           {
219               "serviceName": "aai-query",
220               "version": "v12",
221               "url": "/aai/v12/query",
222               "protocol": "REST",
223               "port": "8446",
224               "enable_ssl": true,
225               "lb_policy":"ip_hash",
226               "visualRange": "1"
227           },
228           {
229               "serviceName": "aai-query",
230               "version": "v13",
231               "url": "/aai/v13/query",
232               "protocol": "REST",
233               "port": "8446",
234               "enable_ssl": true,
235               "lb_policy":"ip_hash",
236               "visualRange": "1"
237           },
238           {
239               "serviceName": "aai-named-query",
240               "url": "/aai/search",
241               "protocol": "REST",
242               "port": "8446",
243               "enable_ssl": true,
244               "lb_policy":"ip_hash",
245               "visualRange": "1"
246           }
247           ]'
248     spec:
249       hostname: aai-traversal
250       initContainers:
251       - command:
252         - /root/ready.py
253         args:
254         - --container-name
255         - aai-cassandra
256         - --container-name
257         - aai-resources
258         env:
259         - name: NAMESPACE
260           valueFrom:
261             fieldRef:
262               apiVersion: v1
263               fieldPath: metadata.namespace
264         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
265         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
266         name: {{ include "common.name" . }}-readiness
267       containers:
268       - name: {{ include "common.name" . }}
269         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
270         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
271         env:
272         - name: DISABLE_UPDATE_QUERY
273           value: {{ .Values.config.disableUpdateQuery | quote }}
274         - name: LOCAL_USER_ID
275           value: {{ .Values.config.userId | quote }}
276         - name: LOCAL_GROUP_ID
277           value: {{ .Values.config.groupId | quote }}
278         volumeMounts:
279         - mountPath: /etc/localtime
280           name: localtime
281           readOnly: true
282         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
283           name: {{ include "common.fullname" . }}-db-real-conf
284           subPath: janusgraph-realtime.properties
285         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
286           name: {{ include "common.fullname" . }}-db-cached-conf
287           subPath: janusgraph-cached.properties
288         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
289           name: {{ include "common.fullname" . }}-aaiconfig-conf
290           subPath: aaiconfig.properties
291         - mountPath: /opt/aai/logroot/AAI-GQ
292           name: {{ include "common.fullname" . }}-logs
293         - mountPath: /opt/app/aai-traversal/resources/logback.xml
294           name: {{ include "common.fullname" . }}-log-conf
295           subPath: logback.xml
296         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
297           name: {{ include "common.fullname" . }}-localhost-access-log-conf
298           subPath: localhost-access-logback.xml
299         - mountPath: /opt/app/aai-traversal/resources/application.properties
300           name: {{ include "common.fullname" . }}-springapp-conf
301           subPath: application.properties
302         - mountPath: /opt/app/aai-traversal/resources/etc/auth/aai_keystore
303           name: {{ include "common.fullname" . }}-auth-sec
304           subPath: aai_keystore
305         ports:
306         - containerPort: {{ .Values.service.internalPort }}
307         - containerPort: {{ .Values.service.internalPort2 }}
308         # disable liveness probe when breakpoints set in debugger
309         # so K8s doesn't restart unresponsive container
310         {{ if .Values.liveness.enabled }}
311         livenessProbe:
312           tcpSocket:
313             port: {{ .Values.service.internalPort }}
314           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
315           periodSeconds: {{ .Values.liveness.periodSeconds }}
316         {{ end }}
317         readinessProbe:
318           tcpSocket:
319             port: {{ .Values.service.internalPort }}
320           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
321           periodSeconds: {{ .Values.readiness.periodSeconds }}
322         resources:
323 {{ toYaml .Values.resources | indent 10 }}
324       {{- if .Values.nodeSelector }}
325       nodeSelector:
326 {{ toYaml .Values.nodeSelector | indent 8 }}
327       {{- end -}}
328       {{- if .Values.affinity }}
329       affinity:
330 {{ toYaml .Values.affinity | indent 8 }}
331       {{- end }}
332
333       # side car containers
334       - name: filebeat-onap
335         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
336         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
337         volumeMounts:
338         - mountPath: /usr/share/filebeat/filebeat.yml
339           subPath: filebeat.yml
340           name: filebeat-conf
341         - mountPath: /var/log/onap
342           name: {{ include "common.fullname" . }}-logs
343         - mountPath: /usr/share/filebeat/data
344           name: {{ include "common.fullname" . }}-filebeat
345       volumes:
346       - name: localtime
347         hostPath:
348           path: /etc/localtime
349       - name: filebeat-conf
350         configMap:
351           name: aai-filebeat
352       - name: {{ include "common.fullname" . }}-logs
353         emptyDir: {}
354       - name: {{ include "common.fullname" . }}-filebeat
355         emptyDir: {}
356       - name: {{ include "common.fullname" . }}-log-conf
357         configMap:
358          name: {{ include "common.fullname" . }}-log
359       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
360         configMap:
361          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
362       - name: {{ include "common.fullname" . }}-db-real-conf
363         configMap:
364          name: {{ include "common.fullname" . }}-db-real-configmap
365       - name: {{ include "common.fullname" . }}-db-cached-conf
366         configMap:
367          name: {{ include "common.fullname" . }}-db-cached-configmap
368       - name: {{ include "common.fullname" . }}-aaiconfig-conf
369         configMap:
370          name: {{ include "common.fullname" . }}-aaiconfig-configmap
371       - name: {{ include "common.fullname" . }}-springapp-conf
372         configMap:
373          name: {{ include "common.fullname" . }}-springapp-configmap
374       - name: {{ include "common.fullname" . }}-realm-conf
375         configMap:
376          name: {{ include "common.fullname" . }}-realm-configmap
377       - name: {{ include "common.fullname" . }}-auth-sec
378         secret:
379          secretName: aai-auth-secret
380       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
381       imagePullSecrets:
382       - name: "{{ include "common.namespace" . }}-docker-registry-key"