Merge "Added MSB and Chart definitions sections."
[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         msb.onap.org/service-info: '[
38           {
39               "serviceName": "_aai-generic-query",
40               "version": "v11",
41               "url": "/aai/v11/search/generic-query",
42               "protocol": "REST",
43               "port": "8446",
44               "enable_ssl": true,
45               "lb_policy":"ip_hash",
46               "visualRange": "1",
47               "path": "/aai/v11/search/generic-query"
48           },
49           {
50               "serviceName": "_aai-generic-query",
51               "version": "v12",
52               "url": "/aai/v12/search/generic-query",
53               "protocol": "REST",
54               "port": "8446",
55               "enable_ssl": true,
56               "lb_policy":"ip_hash",
57               "visualRange": "1",
58               "path": "/aai/v12/search/generic-query"
59           },
60           {
61               "serviceName": "_aai-generic-query",
62               "version": "v13",
63               "url": "/aai/v13/search/generic-query",
64               "protocol": "REST",
65               "port": "8446",
66               "enable_ssl": true,
67               "lb_policy":"ip_hash",
68               "visualRange": "1",
69               "path": "/aai/v13/search/generic-query"
70           },
71           {
72               "serviceName": "_aai-nodes-query",
73               "version": "v11",
74               "url": "/aai/v11/search/nodes-query",
75               "protocol": "REST",
76               "port": "8446",
77               "enable_ssl": true,
78               "lb_policy":"ip_hash",
79               "visualRange": "1",
80               "path": "/aai/v11/search/nodes-query"
81           },
82           {
83               "serviceName": "_aai-nodes-query",
84               "version": "v12",
85               "url": "/aai/v12/search/nodes-query",
86               "protocol": "REST",
87               "port": "8446",
88               "enable_ssl": true,
89               "lb_policy":"ip_hash",
90               "visualRange": "1",
91               "path": "/aai/v12/search/nodes-query"
92           },
93           {
94               "serviceName": "_aai-nodes-query",
95               "version": "v13",
96               "url": "/aai/v13/search/nodes-query",
97               "protocol": "REST",
98               "port": "8446",
99               "enable_ssl": true,
100               "lb_policy":"ip_hash",
101               "visualRange": "1",
102               "path": "/aai/v13/search/nodes-query"
103           },
104           {
105               "serviceName": "_aai-query",
106               "version": "v11",
107               "url": "/aai/v11/query",
108               "protocol": "REST",
109               "port": "8446",
110               "enable_ssl": true,
111               "lb_policy":"ip_hash",
112               "visualRange": "1",
113               "path": "/aai/v11/query"
114           },
115           {
116               "serviceName": "_aai-query",
117               "version": "v12",
118               "url": "/aai/v12/query",
119               "protocol": "REST",
120               "port": "8446",
121               "enable_ssl": true,
122               "lb_policy":"ip_hash",
123               "visualRange": "1",
124               "path": "/aai/v12/query"
125           },
126           {
127               "serviceName": "_aai-query",
128               "version": "v13",
129               "url": "/aai/v13/query",
130               "protocol": "REST",
131               "port": "8446",
132               "enable_ssl": true,
133               "lb_policy":"ip_hash",
134               "visualRange": "1",
135               "path": "/aai/v13/query"
136           },
137           {
138               "serviceName": "_aai-named-query",
139               "url": "/aai/search",
140               "protocol": "REST",
141               "port": "8446",
142               "enable_ssl": true,
143               "lb_policy":"ip_hash",
144               "visualRange": "1",
145               "path": "/aai/search"
146           },
147           {
148               "serviceName": "aai-generic-query",
149               "version": "v11",
150               "url": "/aai/v11/search/generic-query",
151               "protocol": "REST",
152               "port": "8446",
153               "enable_ssl": true,
154               "lb_policy":"ip_hash",
155               "visualRange": "1"
156           },
157           {
158               "serviceName": "aai-generic-query",
159               "version": "v12",
160               "url": "/aai/v12/search/generic-query",
161               "protocol": "REST",
162               "port": "8446",
163               "enable_ssl": true,
164               "lb_policy":"ip_hash",
165               "visualRange": "1"
166           },
167           {
168               "serviceName": "aai-generic-query",
169               "version": "v13",
170               "url": "/aai/v13/search/generic-query",
171               "protocol": "REST",
172               "port": "8446",
173               "enable_ssl": true,
174               "lb_policy":"ip_hash",
175               "visualRange": "1"
176           },
177           {
178               "serviceName": "aai-nodes-query",
179               "version": "v11",
180               "url": "/aai/v11/search/nodes-query",
181               "protocol": "REST",
182               "port": "8446",
183               "enable_ssl": true,
184               "lb_policy":"ip_hash",
185               "visualRange": "1"
186           },
187           {
188               "serviceName": "aai-nodes-query",
189               "version": "v12",
190               "url": "/aai/v12/search/nodes-query",
191               "protocol": "REST",
192               "port": "8446",
193               "enable_ssl": true,
194               "lb_policy":"ip_hash",
195               "visualRange": "1"
196           },
197           {
198               "serviceName": "aai-nodes-query",
199               "version": "v13",
200               "url": "/aai/v13/search/nodes-query",
201               "protocol": "REST",
202               "port": "8446",
203               "enable_ssl": true,
204               "lb_policy":"ip_hash",
205               "visualRange": "1"
206           },
207           {
208               "serviceName": "aai-query",
209               "version": "v11",
210               "url": "/aai/v11/query",
211               "protocol": "REST",
212               "port": "8446",
213               "enable_ssl": true,
214               "lb_policy":"ip_hash",
215               "visualRange": "1"
216           },
217           {
218               "serviceName": "aai-query",
219               "version": "v12",
220               "url": "/aai/v12/query",
221               "protocol": "REST",
222               "port": "8446",
223               "enable_ssl": true,
224               "lb_policy":"ip_hash",
225               "visualRange": "1"
226           },
227           {
228               "serviceName": "aai-query",
229               "version": "v13",
230               "url": "/aai/v13/query",
231               "protocol": "REST",
232               "port": "8446",
233               "enable_ssl": true,
234               "lb_policy":"ip_hash",
235               "visualRange": "1"
236           },
237           {
238               "serviceName": "aai-named-query",
239               "url": "/aai/search",
240               "protocol": "REST",
241               "port": "8446",
242               "enable_ssl": true,
243               "lb_policy":"ip_hash",
244               "visualRange": "1"
245           }
246           ]'
247     spec:
248       initContainers:
249       - command:
250         - /root/ready.py
251         args:
252         - --container-name
253         - aai-resources
254         env:
255         - name: NAMESPACE
256           valueFrom:
257             fieldRef:
258               apiVersion: v1
259               fieldPath: metadata.namespace
260         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
261         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
262         name: {{ include "common.name" . }}-readiness
263       containers:
264       - name: {{ include "common.name" . }}
265         image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
266         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
267         env:
268         - name: CHEF_BRANCH
269           value: master
270         - name: AAI_CHEF_ENV
271           value: simpledemo
272         - name: AAI_CORE_VERSION
273           value: {{ .Values.config.aaicoreversion }}
274         - name: AAI_CHEF_LOC
275           value: /var/chef/aai-data/environments
276         - name: CHEF_GIT_URL
277           value: http://gerrit.onap.org/r/aai
278         - name: RESOURCES_HOSTNAME
279           value: aai-resources.{{ include "common.namespace" . }}
280         volumeMounts:
281         - mountPath: /etc/localtime
282           name: localtime
283           readOnly: true
284         - mountPath: /var/chef/aai-data/chef-config/dev/.knife/solo.rb
285           subPath: solo.rb
286           name: aai-chef-config
287         - mountPath: /var/chef/aai-data/environments/
288           name: aai-data
289         - mountPath: /var/log/onap
290           name: aai-traversal-logs
291         - mountPath: /opt/app/aai-traversal/bundleconfig/etc/logback.xml
292           name: aai-traversal-log-conf
293           subPath: logback.xml
294         ports:
295         - containerPort: {{ .Values.service.internalPort }}
296         - containerPort: {{ .Values.service.internalPort2 }}
297         # disable liveness probe when breakpoints set in debugger
298         # so K8s doesn't restart unresponsive container
299         {{ if .Values.liveness.enabled }}
300         livenessProbe:
301           tcpSocket:
302             port: {{ .Values.service.internalPort }}
303           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
304           periodSeconds: {{ .Values.liveness.periodSeconds }}
305         {{ end }}
306         readinessProbe:
307           tcpSocket:
308             port: {{ .Values.service.internalPort }}
309           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
310           periodSeconds: {{ .Values.readiness.periodSeconds }}
311         resources:
312 {{ toYaml .Values.resources | indent 10 }}
313       {{- if .Values.nodeSelector }}
314       nodeSelector:
315 {{ toYaml .Values.nodeSelector | indent 8 }}
316       {{- end -}}
317       {{- if .Values.affinity }}
318       affinity:
319 {{ toYaml .Values.affinity | indent 8 }}
320       {{- end }}
321
322       # side car containers
323       - name: filebeat-onap
324         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
325         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
326         volumeMounts:
327         - mountPath: /usr/share/filebeat/filebeat.yml
328           subPath: filebeat.yml
329           name: filebeat-conf
330         - mountPath: /var/log/onap
331           name: aai-traversal-logs
332         - mountPath: /usr/share/filebeat/data
333           name: aai-traversal-filebeat
334
335       volumes:
336       - name: localtime
337         hostPath:
338           path: /etc/localtime
339       - name: aai-chef-config
340         configMap:
341           name: aai-chef-config
342       - name: aai-data
343         configMap:
344           name: aai-resources-environments
345       - name: filebeat-conf
346         configMap:
347           name: aai-filebeat
348       - name: aai-traversal-logs
349         emptyDir: {}
350       - name: aai-traversal-filebeat
351         emptyDir: {}
352       - name: aai-traversal-log-conf
353         configMap:
354          name: {{ include "common.fullname" . }}-log
355       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
356       imagePullSecrets:
357       - name: "{{ include "common.namespace" . }}-docker-registry-key"