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