Merge "clamphealth check"
[oom.git] / kubernetes / aai / charts / aai-resources / 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-cloudInfrastructure",
41               "version": "v11",
42               "url": "/aai/v11/cloud-infrastructure",
43               "protocol": "REST",
44               "port": "8447",
45               "enable_ssl": true,
46               "lb_policy":"ip_hash",
47               "visualRange": "1",
48               "path": "/aai/v11/cloud-infrastructure"
49           },
50           {
51               "serviceName": "_aai-cloudInfrastructure",
52               "version": "v12",
53               "url": "/aai/v12/cloud-infrastructure",
54               "protocol": "REST",
55               "port": "8447",
56               "enable_ssl": true,
57               "lb_policy":"ip_hash",
58               "visualRange": "1",
59               "path": "/aai/v12/cloud-infrastructure"
60           },
61           {
62               "serviceName": "_aai-cloudInfrastructure",
63               "version": "v13",
64               "url": "/aai/v13/cloud-infrastructure",
65               "protocol": "REST",
66               "port": "8447",
67               "enable_ssl": true,
68               "lb_policy":"ip_hash",
69               "visualRange": "1",
70               "path": "/aai/v13/cloud-infrastructure"
71           },
72           {
73               "serviceName": "_aai-business",
74               "version": "v11",
75               "url": "/aai/v11/business",
76               "protocol": "REST",
77               "port": "8447",
78               "enable_ssl": true,
79               "lb_policy":"ip_hash",
80               "visualRange": "1",
81               "path": "/aai/v11/business"
82           },
83           {
84               "serviceName": "_aai-business",
85               "version": "v12",
86               "url": "/aai/v12/business",
87               "protocol": "REST",
88               "port": "8447",
89               "enable_ssl": true,
90               "lb_policy":"ip_hash",
91               "visualRange": "1",
92               "path": "/aai/v12/business"
93           },
94           {
95               "serviceName": "_aai-business",
96               "version": "v13",
97               "url": "/aai/v13/business",
98               "protocol": "REST",
99               "port": "8447",
100               "enable_ssl": true,
101               "lb_policy":"ip_hash",
102               "visualRange": "1",
103               "path": "/aai/v13/business"
104           },
105           {
106               "serviceName": "_aai-actions",
107               "version": "v11",
108               "url": "/aai/v11/actions",
109               "protocol": "REST",
110               "port": "8447",
111               "enable_ssl": true,
112               "lb_policy":"ip_hash",
113               "visualRange": "1",
114               "path": "/aai/v11/actions"
115           },
116           {
117               "serviceName": "_aai-actions",
118               "version": "v12",
119               "url": "/aai/v12/actions",
120               "protocol": "REST",
121               "port": "8447",
122               "enable_ssl": true,
123               "lb_policy":"ip_hash",
124               "visualRange": "1",
125               "path": "/aai/v12/actions"
126           },
127           {
128               "serviceName": "_aai-actions",
129               "version": "v13",
130               "url": "/aai/v13/actions",
131               "protocol": "REST",
132               "port": "8447",
133               "enable_ssl": true,
134               "lb_policy":"ip_hash",
135               "visualRange": "1",
136               "path": "/aai/v13/actions"
137           },
138           {
139               "serviceName": "_aai-service-design-and-creation",
140               "version": "v11",
141               "url": "/aai/v11/service-design-and-creation",
142               "protocol": "REST",
143               "port": "8447",
144               "enable_ssl": true,
145               "lb_policy":"ip_hash",
146               "visualRange": "1",
147               "path": "/aai/v11/service-design-and-creation"
148           },
149           {
150               "serviceName": "_aai-service-design-and-creation",
151               "version": "v12",
152               "url": "/aai/v12/service-design-and-creation",
153               "protocol": "REST",
154               "port": "8447",
155               "enable_ssl": true,
156               "lb_policy":"ip_hash",
157               "visualRange": "1",
158               "path": "/aai/v12/service-design-and-creation"
159           },
160           {
161               "serviceName": "_aai-service-design-and-creation",
162               "version": "v13",
163               "url": "/aai/v13/service-design-and-creation",
164               "protocol": "REST",
165               "port": "8447",
166               "enable_ssl": true,
167               "lb_policy":"ip_hash",
168               "visualRange": "1",
169               "path": "/aai/v13/service-design-and-creation"
170           },
171           {
172               "serviceName": "_aai-network",
173               "version": "v11",
174               "url": "/aai/v11/network",
175               "protocol": "REST",
176               "port": "8447",
177               "enable_ssl": true,
178               "lb_policy":"ip_hash",
179               "visualRange": "1",
180               "path": "/aai/v11/network"
181           },
182           {
183               "serviceName": "_aai-network",
184               "version": "v12",
185               "url": "/aai/v12/network",
186               "protocol": "REST",
187               "port": "8447",
188               "enable_ssl": true,
189               "lb_policy":"ip_hash",
190               "visualRange": "1",
191               "path": "/aai/v12/network"
192           },
193           {
194               "serviceName": "_aai-network",
195               "version": "v13",
196               "url": "/aai/v13/network",
197               "protocol": "REST",
198               "port": "8447",
199               "enable_ssl": true,
200               "lb_policy":"ip_hash",
201               "visualRange": "1",
202               "path": "/aai/v13/network"
203           },
204           {
205               "serviceName": "_aai-externalSystem",
206               "version": "v11",
207               "url": "/aai/v11/external-system",
208               "protocol": "REST",
209               "port": "8447",
210               "enable_ssl": true,
211               "lb_policy":"ip_hash",
212               "visualRange": "1",
213               "path": "/aai/v11/external-system"
214           },      
215           {
216               "serviceName": "_aai-externalSystem",
217               "version": "v12",
218               "url": "/aai/v12/external-system",
219               "protocol": "REST",
220               "port": "8447",
221               "enable_ssl": true,
222               "lb_policy":"ip_hash",
223               "visualRange": "1",
224               "path": "/aai/v12/external-system"
225           },      
226           {
227               "serviceName": "_aai-externalSystem",
228               "version": "v13",
229               "url": "/aai/v13/external-system",
230               "protocol": "REST",
231               "port": "8447",
232               "enable_ssl": true,
233               "lb_policy":"ip_hash",
234               "visualRange": "1",
235               "path": "/aai/v13/external-system"
236           },
237           {
238               "serviceName": "aai-cloudInfrastructure",
239               "version": "v11",
240               "url": "/aai/v11/cloud-infrastructure",
241               "protocol": "REST",
242               "port": "8447",
243               "enable_ssl": true,
244               "lb_policy":"ip_hash",
245               "visualRange": "1"
246           },
247           {
248               "serviceName": "aai-cloudInfrastructure",
249               "version": "v12",
250               "url": "/aai/v12/cloud-infrastructure",
251               "protocol": "REST",
252               "port": "8447",
253               "enable_ssl": true,
254               "lb_policy":"ip_hash",
255               "visualRange": "1"
256           },
257           {
258               "serviceName": "aai-cloudInfrastructure",
259               "version": "v13",
260               "url": "/aai/v13/cloud-infrastructure",
261               "protocol": "REST",
262               "port": "8447",
263               "enable_ssl": true,
264               "lb_policy":"ip_hash",
265               "visualRange": "1"
266           },
267           {
268               "serviceName": "aai-business",
269               "version": "v11",
270               "url": "/aai/v11/business",
271               "protocol": "REST",
272               "port": "8447",
273               "enable_ssl": true,
274               "lb_policy":"ip_hash",
275               "visualRange": "1"
276           },
277           {
278               "serviceName": "aai-business",
279               "version": "v12",
280               "url": "/aai/v12/business",
281               "protocol": "REST",
282               "port": "8447",
283               "enable_ssl": true,
284               "lb_policy":"ip_hash",
285               "visualRange": "1"
286           },
287           {
288               "serviceName": "aai-business",
289               "version": "v13",
290               "url": "/aai/v13/business",
291               "protocol": "REST",
292               "port": "8447",
293               "enable_ssl": true,
294               "lb_policy":"ip_hash",
295               "visualRange": "1"
296           },
297           {
298               "serviceName": "aai-actions",
299               "version": "v11",
300               "url": "/aai/v11/actions",
301               "protocol": "REST",
302               "port": "8447",
303               "enable_ssl": true,
304               "lb_policy":"ip_hash",
305               "visualRange": "1"
306           },
307           {
308               "serviceName": "aai-actions",
309               "version": "v12",
310               "url": "/aai/v12/actions",
311               "protocol": "REST",
312               "port": "8447",
313               "enable_ssl": true,
314               "lb_policy":"ip_hash",
315               "visualRange": "1"
316           },
317           {
318               "serviceName": "aai-actions",
319               "version": "v13",
320               "url": "/aai/v13/actions",
321               "protocol": "REST",
322               "port": "8447",
323               "enable_ssl": true,
324               "lb_policy":"ip_hash",
325               "visualRange": "1"
326           },
327           {
328               "serviceName": "aai-service-design-and-creation",
329               "version": "v11",
330               "url": "/aai/v11/service-design-and-creation",
331               "protocol": "REST",
332               "port": "8447",
333               "enable_ssl": true,
334               "lb_policy":"ip_hash",
335               "visualRange": "1"
336           },
337           {
338               "serviceName": "aai-service-design-and-creation",
339               "version": "v12",
340               "url": "/aai/v12/service-design-and-creation",
341               "protocol": "REST",
342               "port": "8447",
343               "enable_ssl": true,
344               "lb_policy":"ip_hash",
345               "visualRange": "1"
346           },
347           {
348               "serviceName": "aai-service-design-and-creation",
349               "version": "v13",
350               "url": "/aai/v13/service-design-and-creation",
351               "protocol": "REST",
352               "port": "8447",
353               "enable_ssl": true,
354               "lb_policy":"ip_hash",
355               "visualRange": "1"
356           },
357           {
358               "serviceName": "aai-network",
359               "version": "v11",
360               "url": "/aai/v11/network",
361               "protocol": "REST",
362               "port": "8447",
363               "enable_ssl": true,
364               "lb_policy":"ip_hash",
365               "visualRange": "1"
366           },
367           {
368               "serviceName": "aai-network",
369               "version": "v12",
370               "url": "/aai/v12/network",
371               "protocol": "REST",
372               "port": "8447",
373               "enable_ssl": true,
374               "lb_policy":"ip_hash",
375               "visualRange": "1"
376           },
377           {
378               "serviceName": "aai-network",
379               "version": "v13",
380               "url": "/aai/v13/network",
381               "protocol": "REST",
382               "port": "8447",
383               "enable_ssl": true,
384               "lb_policy":"ip_hash",
385               "visualRange": "1"
386           },
387           {
388               "serviceName": "aai-externalSystem",
389               "version": "v11",
390               "url": "/aai/v11/external-system",
391               "protocol": "REST",
392               "port": "8447",
393               "enable_ssl": true,
394               "lb_policy":"ip_hash",
395               "visualRange": "1"
396           },      
397           {
398               "serviceName": "aai-externalSystem",
399               "version": "v12",
400               "url": "/aai/v12/external-system",
401               "protocol": "REST",
402               "port": "8447",
403               "enable_ssl": true,
404               "lb_policy":"ip_hash",
405               "visualRange": "1"
406           },      
407           {
408               "serviceName": "aai-externalSystem",
409               "version": "v13",
410               "url": "/aai/v13/external-system",
411               "protocol": "REST",
412               "port": "8447",
413               "enable_ssl": true,
414               "lb_policy":"ip_hash",
415               "visualRange": "1"
416           }
417           ]'
418     spec:
419       hostname: aai-resources
420       initContainers:
421       - command:
422         - /root/ready.py
423         args:
424         - --container-name
425         - aai-cassandra
426         env:
427         - name: NAMESPACE
428           valueFrom:
429             fieldRef:
430               apiVersion: v1
431               fieldPath: metadata.namespace
432         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
433         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
434         name: {{ include "common.name" . }}-readiness
435       containers:
436       - name: {{ include "common.name" . }}
437         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
438         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
439         env:
440         - name: LOCAL_USER_ID
441           value: {{ .Values.config.userId | quote }}
442         - name: LOCAL_GROUP_ID
443           value: {{ .Values.config.groupId | quote }}
444         volumeMounts:
445         - mountPath: /etc/localtime
446           name: localtime
447           readOnly: true
448         - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties
449           name: {{ include "common.fullname" . }}-db-real-conf
450           subPath: janusgraph-realtime.properties
451         - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties
452           name: {{ include "common.fullname" . }}-db-cached-conf
453           subPath: janusgraph-cached.properties
454         - mountPath: /opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties
455           name: {{ include "common.fullname" . }}-aaiconfig-conf
456           subPath: aaiconfig.properties
457         - mountPath: /opt/aai/logroot/AAI-RES
458           name: {{ include "common.fullname" . }}-logs
459         - mountPath: /opt/app/aai-resources/resources/logback.xml
460           name: {{ include "common.fullname" . }}-log-conf
461           subPath: logback.xml
462         - mountPath: /opt/app/aai-resources/resources/localhost-access-logback.xml
463           name: {{ include "common.fullname" . }}-localhost-access-log-conf
464           subPath: localhost-access-logback.xml
465         - mountPath: /opt/app/aai-resources/resources/application.properties
466           name: {{ include "common.fullname" . }}-springapp-conf
467           subPath: application.properties
468         - mountPath: /opt/app/aai-resources/resources/etc/auth/aai_keystore
469           name: {{ include "common.fullname" . }}-auth-sec
470           subPath: aai_keystore
471         ports:
472         - containerPort: {{ .Values.service.internalPort }}
473         - containerPort: {{ .Values.service.internalPort2 }}
474         # disable liveness probe when breakpoints set in debugger
475         # so K8s doesn't restart unresponsive container
476         {{ if .Values.liveness.enabled }}
477         livenessProbe:
478           tcpSocket:
479             port: {{ .Values.service.internalPort }}
480           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
481           periodSeconds: {{ .Values.liveness.periodSeconds }}
482         {{ end }}
483         readinessProbe:
484           tcpSocket:
485             port: {{ .Values.service.internalPort }}
486           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
487           periodSeconds: {{ .Values.readiness.periodSeconds }}
488         resources:
489 {{ toYaml .Values.resources | indent 10 }}
490       {{- if .Values.nodeSelector }}
491       nodeSelector:
492 {{ toYaml .Values.nodeSelector | indent 8 }}
493       {{- end -}}
494       {{- if .Values.affinity }}
495       affinity:
496 {{ toYaml .Values.affinity | indent 8 }}
497       {{- end }}
498
499       # side car containers
500       - name: filebeat-onap
501         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
502         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
503         volumeMounts:
504         - mountPath: /usr/share/filebeat/filebeat.yml
505           subPath: filebeat.yml
506           name: filebeat-conf
507         - mountPath: /var/log/onap
508           name: {{ include "common.fullname" . }}-logs
509         - mountPath: /usr/share/filebeat/data
510           name: {{ include "common.fullname" . }}-filebeat
511
512       volumes:
513       - name: localtime
514         hostPath:
515           path: /etc/localtime
516       - name: filebeat-conf
517         configMap:
518           name: aai-filebeat
519       - name: {{ include "common.fullname" . }}-logs
520         emptyDir: {}
521       - name: {{ include "common.fullname" . }}-filebeat
522         emptyDir: {}
523       - name: {{ include "common.fullname" . }}-log-conf
524         configMap:
525          name: {{ include "common.fullname" . }}-log
526       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
527         configMap:
528          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
529       - name: {{ include "common.fullname" . }}-db-real-conf
530         configMap:
531          name: {{ include "common.fullname" . }}-db-real-configmap
532       - name: {{ include "common.fullname" . }}-db-cached-conf
533         configMap:
534          name: {{ include "common.fullname" . }}-db-cached-configmap
535       - name: {{ include "common.fullname" . }}-aaiconfig-conf
536         configMap:
537          name: {{ include "common.fullname" . }}-aaiconfig-configmap
538       - name: {{ include "common.fullname" . }}-springapp-conf
539         configMap:
540          name: {{ include "common.fullname" . }}-springapp-configmap
541       - name: {{ include "common.fullname" . }}-realm-conf
542         configMap:
543          name: {{ include "common.fullname" . }}-realm-configmap
544       - name: {{ include "common.fullname" . }}-auth-sec
545         secret:
546          secretName: aai-auth-secret
547       restartPolicy: {{ .Values.restartPolicy }}
548       imagePullSecrets:
549       - name: "{{ include "common.namespace" . }}-docker-registry-key"