Merge "global image pull issue Issue-ID: OOM-1563"
[oom.git] / kubernetes / aai / charts / aai-traversal / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 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: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36       name: {{ include "common.name" . }}
37       annotations:
38         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
39         msb.onap.org/service-info: '[
40           {
41               "serviceName": "_aai-generic-query",
42               "version": "v11",
43               "url": "/aai/v11/search/generic-query",
44               "protocol": "REST",
45               "port": "8446",
46               "enable_ssl": true,
47               "lb_policy":"ip_hash",
48               "visualRange": "1",
49               "path": "/aai/v11/search/generic-query"
50           },
51           {
52               "serviceName": "_aai-generic-query",
53               "version": "v12",
54               "url": "/aai/v12/search/generic-query",
55               "protocol": "REST",
56               "port": "8446",
57               "enable_ssl": true,
58               "lb_policy":"ip_hash",
59               "visualRange": "1",
60               "path": "/aai/v12/search/generic-query"
61           },
62           {
63               "serviceName": "_aai-generic-query",
64               "version": "v13",
65               "url": "/aai/v13/search/generic-query",
66               "protocol": "REST",
67               "port": "8446",
68               "enable_ssl": true,
69               "lb_policy":"ip_hash",
70               "visualRange": "1",
71               "path": "/aai/v13/search/generic-query"
72           },
73           {
74               "serviceName": "_aai-generic-query",
75               "version": "v14",
76               "url": "/aai/v14/search/generic-query",
77               "protocol": "REST",
78               "port": "8446",
79               "enable_ssl": true,
80               "lb_policy":"ip_hash",
81               "visualRange": "1",
82               "path": "/aai/v14/search/generic-query"
83           },
84           {
85               "serviceName": "_aai-nodes-query",
86               "version": "v11",
87               "url": "/aai/v11/search/nodes-query",
88               "protocol": "REST",
89               "port": "8446",
90               "enable_ssl": true,
91               "lb_policy":"ip_hash",
92               "visualRange": "1",
93               "path": "/aai/v11/search/nodes-query"
94           },
95           {
96               "serviceName": "_aai-nodes-query",
97               "version": "v12",
98               "url": "/aai/v12/search/nodes-query",
99               "protocol": "REST",
100               "port": "8446",
101               "enable_ssl": true,
102               "lb_policy":"ip_hash",
103               "visualRange": "1",
104               "path": "/aai/v12/search/nodes-query"
105           },
106           {
107               "serviceName": "_aai-nodes-query",
108               "version": "v13",
109               "url": "/aai/v13/search/nodes-query",
110               "protocol": "REST",
111               "port": "8446",
112               "enable_ssl": true,
113               "lb_policy":"ip_hash",
114               "visualRange": "1",
115               "path": "/aai/v13/search/nodes-query"
116           },
117           {
118               "serviceName": "_aai-nodes-query",
119               "version": "v14",
120               "url": "/aai/v14/search/nodes-query",
121               "protocol": "REST",
122               "port": "8446",
123               "enable_ssl": true,
124               "lb_policy":"ip_hash",
125               "visualRange": "1",
126               "path": "/aai/v14/search/nodes-query"
127           },
128           {
129               "serviceName": "_aai-query",
130               "version": "v11",
131               "url": "/aai/v11/query",
132               "protocol": "REST",
133               "port": "8446",
134               "enable_ssl": true,
135               "lb_policy":"ip_hash",
136               "visualRange": "1",
137               "path": "/aai/v11/query"
138           },
139           {
140               "serviceName": "_aai-query",
141               "version": "v12",
142               "url": "/aai/v12/query",
143               "protocol": "REST",
144               "port": "8446",
145               "enable_ssl": true,
146               "lb_policy":"ip_hash",
147               "visualRange": "1",
148               "path": "/aai/v12/query"
149           },
150           {
151               "serviceName": "_aai-query",
152               "version": "v13",
153               "url": "/aai/v13/query",
154               "protocol": "REST",
155               "port": "8446",
156               "enable_ssl": true,
157               "lb_policy":"ip_hash",
158               "visualRange": "1",
159               "path": "/aai/v13/query"
160           },
161           {
162               "serviceName": "_aai-query",
163               "version": "v14",
164               "url": "/aai/v14/query",
165               "protocol": "REST",
166               "port": "8446",
167               "enable_ssl": true,
168               "lb_policy":"ip_hash",
169               "visualRange": "1",
170               "path": "/aai/v14/query"
171           },
172           {
173               "serviceName": "_aai-named-query",
174               "url": "/aai/search",
175               "protocol": "REST",
176               "port": "8446",
177               "enable_ssl": true,
178               "lb_policy":"ip_hash",
179               "visualRange": "1",
180               "path": "/aai/search"
181           },
182           {
183               "serviceName": "aai-generic-query",
184               "version": "v11",
185               "url": "/aai/v11/search/generic-query",
186               "protocol": "REST",
187               "port": "8446",
188               "enable_ssl": true,
189               "lb_policy":"ip_hash",
190               "visualRange": "1"
191           },
192           {
193               "serviceName": "aai-generic-query",
194               "version": "v12",
195               "url": "/aai/v12/search/generic-query",
196               "protocol": "REST",
197               "port": "8446",
198               "enable_ssl": true,
199               "lb_policy":"ip_hash",
200               "visualRange": "1"
201           },
202           {
203               "serviceName": "aai-generic-query",
204               "version": "v13",
205               "url": "/aai/v13/search/generic-query",
206               "protocol": "REST",
207               "port": "8446",
208               "enable_ssl": true,
209               "lb_policy":"ip_hash",
210               "visualRange": "1"
211           },
212           {
213               "serviceName": "aai-generic-query",
214               "version": "v14",
215               "url": "/aai/v14/search/generic-query",
216               "protocol": "REST",
217               "port": "8446",
218               "enable_ssl": true,
219               "lb_policy":"ip_hash",
220               "visualRange": "1"
221           },
222           {
223               "serviceName": "aai-nodes-query",
224               "version": "v11",
225               "url": "/aai/v11/search/nodes-query",
226               "protocol": "REST",
227               "port": "8446",
228               "enable_ssl": true,
229               "lb_policy":"ip_hash",
230               "visualRange": "1"
231           },
232           {
233               "serviceName": "aai-nodes-query",
234               "version": "v12",
235               "url": "/aai/v12/search/nodes-query",
236               "protocol": "REST",
237               "port": "8446",
238               "enable_ssl": true,
239               "lb_policy":"ip_hash",
240               "visualRange": "1"
241           },
242           {
243               "serviceName": "aai-nodes-query",
244               "version": "v13",
245               "url": "/aai/v13/search/nodes-query",
246               "protocol": "REST",
247               "port": "8446",
248               "enable_ssl": true,
249               "lb_policy":"ip_hash",
250               "visualRange": "1"
251           },
252           {
253               "serviceName": "aai-nodes-query",
254               "version": "v14",
255               "url": "/aai/v14/search/nodes-query",
256               "protocol": "REST",
257               "port": "8446",
258               "enable_ssl": true,
259               "lb_policy":"ip_hash",
260               "visualRange": "1"
261           },
262           {
263               "serviceName": "aai-query",
264               "version": "v11",
265               "url": "/aai/v11/query",
266               "protocol": "REST",
267               "port": "8446",
268               "enable_ssl": true,
269               "lb_policy":"ip_hash",
270               "visualRange": "1"
271           },
272           {
273               "serviceName": "aai-query",
274               "version": "v12",
275               "url": "/aai/v12/query",
276               "protocol": "REST",
277               "port": "8446",
278               "enable_ssl": true,
279               "lb_policy":"ip_hash",
280               "visualRange": "1"
281           },
282           {
283               "serviceName": "aai-query",
284               "version": "v13",
285               "url": "/aai/v13/query",
286               "protocol": "REST",
287               "port": "8446",
288               "enable_ssl": true,
289               "lb_policy":"ip_hash",
290               "visualRange": "1"
291           },
292           {
293               "serviceName": "aai-query",
294               "version": "v14",
295               "url": "/aai/v14/query",
296               "protocol": "REST",
297               "port": "8446",
298               "enable_ssl": true,
299               "lb_policy":"ip_hash",
300               "visualRange": "1"
301           },
302           {
303               "serviceName": "aai-named-query",
304               "url": "/aai/search",
305               "protocol": "REST",
306               "port": "8446",
307               "enable_ssl": true,
308               "lb_policy":"ip_hash",
309               "visualRange": "1"
310           }
311           ]'
312     spec:
313       hostname: aai-traversal
314     {{ if .Values.global.initContainers.enabled }}
315       initContainers:
316       - command:
317       {{  if .Values.global.jobs.createSchema.enabled  }}
318         - /root/job_complete.py
319         args:
320         - --job-name
321         - {{ .Release.Name }}-aai-graphadmin-create-db-schema
322       {{  else }}
323         - /root/ready.py
324         args:
325         - --container-name
326         - aai-cassandra
327       {{  end  }}
328         env:
329         - name: NAMESPACE
330           valueFrom:
331             fieldRef:
332               apiVersion: v1
333               fieldPath: metadata.namespace
334         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
335         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
336         name: {{ include "common.name" . }}-readiness
337     {{ end }}
338       containers:
339       - name: {{ include "common.name" . }}
340         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
341         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
342         env:
343         - name: DISABLE_UPDATE_QUERY
344           value: {{ .Values.config.disableUpdateQuery | quote }}
345         - name: LOCAL_USER_ID
346           value: {{ .Values.global.config.userId | quote }}
347         - name: LOCAL_GROUP_ID
348           value: {{ .Values.global.config.groupId | quote }}
349         volumeMounts:
350         - mountPath: /etc/localtime
351           name: localtime
352           readOnly: true
353         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
354           name: {{ include "common.fullname" . }}-db-real-conf
355           subPath: janusgraph-realtime.properties
356         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
357           name: {{ include "common.fullname" . }}-db-cached-conf
358           subPath: janusgraph-cached.properties
359         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
360           name: {{ include "common.fullname" . }}-aaiconfig-conf
361           subPath: aaiconfig.properties
362         - mountPath: /opt/aai/logroot/AAI-GQ
363           name: {{ include "common.fullname" . }}-logs
364         - mountPath: /opt/app/aai-traversal/resources/logback.xml
365           name: {{ include "common.fullname" . }}-log-conf
366           subPath: logback.xml
367         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
368           name: {{ include "common.fullname" . }}-localhost-access-log-conf
369           subPath: localhost-access-logback.xml
370         - mountPath: /opt/app/aai-traversal/resources/etc/auth/realm.properties
371           name: {{ include "common.fullname" . }}-realm-conf
372           subPath: realm.properties
373         - mountPath: /opt/app/aai-traversal/resources/aaf/org.onap.aai.keyfile
374           name: {{ include "common.fullname" . }}-aaf-certs
375           subPath: org.onap.aai.keyfile
376         - mountPath: /opt/app/aai-traversal/resources/aaf/bath_config.csv
377           name: {{ include "common.fullname" . }}-aaf-certs
378           subPath: bath_config.csv
379         - mountPath: /opt/app/aai-traversal/resources/aaf/org.onap.aai.props
380           name: {{ include "common.fullname" . }}-aaf-properties
381           subPath: org.onap.aai.props
382         - mountPath: /opt/app/aai-traversal/resources/aaf/org.osaaf.location.props
383           name: {{ include "common.fullname" . }}-aaf-properties
384           subPath: org.osaaf.location.props
385         - mountPath: /opt/app/aai-traversal/resources/aaf/permissions.properties
386           name: {{ include "common.fullname" . }}-aaf-properties
387           subPath: permissions.properties
388         - mountPath: /opt/app/aai-traversal/resources/cadi.properties
389           name: {{ include "common.fullname" . }}-aaf-properties
390           subPath: cadi.properties
391         - mountPath: /opt/app/aai-traversal/resources/aaf/org.onap.aai.p12
392           name: {{ include "common.fullname" . }}-aaf-certs
393           subPath: org.onap.aai.p12
394         - mountPath: /opt/app/aai-traversal/resources/aaf/truststoreONAPall.jks
395           name: aai-common-aai-auth-mount
396           subPath: truststoreONAPall.jks
397         - mountPath: /opt/app/aai-traversal/resources/application.properties
398           name: {{ include "common.fullname" . }}-springapp-conf
399           subPath: application.properties
400           {{ $global := . }}
401           {{ range $job := .Values.global.config.auth.files }}
402         - mountPath: /opt/app/aai-traversal/resources/etc/auth/{{ . }}
403           name: {{ include "common.fullname" $global }}-auth-truststore-sec
404           subPath: {{ . }}
405           {{ end }}
406         ports:
407         - containerPort: {{ .Values.service.internalPort }}
408         - containerPort: {{ .Values.service.internalPort2 }}
409         # disable liveness probe when breakpoints set in debugger
410         # so K8s doesn't restart unresponsive container
411         {{ if .Values.liveness.enabled }}
412         livenessProbe:
413           tcpSocket:
414             port: {{ .Values.service.internalPort }}
415           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
416           periodSeconds: {{ .Values.liveness.periodSeconds }}
417         {{ end }}
418         readinessProbe:
419           tcpSocket:
420             port: {{ .Values.service.internalPort }}
421           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
422           periodSeconds: {{ .Values.readiness.periodSeconds }}
423         resources:
424 {{ include "common.resources" . | indent 12 }}
425       {{- if .Values.nodeSelector }}
426       nodeSelector:
427 {{ toYaml .Values.nodeSelector | indent 8 }}
428       {{- end -}}
429       {{- if .Values.affinity }}
430       affinity:
431 {{ toYaml .Values.affinity | indent 8 }}
432       {{- end }}
433
434       # side car containers
435       - name: filebeat-onap
436         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
437         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
438         volumeMounts:
439         - mountPath: /usr/share/filebeat/filebeat.yml
440           subPath: filebeat.yml
441           name: filebeat-conf
442         - mountPath: /var/log/onap
443           name: {{ include "common.fullname" . }}-logs
444         - mountPath: /usr/share/filebeat/data
445           name: {{ include "common.fullname" . }}-filebeat
446       volumes:
447       - name: localtime
448         hostPath:
449           path: /etc/localtime
450       - name: filebeat-conf
451         configMap:
452           name: aai-filebeat
453       - name: {{ include "common.fullname" . }}-logs
454         emptyDir: {}
455       - name: {{ include "common.fullname" . }}-filebeat
456         emptyDir: {}
457       - name: {{ include "common.fullname" . }}-log-conf
458         configMap:
459          name: {{ include "common.fullname" . }}-log
460       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
461         configMap:
462          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
463       - name: {{ include "common.fullname" . }}-db-real-conf
464         configMap:
465          name: {{ include "common.fullname" . }}-db-real-configmap
466       - name: {{ include "common.fullname" . }}-db-cached-conf
467         configMap:
468          name: {{ include "common.fullname" . }}-db-cached-configmap
469       - name: {{ include "common.fullname" . }}-aaiconfig-conf
470         configMap:
471          name: {{ include "common.fullname" . }}-aaiconfig-configmap
472       - name: {{ include "common.fullname" . }}-aaf-properties
473         configMap:
474          name: {{ include "common.fullname" . }}-aaf-props
475       - name: {{ include "common.fullname" . }}-aaf-certs
476         secret:
477          secretName: {{ include "common.fullname" . }}-aaf-keys
478       - name: aai-common-aai-auth-mount
479         secret:
480           secretName: aai-common-aai-auth
481       - name: {{ include "common.fullname" . }}-springapp-conf
482         configMap:
483          name: {{ include "common.fullname" . }}-springapp-configmap
484       - name: {{ include "common.fullname" . }}-realm-conf
485         configMap:
486          name: {{ include "common.fullname" . }}-realm-configmap
487       - name: {{ include "common.fullname" . }}-auth-truststore-sec
488         secret:
489          secretName: aai-auth-truststore-secret
490          items:
491           {{ range $job := .Values.global.config.auth.files }}
492            - key: {{ . }}
493              path: {{ . }}
494           {{ end }}
495       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
496       imagePullSecrets:
497       - name: "{{ include "common.namespace" . }}-docker-registry-key"