Merge "Fixes for SDNC portal pod"
[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       hostname: aai-traversal
249       initContainers:
250       - command:
251         - /root/ready.py
252         args:
253         - --container-name
254         - aai-cassandra
255         - --container-name
256         - aai-resources
257         env:
258         - name: NAMESPACE
259           valueFrom:
260             fieldRef:
261               apiVersion: v1
262               fieldPath: metadata.namespace
263         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
264         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
265         name: {{ include "common.name" . }}-readiness
266       containers:
267       - name: {{ include "common.name" . }}
268         image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
269         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
270         env:
271         - name: DISABLE_UPDATE_QUERY
272           value: {{ .Values.config.disableUpdateQuery | quote }}
273         - name: LOCAL_USER_ID
274           value: {{ .Values.config.userId | quote }}
275         - name: LOCAL_GROUP_ID
276           value: {{ .Values.config.groupId | quote }}
277         volumeMounts:
278         - mountPath: /etc/localtime
279           name: localtime
280           readOnly: true
281         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
282           name: {{ include "common.fullname" . }}-db-real-conf
283           subPath: janusgraph-realtime.properties
284         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
285           name: {{ include "common.fullname" . }}-db-cached-conf
286           subPath: janusgraph-cached.properties
287         - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
288           name: {{ include "common.fullname" . }}-aaiconfig-conf
289           subPath: aaiconfig.properties
290         - mountPath: /var/log/onap
291           name: {{ include "common.fullname" . }}-logs
292         - mountPath: /opt/app/aai-traversal/resources/logback.xml
293           name: {{ include "common.fullname" . }}-log-conf
294           subPath: logback.xml
295         - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
296           name: {{ include "common.fullname" . }}-localhost-access-log-conf
297           subPath: localhost-access-logback.xml
298         - mountPath: /opt/app/aai-traversal/resources/application.properties
299           name: {{ include "common.fullname" . }}-springapp-conf
300           subPath: application.properties
301         - mountPath: /opt/app/aai-traversal/resources/etc/auth/aai_keystore
302           name: {{ include "common.fullname" . }}-auth-sec
303           subPath: aai_keystore
304         ports:
305         - containerPort: {{ .Values.service.internalPort }}
306         - containerPort: {{ .Values.service.internalPort2 }}
307         # disable liveness probe when breakpoints set in debugger
308         # so K8s doesn't restart unresponsive container
309         {{ if .Values.liveness.enabled }}
310         livenessProbe:
311           tcpSocket:
312             port: {{ .Values.service.internalPort }}
313           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
314           periodSeconds: {{ .Values.liveness.periodSeconds }}
315         {{ end }}
316         readinessProbe:
317           tcpSocket:
318             port: {{ .Values.service.internalPort }}
319           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
320           periodSeconds: {{ .Values.readiness.periodSeconds }}
321         resources:
322 {{ toYaml .Values.resources | indent 10 }}
323       {{- if .Values.nodeSelector }}
324       nodeSelector:
325 {{ toYaml .Values.nodeSelector | indent 8 }}
326       {{- end -}}
327       {{- if .Values.affinity }}
328       affinity:
329 {{ toYaml .Values.affinity | indent 8 }}
330       {{- end }}
331
332       # side car containers
333       - name: filebeat-onap
334         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
335         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
336         volumeMounts:
337         - mountPath: /usr/share/filebeat/filebeat.yml
338           subPath: filebeat.yml
339           name: filebeat-conf
340         - mountPath: /var/log/onap
341           name: {{ include "common.fullname" . }}-logs
342         - mountPath: /usr/share/filebeat/data
343           name: {{ include "common.fullname" . }}-filebeat
344       volumes:
345       - name: localtime
346         hostPath:
347           path: /etc/localtime
348       - name: filebeat-conf
349         configMap:
350           name: aai-filebeat
351       - name: {{ include "common.fullname" . }}-logs
352         emptyDir: {}
353       - name: {{ include "common.fullname" . }}-filebeat
354         emptyDir: {}
355       - name: {{ include "common.fullname" . }}-log-conf
356         configMap:
357          name: {{ include "common.fullname" . }}-log
358       - name: {{ include "common.fullname" . }}-localhost-access-log-conf
359         configMap:
360          name: {{ include "common.fullname" . }}-localhost-access-log-configmap
361       - name: {{ include "common.fullname" . }}-db-real-conf
362         configMap:
363          name: {{ include "common.fullname" . }}-db-real-configmap
364       - name: {{ include "common.fullname" . }}-db-cached-conf
365         configMap:
366          name: {{ include "common.fullname" . }}-db-cached-configmap
367       - name: {{ include "common.fullname" . }}-aaiconfig-conf
368         configMap:
369          name: {{ include "common.fullname" . }}-aaiconfig-configmap
370       - name: {{ include "common.fullname" . }}-springapp-conf
371         configMap:
372          name: {{ include "common.fullname" . }}-springapp-configmap
373       - name: {{ include "common.fullname" . }}-realm-conf
374         configMap:
375          name: {{ include "common.fullname" . }}-realm-configmap
376       - name: {{ include "common.fullname" . }}-auth-sec
377         secret:
378          secretName: {{ include "common.fullname" . }}-auth-secret
379       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
380       imagePullSecrets:
381       - name: "{{ include "common.namespace" . }}-docker-registry-key"