[AAI] Make AAI helm3 compatible
[oom.git] / kubernetes / aai / components / aai-data-router / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 # Modifications Copyright © 2020 Orange
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: {{ .Values.replicaCount }}
31   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39       name: {{ include "common.name" . }}
40     spec:
41       {{- if .Values.nodeSelector }}
42       nodeSelector:
43 {{ toYaml .Values.nodeSelector | indent 8 }}
44       {{- end -}}
45       {{- if .Values.affinity }}
46       affinity:
47 {{ toYaml .Values.affinity | indent 8 }}
48       {{- end }}
49       initContainers:
50       - command:
51         - /bin/sh
52         - -c
53         - |
54           mkdir -p /logroot/data-router/logs
55           chmod -R 777 /logroot/data-router/logs
56           chown -R root:root /logroot
57         env:
58         - name: NAMESPACE
59           valueFrom:
60             fieldRef:
61               apiVersion: v1
62               fieldPath: metadata.namespace
63         securityContext:
64           privileged: true
65         image: {{ include "repositoryGenerator.image.busybox" . }}
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         name: init-sysctl
68         volumeMounts:
69         - name: {{ include "common.fullname" . }}-logs
70           mountPath: /logroot/
71       containers:
72       - name: {{ include "common.name" . }}
73         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
74         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75         env:
76         - name: SERVICE_BEANS
77           value: /opt/app/data-router/dynamic/conf
78         - name: CONFIG_HOME
79           value: /opt/app/data-router/config/
80         - name: KEY_STORE_PASSWORD
81           value: {{ .Values.config.keyStorePassword }}
82         - name: DYNAMIC_ROUTES
83           value: /opt/app/data-router/dynamic/routes
84         - name: KEY_MANAGER_PASSWORD
85           value: {{ .Values.config.keyManagerPassword }}
86         - name: PATH
87           value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88         - name: JAVA_HOME
89           value: usr/lib/jvm/java-8-openjdk-amd64
90         volumeMounts:
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - mountPath:  /opt/app/data-router/config/auth
95           name: {{ include "common.fullname" . }}-auth
96         - mountPath:  /opt/app/data-router/config/data-router.properties
97           subPath: data-router.properties
98           name: {{ include "common.fullname" . }}-properties
99         - mountPath:  /opt/app/data-router/config/schemaIngest.properties
100           subPath: schemaIngest.properties
101           name: {{ include "common.fullname" . }}-properties
102         - mountPath: /opt/app/data-router/dynamic/routes/entity-event.route
103           subPath: entity-event.route
104           name: {{ include "common.fullname" . }}-dynamic-route
105         - mountPath: /opt/app/data-router/dynamic/conf/entity-event-policy.xml
106           subPath: entity-event-policy.xml
107           name: {{ include "common.fullname" . }}-dynamic-policy
108         - mountPath: /opt/app/data-router/dynamic/conf/data-router-oxm.xml
109           subPath: data-router-oxm.xml
110           name: {{ include "common.fullname" . }}-dynamic-oxm
111         - mountPath: /opt/app/data-router/bundleconfig/etc/logback.xml
112           name: {{ include "common.fullname" . }}-logback-config
113           subPath: logback.xml
114         - mountPath: /var/log/onap
115           name: {{ include "common.fullname" . }}-logs
116         - mountPath: /logs
117           name: {{ include "common.fullname" . }}-logs
118
119         ports:
120         - containerPort: {{ .Values.service.internalPort }}
121         {{- if eq .Values.liveness.enabled true }}
122         livenessProbe:
123           tcpSocket:
124             port: {{ .Values.service.internalPort }}
125           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
126           periodSeconds: {{ .Values.liveness.periodSeconds }}
127         {{ end -}}
128         readinessProbe:
129           tcpSocket:
130             port: {{ .Values.service.internalPort }}
131           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
132           periodSeconds: {{ .Values.readiness.periodSeconds }}
133         resources:
134 {{ include "common.resources" . }}
135
136       # side car containers
137       - name: filebeat-onap
138         image: {{ include "repositoryGenerator.image.logging" . }}
139         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
140         volumeMounts:
141         - mountPath: /usr/share/filebeat/filebeat.yml
142           subPath: filebeat.yml
143           name: filebeat-conf
144         - mountPath: /var/log/onap
145           name: {{ include "common.fullname" . }}-logs
146         - mountPath: /logs
147           name: {{ include "common.fullname" . }}-logs
148         - mountPath: /usr/share/filebeat/data
149           name: aai-filebeat
150         resources:
151 {{ include "common.resources" . }}
152       volumes:
153       - name: localtime
154         hostPath:
155           path: /etc/localtime
156       - name: filebeat-conf
157         configMap:
158           name: aai-filebeat
159       - name: aai-filebeat
160         emptyDir: {}
161       - name: {{ include "common.fullname" . }}-auth
162         secret:
163           secretName: {{ include "common.fullname" . }}
164       - name: {{ include "common.fullname" . }}-properties
165         configMap:
166           name: {{ include "common.fullname" . }}-prop
167           items:
168           - key: data-router.properties
169             path: data-router.properties
170           - key: schemaIngest.properties
171             path: schemaIngest.properties
172       - name: {{ include "common.fullname" . }}-dynamic-route
173         configMap:
174           name: {{ include "common.fullname" . }}-dynamic
175       - name: {{ include "common.fullname" . }}-dynamic-policy
176         configMap:
177           name: {{ include "common.fullname" . }}-dynamic
178       - name: {{ include "common.fullname" . }}-dynamic-oxm
179         configMap:
180           name: {{ include "common.fullname" . }}-dynamic
181       - name: {{ include "common.fullname" . }}-logs
182         emptyDir: {}
183       - name: {{ include "common.fullname" . }}-logback-config
184         configMap:
185           name: {{ include "common.fullname" . }}-log-configmap
186           items:
187           - key: logback.xml
188             path: logback.xml
189       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
190       imagePullSecrets:
191       - name: "{{ include "common.namespace" . }}-docker-registry-key"