[AAI] Make AAI helm3 compatible
[oom.git] / kubernetes / aai / components / aai-sparky-be / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2017 Amdocs, Bell Canada
3 # Modifications Copyright (c) 2018 AT&T
4 # Modifications Copyright (c) 2020 Nokia
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       initContainers:
42       - command:
43         - /app/ready.py
44         args:
45         - --container-name
46         - aai-elasticsearch
47         - --container-name
48         - aai-search-data
49         - --container-name
50         - aai
51         env:
52         - name: NAMESPACE
53           valueFrom:
54             fieldRef:
55               apiVersion: v1
56               fieldPath: metadata.namespace
57         image: {{ include "repositoryGenerator.image.readiness" . }}
58         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59         name: {{ include "common.name" . }}-readiness
60       containers:
61       - name: {{ include "common.name" . }}
62         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64
65         volumeMounts:
66         - mountPath: /etc/localtime
67           name: localtime
68           readOnly: true
69         - mountPath: /opt/app/sparky/config/auth/client-cert-onap.p12
70           name: {{ include "common.fullname" . }}-auth-config
71           subPath: client-cert-onap.p12
72
73         - mountPath: /opt/app/sparky/config/auth/csp-cookie-filter.properties
74           name: {{ include "common.fullname" . }}-auth-config
75           subPath: csp-cookie-filter.properties
76
77         - mountPath: /opt/app/sparky/config/auth/org.onap.aai.p12
78           name: {{ include "common.fullname" . }}-auth-config
79           subPath: org.onap.aai.p12
80
81         - mountPath: /opt/app/sparky/config/auth/truststoreONAPall.jks
82           name: aai-common-aai-auth-mount
83           subPath: truststoreONAPall.jks
84
85         - mountPath: /opt/app/sparky/config/portal/
86           name: {{ include "common.fullname" . }}-portal-config
87
88         - mountPath: /opt/app/sparky/config/portal/BOOT-INF/classes/
89           name: {{ include "common.fullname" . }}-portal-config-props
90
91         - mountPath: /var/log/onap
92           name: {{ include "common.fullname" . }}-logs
93
94         - mountPath:  /opt/app/sparky/config/application.properties
95           name: {{ include "common.fullname" . }}-properties
96           subPath: application.properties
97
98         - mountPath:  /opt/app/sparky/config/application-resources.properties
99           name: {{ include "common.fullname" . }}-properties
100           subPath: application-resources.properties
101
102         - mountPath:  /opt/app/sparky/config/application-ssl.properties
103           name: {{ include "common.fullname" . }}-properties
104           subPath: application-ssl.properties
105
106         - mountPath:  /opt/app/sparky/config/application-oxm-default.properties
107           name: {{ include "common.fullname" . }}-properties
108           subPath: application-oxm-default.properties
109
110         - mountPath:  /opt/app/sparky/config/application-oxm-override.properties
111           name: {{ include "common.fullname" . }}-properties
112           subPath: application-oxm-override.properties
113
114         - mountPath:  /opt/app/sparky/config/application-oxm-schema-prod.properties
115           name: {{ include "common.fullname" . }}-properties
116           subPath: application-oxm-schema-prod.properties
117
118         - mountPath:  /opt/app/sparky/config/roles.config
119           name: {{ include "common.fullname" . }}-properties
120           subPath: roles.config
121
122         - mountPath:  /opt/app/sparky/config/users.config
123           name: {{ include "common.fullname" . }}-properties
124           subPath: users.config
125
126         ports:
127         - containerPort: {{ .Values.service.internalPort }}
128         # disable liveness probe when breakpoints set in debugger
129         # so K8s doesn't restart unresponsive container
130         {{- if eq .Values.liveness.enabled true }}
131         livenessProbe:
132           tcpSocket:
133             port: {{ .Values.service.internalPort }}
134           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
135           periodSeconds: {{ .Values.liveness.periodSeconds }}
136         {{ end -}}
137         readinessProbe:
138           tcpSocket:
139             port: {{ .Values.service.internalPort }}
140           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
141           periodSeconds: {{ .Values.readiness.periodSeconds }}
142         resources:
143 {{ include "common.resources" . }}
144       {{- if .Values.nodeSelector }}
145       nodeSelector:
146 {{ toYaml .Values.nodeSelector | indent 8 }}
147       {{- end -}}
148       {{- if .Values.affinity }}
149       affinity:
150 {{ toYaml .Values.affinity | indent 8 }}
151       {{- end }}
152
153       # side car containers
154       - name: filebeat-onap
155         image: {{ include "repositoryGenerator.image.logging" . }}
156         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
157         volumeMounts:
158         - mountPath: /usr/share/filebeat/filebeat.yml
159           subPath: filebeat.yml
160           name: filebeat-conf
161         - mountPath: /var/log/onap
162           name: {{ include "common.fullname" . }}-logs
163         - mountPath: /usr/share/filebeat/data
164           name: aai-sparky-filebeat
165         resources:
166 {{ include "common.resources" . }}
167
168       volumes:
169       - name: localtime
170         hostPath:
171           path: /etc/localtime
172
173       - name: {{ include "common.fullname" . }}-properties
174         configMap:
175           name: {{ include "common.fullname" . }}-prop
176
177       - name: {{ include "common.fullname" . }}-config
178         configMap:
179           name: {{ include "common.fullname" . }}
180
181       - name: {{ include "common.fullname" . }}-portal-config
182         configMap:
183           name: {{ include "common.fullname" . }}-portal
184
185       - name: {{ include "common.fullname" . }}-portal-config-props
186         configMap:
187           name: {{ include "common.fullname" . }}-portal-props
188
189       - name: {{ include "common.fullname" . }}-auth-config
190         secret:
191           secretName: {{ include "common.fullname" . }}
192
193       - name: aai-common-aai-auth-mount
194         secret:
195           secretName: aai-common-aai-auth
196
197       - name: filebeat-conf
198         configMap:
199           name: aai-filebeat
200       - name: {{ include "common.fullname" . }}-logs
201         emptyDir: {}
202       - name: aai-sparky-filebeat
203         emptyDir: {}
204       - name: modeldir
205         emptyDir: {}
206       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
207       imagePullSecrets:
208       - name: "{{ include "common.namespace" . }}-docker-registry-key"