blob: bd642f3ed330481c4d7faea04c4b1e059d171227 [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
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.Hosnidokht09523be2021-08-24 09:00:42 -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": "8447",
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": "8447",
84 "enable_ssl": true,
85 "lb_policy":"ip_hash",
86 "visualRange": "1"
87 },
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010088 {{- end }}
89 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010090 ]'
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010091 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010092 spec:
93 hostname: aai-resources
M.Hosnidokht09523be2021-08-24 09:00:42 -040094 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
efiacord12c1672023-03-23 12:10:50 +000095 initContainers:
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +010096 - name: {{ include "common.name" . }}-readiness
97 command:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010098 - /app/ready.py
99 args:
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100100 {{- if .Values.global.jobs.migration.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100101 - --job-name
102 - {{ include "common.release" . }}-aai-graphadmin-migration
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100103 {{- else }}
104 {{- if .Values.global.jobs.createSchema.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105 - --job-name
106 - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
Sylvain Desbureaux6212bb22021-01-18 11:43:33 +0100107 {{- else }}
Andreas Geisslercfd84342023-08-16 17:18:49 +0200108 - --app-name
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100109 {{- if .Values.global.cassandra.localCluster }}
110 - aai-cassandra
111 {{- else }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 - cassandra
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100113 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100114 - --container-name
115 - aai-schema-service
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100116 {{- end }}
Sylvain Desbureaux6212bb22021-01-18 11:43:33 +0100117 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100118 env:
119 - name: NAMESPACE
120 valueFrom:
121 fieldRef:
122 apiVersion: v1
123 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100124 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100125 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Andreas Geissler47537432024-02-27 08:55:23 +0100126 resources:
127 limits:
128 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +0100129 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +0100130 requests:
131 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +0100132 memory: "20Mi"
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100133 containers:
134 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100135 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100136 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100137 command:
138 - sh
139 args:
140 - -c
141 - |
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100142 echo "*** actual launch of AAI Resources"
143 /bin/bash /opt/app/aai-resources/docker-entrypoint.sh
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100144 env:
Andreas Geissler2ac422a2023-10-25 14:19:19 +0200145 {{- if .Values.config.env }}
146 {{- range $key,$value := .Values.config.env }}
147 - name: {{ $key | upper | quote}}
148 value: {{ $value | quote}}
149 {{- end }}
150 {{- end }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100151 {{- if .Values.config.profiling.enabled }}
152 - name: PRE_JVM_ARGS
153 value: '{{ join " " .Values.config.profiling.args }}'
154 {{- end }}
155 {{- if .Values.config.debug.enabled }}
156 - name: POST_JVM_ARGS
157 value: {{ .Values.config.debug.args | quote }}
158 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100159 - name: LOCAL_USER_ID
160 value: {{ .Values.global.config.userId | quote }}
161 - name: LOCAL_GROUP_ID
162 value: {{ .Values.global.config.groupId | quote }}
M.Hosnidokht09523be2021-08-24 09:00:42 -0400163 - name: INTERNAL_PORT_1
164 value: {{ .Values.service.internalPort | quote }}
165 - name: INTERNAL_PORT_2
166 value: {{ .Values.service.internalPort2 | quote }}
leila46fb5802022-11-15 11:33:21 -0500167 - name: INTERNAL_PORT_3
168 value: {{ .Values.service.internalPort3 | quote }}
efiacord12c1672023-03-23 12:10:50 +0000169 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100170 - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties
171 name: {{ include "common.fullname" . }}-config
172 subPath: janusgraph-realtime.properties
173 - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties
174 name: {{ include "common.fullname" . }}-config
175 subPath: janusgraph-cached.properties
176 - mountPath: /opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties
177 name: {{ include "common.fullname" . }}-config
178 subPath: aaiconfig.properties
179 - mountPath: /opt/aai/logroot/AAI-RES
Maciej Wereskid523d122021-09-21 11:22:13 +0200180 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100181 - mountPath: /opt/app/aai-resources/resources/logback.xml
182 name: {{ include "common.fullname" . }}-config
183 subPath: logback.xml
184 - mountPath: /opt/app/aai-resources/resources/localhost-access-logback.xml
185 name: {{ include "common.fullname" . }}-config
186 subPath: localhost-access-logback.xml
187 - mountPath: /opt/app/aai-resources/resources/etc/auth/realm.properties
188 name: {{ include "common.fullname" . }}-config
189 subPath: realm.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100190 - mountPath: /opt/app/aai-resources/resources/application.properties
191 name: {{ include "common.fullname" . }}-config
192 subPath: application.properties
193 - mountPath: /opt/app/aai-resources/resources/application-keycloak.properties
194 name: {{ include "common.fullname" . }}-config
195 subPath: application-keycloak.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100196 ports:
197 - containerPort: {{ .Values.service.internalPort }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200198 name: {{ .Values.service.portName }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100199 {{- if .Values.config.debug.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100200 - containerPort: {{ .Values.service.internalPort2 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200201 name: {{ .Values.service.portName2 }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100202 {{- end }}
leila46fb5802022-11-15 11:33:21 -0500203 - containerPort: {{ .Values.service.internalPort3 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200204 name: {{ .Values.service.portName3 }}
Fiete Ostkamp21d48642024-01-16 08:33:59 +0100205 {{- if .Values.config.profiling.enabled }}
206 - containerPort: {{ .Values.service.internalPort4 }}
207 name: {{ .Values.service.portName4 }}
208 {{- end }}
209
M.Hosnidokht09523be2021-08-24 09:00:42 -0400210 lifecycle:
211 # wait for active requests (long-running tasks) to be finished
212 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
213 preStop:
214 exec:
215 command:
216 - sh
217 - -c
218 - |
219 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
220 do sleep 10
221 done
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100222 # disable liveness probe when breakpoints set in debugger
223 # so K8s doesn't restart unresponsive container
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100224 {{- if .Values.liveness.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100225 livenessProbe:
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700226 httpGet:
227 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100228 port: {{ .Values.service.internalPort }}
efiacord12c1672023-03-23 12:10:50 +0000229 scheme: HTTP
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700230 httpHeaders:
231 - name: X-FromAppId
232 value: LivenessCheck
233 - name: X-TransactionId
234 value: LiveCheck_TID
235 - name: Accept
236 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100237 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
238 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100239 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100240 readinessProbe:
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700241 httpGet:
242 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100243 port: {{ .Values.service.internalPort }}
efiacord12c1672023-03-23 12:10:50 +0000244 scheme: HTTP
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700245 httpHeaders:
246 - name: X-FromAppId
247 value: ReadinessCheck
248 - name: X-TransactionId
249 value: ReadinessCheck_TID
250 - name: Accept
251 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100252 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
253 periodSeconds: {{ .Values.readiness.periodSeconds }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100254 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100255 {{- if .Values.nodeSelector }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100256 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100257 {{- end }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100258 {{- if .Values.affinity }}
259 affinity: {{ toYaml .Values.affinity | nindent 8 }}
260 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100261 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200262 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200263 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacord12c1672023-03-23 12:10:50 +0000264 volumes:
Maciej Wereskid523d122021-09-21 11:22:13 +0200265 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100266 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200267 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100268 - name: {{ include "common.fullname" . }}-config
269 configMap:
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100270 name: {{ include "common.fullname" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100271 restartPolicy: {{ .Values.restartPolicy }}
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +0100272 {{- include "common.imagePullSecrets" . | nindent 6 }}