blob: d6e49acc4ba2c527246c17cd0ba6d28630e089f8 [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
Sylvain Desbureaux5b651322020-12-07 15:34:15 +01004# Modifications Copyright (c) 2020 Nokia, Orange
Sylvain Desbureaux331f0042021-01-18 11:38:49 +01005# Modifications Copyright (c) 2021 Orange
efiacord12c1672023-03-23 12:10:50 +00006# Modifications Copyright © 2023 Nordix Foundation
Sylvain Desbureaux70070412020-11-09 21:58:48 +01007#
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010019*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010020
21apiVersion: apps/v1
22kind: Deployment
23metadata:
24 name: {{ include "common.fullname" . }}
25 namespace: {{ include "common.namespace" . }}
26 labels:
27 app: {{ include "common.name" . }}
Andreas Geisslerceac2602023-07-17 18:55:54 +020028 app.kubernetes.io/name: {{ include "common.name" . }}
29 {{- if .Chart.AppVersion }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020030 version: "{{ .Chart.AppVersion | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020031 {{- else }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020032 version: "{{ .Chart.Version | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020033 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010034 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
35 release: {{ include "common.release" . }}
36 heritage: {{ .Release.Service }}
37spec:
38 replicas: {{ .Values.replicaCount }}
M.Hosnidokht15fea932021-08-25 09:08:40 -040039 minReadySeconds: {{ .Values.minReadySeconds }}
40 strategy:
41 type: {{ .Values.updateStrategy.type }}
42 rollingUpdate:
43 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
44 maxSurge: {{ .Values.updateStrategy.maxSurge }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010045 selector:
46 matchLabels:
47 app: {{ include "common.name" . }}
48 template:
49 metadata:
50 labels:
51 app: {{ include "common.name" . }}
52 release: {{ include "common.release" . }}
Andreas Geisslerceac2602023-07-17 18:55:54 +020053 app.kubernetes.io/name: {{ include "common.name" . }}
54 {{- if .Chart.AppVersion }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020055 version: "{{ .Chart.AppVersion | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020056 {{- else }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020057 version: "{{ .Chart.Version | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020058 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010059 name: {{ include "common.name" . }}
60 annotations:
61 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010062 {{- if .Values.global.msbEnabled }}
63 {{ $values := .Values }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010064 msb.onap.org/service-info: '[
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010065 {{- range $api_endpoint := $values.aai_enpoints -}}
66 {{- range $api_version := $values.api_list }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010067 {
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010068 "serviceName": "_{{ $api_endpoint.name }}",
69 "version": "v{{ $api_version }}",
70 "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
Sylvain Desbureaux70070412020-11-09 21:58:48 +010071 "protocol": "REST",
72 "port": "8446",
73 "enable_ssl": true,
74 "lb_policy":"ip_hash",
75 "visualRange": "1",
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010076 "path": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}"
Sylvain Desbureaux70070412020-11-09 21:58:48 +010077 },
78 {
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010079 "serviceName": "{{ $api_endpoint.name }}",
80 "version": "v{{ $api_version }}",
81 "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
Sylvain Desbureaux70070412020-11-09 21:58:48 +010082 "protocol": "REST",
83 "port": "8446",
84 "enable_ssl": true,
85 "lb_policy":"ip_hash",
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010086 "visualRange": "1"
Sylvain Desbureaux70070412020-11-09 21:58:48 +010087 },
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010088 {{- end }}
89 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010090 {
91 "serviceName": "_aai-named-query",
92 "url": "/aai/search",
93 "protocol": "REST",
94 "port": "8446",
95 "enable_ssl": true,
96 "lb_policy":"ip_hash",
97 "visualRange": "1",
98 "path": "/aai/search"
99 },
100 {
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100101 "serviceName": "aai-named-query",
102 "url": "/aai/search",
103 "protocol": "REST",
104 "port": "8446",
105 "enable_ssl": true,
106 "lb_policy":"ip_hash",
107 "visualRange": "1"
108 }
109 ]'
Sylvain Desbureaux331f0042021-01-18 11:38:49 +0100110 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100111 spec:
112 hostname: aai-traversal
M.Hosnidokht15fea932021-08-25 09:08:40 -0400113 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
efiacord12c1672023-03-23 12:10:50 +0000114 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100115 - command:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100116 - /app/ready.py
117 args:
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100118 {{- if .Values.global.jobs.migration.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100119 - --job-name
120 - {{ include "common.release" . }}-aai-graphadmin-migration
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100121 {{- else }}
122 {{- if .Values.global.jobs.createSchema.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100123 - --job-name
124 - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100125 {{- else }}
Andreas Geisslercfd84342023-08-16 17:18:49 +0200126 - --app-name
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100127 {{- if .Values.global.cassandra.localCluster }}
128 - aai-cassandra
129 {{- else }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100130 - cassandra
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100131 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100132 - --container-name
133 - aai-schema-service
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100134 {{- end }}
135 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100136 env:
137 - name: NAMESPACE
138 valueFrom:
139 fieldRef:
140 apiVersion: v1
141 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100142 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100143 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
144 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +0100145 resources:
146 limits:
147 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +0100148 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +0100149 requests:
150 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +0100151 memory: "20Mi"
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100152 containers:
153 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100154 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100155 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100156 command:
157 - sh
158 args:
159 - -c
160 - |
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100161 echo "*** actual launch of AAI Resources"
162 /bin/bash /opt/app/aai-traversal/docker-entrypoint.sh
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100163 env:
Andreas Geissler2ac422a2023-10-25 14:19:19 +0200164 {{- if .Values.config.env }}
165 {{- range $key,$value := .Values.config.env }}
166 - name: {{ $key | upper | quote}}
167 value: {{ $value | quote}}
168 {{- end }}
169 {{- end }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100170 {{- if .Values.config.profiling.enabled }}
171 - name: PRE_JVM_ARGS
172 value: '{{ join " " .Values.config.profiling.args }}'
173 {{- end }}
174 {{- if .Values.config.debug.enabled }}
175 - name: POST_JVM_ARGS
176 value: {{ .Values.config.debug.args | quote }}
177 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100178 - name: DISABLE_UPDATE_QUERY
179 value: {{ .Values.config.disableUpdateQuery | quote }}
180 - name: LOCAL_USER_ID
181 value: {{ .Values.global.config.userId | quote }}
182 - name: LOCAL_GROUP_ID
183 value: {{ .Values.global.config.groupId | quote }}
M.Hosnidokht15fea932021-08-25 09:08:40 -0400184 - name: INTERNAL_PORT_1
185 value: {{ .Values.service.internalPort | quote }}
186 - name: INTERNAL_PORT_2
187 value: {{ .Values.service.internalPort2 | quote }}
leila46fb5802022-11-15 11:33:21 -0500188 - name: INTERNAL_PORT_3
189 value: {{ .Values.service.internalPort3 | quote }}
efiacord12c1672023-03-23 12:10:50 +0000190 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100191 - mountPath: /etc/localtime
192 name: localtime
193 readOnly: true
194 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
195 name: {{ include "common.fullname" . }}-config
196 subPath: janusgraph-realtime.properties
197 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
198 name: {{ include "common.fullname" . }}-config
199 subPath: janusgraph-cached.properties
200 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
201 name: {{ include "common.fullname" . }}-config
202 subPath: aaiconfig.properties
203 - mountPath: /opt/aai/logroot/AAI-GQ
Maciej Wereskid523d122021-09-21 11:22:13 +0200204 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100205 - mountPath: /opt/aai/logroot/AAI-GQ/misc
206 name: {{ include "common.fullname" . }}-logs-misc
207 - mountPath: /opt/app/aai-traversal/resources/logback.xml
208 name: {{ include "common.fullname" . }}-config
209 subPath: logback.xml
210 - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
211 name: {{ include "common.fullname" . }}-config
212 subPath: localhost-access-logback.xml
213 - mountPath: /opt/app/aai-traversal/resources/etc/auth/realm.properties
214 name: {{ include "common.fullname" . }}-config
215 subPath: realm.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100216 - mountPath: /opt/app/aai-traversal/resources/application.properties
217 name: {{ include "common.fullname" . }}-config
218 subPath: application.properties
Sam Huang56a6dd42021-03-26 13:27:17 -0600219 - mountPath: /opt/app/aai-traversal/resources/application-keycloak.properties
220 name: {{ include "common.fullname" . }}-config
221 subPath: application-keycloak.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100222 ports:
223 - containerPort: {{ .Values.service.internalPort }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200224 name: {{ .Values.service.portName }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100225
226 {{- if .Values.config.debug.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100227 - containerPort: {{ .Values.service.internalPort2 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200228 name: {{ .Values.service.portName2 }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100229 {{- end }}
leila46fb5802022-11-15 11:33:21 -0500230 - containerPort: {{ .Values.service.internalPort3 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200231 name: {{ .Values.service.portName3 }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100232 {{- if .Values.config.profiling.enabled }}
233 - containerPort: {{ .Values.service.internalPort4 }}
234 name: {{ .Values.service.portName4 }}
235 {{- end }}
236
M.Hosnidokht15fea932021-08-25 09:08:40 -0400237 lifecycle:
238 # wait for active requests (long-running tasks) to be finished
239 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
240 preStop:
241 exec:
242 command:
243 - sh
244 - -c
245 - |
246 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
247 do sleep 10
248 done
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100249 # disable liveness probe when breakpoints set in debugger
250 # so K8s doesn't restart unresponsive container
251 {{ if .Values.liveness.enabled }}
252 livenessProbe:
Fiete Ostkampc113ef32022-10-12 09:50:46 +0200253 httpGet:
254 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100255 port: {{ .Values.service.internalPort }}
efiacord12c1672023-03-23 12:10:50 +0000256 scheme: HTTP
Fiete Ostkampc113ef32022-10-12 09:50:46 +0200257 httpHeaders:
258 - name: X-FromAppId
259 value: LivenessCheck
260 - name: X-TransactionId
261 value: LiveCheck_TID
262 - name: Accept
263 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100264 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
265 periodSeconds: {{ .Values.liveness.periodSeconds }}
266 {{ end }}
267 readinessProbe:
Fiete Ostkampc113ef32022-10-12 09:50:46 +0200268 httpGet:
269 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100270 port: {{ .Values.service.internalPort }}
efiacord12c1672023-03-23 12:10:50 +0000271 scheme: HTTP
Fiete Ostkampc113ef32022-10-12 09:50:46 +0200272 httpHeaders:
273 - name: X-FromAppId
274 value: ReadinessCheck
275 - name: X-TransactionId
276 value: ReadinessCheck_TID
277 - name: Accept
278 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100279 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
280 periodSeconds: {{ .Values.readiness.periodSeconds }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100281 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100282 {{- if .Values.nodeSelector }}
283 nodeSelector:
284{{ toYaml .Values.nodeSelector | indent 8 }}
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100285 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100286 {{- if .Values.affinity }}
287 affinity:
288{{ toYaml .Values.affinity | indent 8 }}
289 {{- end }}
290
291 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200292 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200293 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacord12c1672023-03-23 12:10:50 +0000294 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100295 - name: localtime
296 hostPath:
297 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200298 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100299 emptyDir: {}
300 - name: {{ include "common.fullname" . }}-logs-misc
301 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200302 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100303 - name: {{ include "common.fullname" . }}-config
304 configMap:
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100305 name: {{ include "common.fullname" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100306 restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
307 imagePullSecrets:
308 - name: "{{ include "common.namespace" . }}-docker-registry-key"