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