blob: 3768e629e7acbcd912fcad683607c5af6e588c9d [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002# 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.
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010017*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010018
19apiVersion: apps/v1
20kind: Deployment
21metadata:
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 }}
29spec:
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:
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +000041 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
osk1146127fd7d82021-06-18 00:51:17 +020042 {{- if ( include "common.needTLS" .) }}
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +000043 - command:
44 - sh
45 args:
46 - -c
47 - |
48 echo "*** retrieve Truststore and Keystore password"
49 export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop \
50 | xargs -0)
51 if [ -z "$KEYSTORE_PASSWORD" ]
52 then
53 echo " /!\ certificates retrieval failed"
54 exit 1
55 fi
56 echo "*** write them in portal part"
57 cd /config-input
58 for PFILE in `ls -1 .`
59 do
60 envsubst <${PFILE} >/config/${PFILE}
61 done
62 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
63 - mountPath: /config-input
64 name: portal-config-input
65 - mountPath: /config
66 name: portal-config
67 image: {{ include "repositoryGenerator.image.envsubst" . }}
68 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69 name: {{ include "common.name" . }}-update-config
osk1146127fd7d82021-06-18 00:51:17 +020070 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010071 - command:
72 - /app/ready.py
73 args:
74 - --container-name
Sylvain Desbureaux70070412020-11-09 21:58:48 +010075 - aai
76 env:
77 - name: NAMESPACE
78 valueFrom:
79 fieldRef:
80 apiVersion: v1
81 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010082 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010083 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
84 name: {{ include "common.name" . }}-readiness
85 containers:
86 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010087 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010088 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +000089 command:
90 - sh
91 args:
92 - -c
93 - |
94 echo "*** retrieve Truststore and Keystore password"
95 export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop \
96 | xargs -0)
97 echo "*** actual launch of AAI Sparky BE"
98 /opt/app/sparky/bin/start.sh
99 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100100 - mountPath: /etc/localtime
101 name: localtime
102 readOnly: true
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100103 - mountPath: /opt/app/sparky/config/auth/csp-cookie-filter.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000104 name: auth-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105 subPath: csp-cookie-filter.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100106 - mountPath: /opt/app/sparky/config/portal/
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000107 name: portal-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100108 - mountPath: /opt/app/sparky/config/portal/BOOT-INF/classes/
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000109 name: portal-config-props
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100110 - mountPath: /var/log/onap
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000111 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 - mountPath: /opt/app/sparky/config/application.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000113 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100114 subPath: application.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100115 - mountPath: /opt/app/sparky/config/application-resources.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000116 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100117 subPath: application-resources.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100118 - mountPath: /opt/app/sparky/config/application-ssl.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000119 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100120 subPath: application-ssl.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100121 - mountPath: /opt/app/sparky/config/application-oxm-default.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000122 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100123 subPath: application-oxm-default.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100124 - mountPath: /opt/app/sparky/config/application-oxm-override.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000125 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100126 subPath: application-oxm-override.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100127 - mountPath: /opt/app/sparky/config/application-oxm-schema-prod.properties
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000128 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100129 subPath: application-oxm-schema-prod.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100130 - mountPath: /opt/app/sparky/config/roles.config
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000131 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100132 subPath: roles.config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100133 - mountPath: /opt/app/sparky/config/users.config
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000134 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100135 subPath: users.config
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000136 - mountPath: /opt/app/sparky/config/logging/logback.xml
137 name: config
138 subPath: logback.xml
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100139 ports:
140 - containerPort: {{ .Values.service.internalPort }}
141 # disable liveness probe when breakpoints set in debugger
142 # so K8s doesn't restart unresponsive container
143 {{- if eq .Values.liveness.enabled true }}
144 livenessProbe:
145 tcpSocket:
146 port: {{ .Values.service.internalPort }}
147 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
148 periodSeconds: {{ .Values.liveness.periodSeconds }}
149 {{ end -}}
150 readinessProbe:
151 tcpSocket:
152 port: {{ .Values.service.internalPort }}
153 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
154 periodSeconds: {{ .Values.readiness.periodSeconds }}
155 resources:
156{{ include "common.resources" . }}
157 {{- if .Values.nodeSelector }}
158 nodeSelector:
159{{ toYaml .Values.nodeSelector | indent 8 }}
160 {{- end -}}
161 {{- if .Values.affinity }}
162 affinity:
163{{ toYaml .Values.affinity | indent 8 }}
164 {{- end }}
165
166 # side car containers
167 - name: filebeat-onap
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100168 image: {{ include "repositoryGenerator.image.logging" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100169 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
170 volumeMounts:
171 - mountPath: /usr/share/filebeat/filebeat.yml
172 subPath: filebeat.yml
173 name: filebeat-conf
174 - mountPath: /var/log/onap
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000175 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100176 - mountPath: /usr/share/filebeat/data
177 name: aai-sparky-filebeat
178 resources:
179{{ include "common.resources" . }}
180
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000181 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100182 - name: localtime
183 hostPath:
184 path: /etc/localtime
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000185 - name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100186 configMap:
187 name: {{ include "common.fullname" . }}
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000188 - name: portal-config
189 emptyDir:
190 medium: Memory
191 - name: portal-config-input
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100192 configMap:
193 name: {{ include "common.fullname" . }}-portal
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000194 - name: portal-config-props
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100195 configMap:
196 name: {{ include "common.fullname" . }}-portal-props
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000197 - name: auth-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100198 secret:
199 secretName: {{ include "common.fullname" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100200 - name: filebeat-conf
201 configMap:
202 name: aai-filebeat
Sylvain Desbureaux375d0ea2021-03-08 16:52:20 +0000203 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100204 emptyDir: {}
205 - name: aai-sparky-filebeat
206 emptyDir: {}
207 - name: modeldir
208 emptyDir: {}
209 restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
210 imagePullSecrets:
211 - name: "{{ include "common.namespace" . }}-docker-registry-key"