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