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