Merge "Update Keystore cert"
[oom.git] / kubernetes / aai / charts / aai-sparky-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36       name: {{ include "common.name" . }}
37     spec:
38       initContainers:
39       - command:
40         - /root/ready.py
41         args:
42         - --container-name
43         - aai-elasticsearch
44         - --container-name
45         - aai-search-data
46         - --container-name
47         - aai
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: {{ include "common.name" . }}-readiness
57       containers:
58       - name: {{ include "common.name" . }}
59         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61
62         volumeMounts:
63         - mountPath: /etc/localtime
64           name: localtime
65           readOnly: true
66         - mountPath: /opt/app/sparky/config/auth/client-cert-onap.p12
67           name: {{ include "common.fullname" . }}-auth-config
68           subPath: client-cert-onap.p12
69
70         - mountPath: /opt/app/sparky/config/auth/csp-cookie-filter.properties
71           name: {{ include "common.fullname" . }}-auth-config
72           subPath: csp-cookie-filter.properties
73
74         - mountPath: /opt/app/sparky/config/auth/org.onap.aai.p12
75           name: {{ include "common.fullname" . }}-auth-config
76           subPath: org.onap.aai.p12
77
78         - mountPath: /opt/app/sparky/config/auth/truststoreONAPall.jks
79           name: aai-common-aai-auth-mount
80           subPath: truststoreONAPall.jks
81
82         - mountPath: /opt/app/sparky/config/portal/
83           name: {{ include "common.fullname" . }}-portal-config
84
85         - mountPath: /opt/app/sparky/config/portal/BOOT-INF/classes/
86           name: {{ include "common.fullname" . }}-portal-config-props
87
88         - mountPath: /var/log/onap
89           name: {{ include "common.fullname" . }}-logs
90
91         - mountPath:  /opt/app/sparky/config/application.properties
92           name: {{ include "common.fullname" . }}-properties
93           subPath: application.properties
94
95         - mountPath:  /opt/app/sparky/config/application-resources.properties
96           name: {{ include "common.fullname" . }}-properties
97           subPath: application-resources.properties
98
99         - mountPath:  /opt/app/sparky/config/application-ssl.properties
100           name: {{ include "common.fullname" . }}-properties
101           subPath: application-ssl.properties
102
103         - mountPath:  /opt/app/sparky/config/application-oxm-default.properties
104           name: {{ include "common.fullname" . }}-properties
105           subPath: application-oxm-default.properties
106
107         - mountPath:  /opt/app/sparky/config/application-oxm-override.properties
108           name: {{ include "common.fullname" . }}-properties
109           subPath: application-oxm-override.properties
110
111         - mountPath:  /opt/app/sparky/config/application-oxm-schema-prod.properties
112           name: {{ include "common.fullname" . }}-properties
113           subPath: application-oxm-schema-prod.properties
114
115         - mountPath:  /opt/app/sparky/config/roles.config
116           name: {{ include "common.fullname" . }}-properties
117           subPath: roles.config
118
119         - mountPath:  /opt/app/sparky/config/users.config
120           name: {{ include "common.fullname" . }}-properties
121           subPath: users.config
122
123         ports:
124         - containerPort: {{ .Values.service.internalPort }}
125         # disable liveness probe when breakpoints set in debugger
126         # so K8s doesn't restart unresponsive container
127         {{- if eq .Values.liveness.enabled true }}
128         livenessProbe:
129           tcpSocket:
130             port: {{ .Values.service.internalPort }}
131           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
132           periodSeconds: {{ .Values.liveness.periodSeconds }}
133         {{ end -}}
134         readinessProbe:
135           tcpSocket:
136             port: {{ .Values.service.internalPort }}
137           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
138           periodSeconds: {{ .Values.readiness.periodSeconds }}
139         resources:
140 {{ include "common.resources" . }}
141       {{- if .Values.nodeSelector }}
142       nodeSelector:
143 {{ toYaml .Values.nodeSelector | indent 8 }}
144       {{- end -}}
145       {{- if .Values.affinity }}
146       affinity:
147 {{ toYaml .Values.affinity | indent 8 }}
148       {{- end }}
149
150       # side car containers
151       - name: filebeat-onap
152         image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
153         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
154         volumeMounts:
155         - mountPath: /usr/share/filebeat/filebeat.yml
156           subPath: filebeat.yml
157           name: filebeat-conf
158         - mountPath: /var/log/onap
159           name: {{ include "common.fullname" . }}-logs
160         - mountPath: /usr/share/filebeat/data
161           name: aai-sparky-filebeat
162         resources:
163 {{ include "common.resources" . }}
164
165       volumes:
166       - name: localtime
167         hostPath:
168           path: /etc/localtime
169
170       - name: {{ include "common.fullname" . }}-properties
171         configMap:
172           name: {{ include "common.fullname" . }}-prop
173
174       - name: {{ include "common.fullname" . }}-config
175         configMap:
176           name: {{ include "common.fullname" . }}
177
178       - name: {{ include "common.fullname" . }}-portal-config
179         configMap:
180           name: {{ include "common.fullname" . }}-portal
181
182       - name: {{ include "common.fullname" . }}-portal-config-props
183         configMap:
184           name: {{ include "common.fullname" . }}-portal-props
185
186       - name: {{ include "common.fullname" . }}-auth-config
187         secret:
188           secretName: {{ include "common.fullname" . }}
189       
190       - name: aai-common-aai-auth-mount
191         secret:
192           secretName: aai-common-aai-auth
193       
194       - name: filebeat-conf
195         configMap:
196           name: aai-filebeat
197       - name: {{ include "common.fullname" . }}-logs
198         emptyDir: {}
199       - name: aai-sparky-filebeat
200         emptyDir: {}
201       - name: modeldir
202         emptyDir: {}
203       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
204       imagePullSecrets:
205       - name: "{{ include "common.namespace" . }}-docker-registry-key"