blob: 74c58ff2d3ca6148b49693d534d363c8ba7b7af9 [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
Sylvain Desbureaux70070412020-11-09 21:58:48 +01006#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010018*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010019
20apiVersion: apps/v1
21kind: Deployment
22metadata:
23 name: {{ include "common.fullname" . }}
24 namespace: {{ include "common.namespace" . }}
25 labels:
26 app: {{ include "common.name" . }}
27 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28 release: {{ include "common.release" . }}
29 heritage: {{ .Release.Service }}
30spec:
31 replicas: {{ .Values.replicaCount }}
M.Hosnidokht09523be2021-08-24 09:00:42 -040032 minReadySeconds: {{ .Values.minReadySeconds }}
33 strategy:
34 type: {{ .Values.updateStrategy.type }}
35 rollingUpdate:
36 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
37 maxSurge: {{ .Values.updateStrategy.maxSurge }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010038 selector:
39 matchLabels:
40 app: {{ include "common.name" . }}
41 template:
42 metadata:
43 labels:
44 app: {{ include "common.name" . }}
45 release: {{ include "common.release" . }}
46 name: {{ include "common.name" . }}
47 annotations:
48 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010049 {{- if .Values.global.msbEnabled }}
50 {{ $values := .Values }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010051 msb.onap.org/service-info: '[
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010052 {{- range $api_endpoint := $values.aai_enpoints -}}
53 {{- range $api_version := $values.api_list }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010054 {
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010055 "serviceName": "_{{ $api_endpoint.name }}",
56 "version": "v{{ $api_version }}",
57 "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
Sylvain Desbureaux70070412020-11-09 21:58:48 +010058 "protocol": "REST",
59 "port": "8447",
60 "enable_ssl": true,
61 "lb_policy":"ip_hash",
62 "visualRange": "1",
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010063 "path": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}"
Sylvain Desbureaux70070412020-11-09 21:58:48 +010064 },
65 {
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010066 "serviceName": "{{ $api_endpoint.name }}",
67 "version": "v{{ $api_version }}",
68 "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
Sylvain Desbureaux70070412020-11-09 21:58:48 +010069 "protocol": "REST",
70 "port": "8447",
71 "enable_ssl": true,
72 "lb_policy":"ip_hash",
73 "visualRange": "1"
74 },
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010075 {{- end }}
76 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010077 ]'
Sylvain Desbureaux331f0042021-01-18 11:38:49 +010078 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010079 spec:
80 hostname: aai-resources
M.Hosnidokht09523be2021-08-24 09:00:42 -040081 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +010082 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
83 - name: {{ include "common.name" . }}-readiness
84 command:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010085 - /app/ready.py
86 args:
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +010087 {{- if .Values.global.jobs.migration.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010088 - --job-name
89 - {{ include "common.release" . }}-aai-graphadmin-migration
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +010090 {{- else }}
91 {{- if .Values.global.jobs.createSchema.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010092 - --job-name
93 - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
Sylvain Desbureaux6212bb22021-01-18 11:43:33 +010094 {{- else }}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +010095 - --container-name
96 {{- if .Values.global.cassandra.localCluster }}
97 - aai-cassandra
98 {{- else }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010099 - cassandra
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100100 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100101 - --container-name
102 - aai-schema-service
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100103 {{- end }}
Sylvain Desbureaux6212bb22021-01-18 11:43:33 +0100104 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105 env:
106 - name: NAMESPACE
107 valueFrom:
108 fieldRef:
109 apiVersion: v1
110 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100111 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100113 containers:
114 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100115 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100116 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100117 command:
118 - sh
119 args:
120 - -c
121 - |
122 echo "*** retrieve Truststore and Keystore password"
123 export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
124 echo "*** actual launch of AAI Resources"
125 /bin/bash /opt/app/aai-resources/docker-entrypoint.sh
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100126 env:
127 - name: LOCAL_USER_ID
128 value: {{ .Values.global.config.userId | quote }}
129 - name: LOCAL_GROUP_ID
130 value: {{ .Values.global.config.groupId | quote }}
Harish Venkata Kajurb06c9af2021-02-01 08:59:46 -0500131 - name: POST_JAVA_OPTS
Harish Venkata Kajur95b39b12021-06-15 11:49:16 -0400132 value: '-Djavax.net.ssl.trustStore={{ .Values.certInitializer.credsPath }}/truststoreONAPall.jks -Djavax.net.ssl.trustStorePassword={{ .Values.certInitializer.truststorePassword }}'
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100133 - name: TRUSTORE_ALL_PASSWORD
Sylvain Desbureaux6b83dab2021-02-23 16:03:21 +0100134 value: {{ .Values.certInitializer.truststorePassword }}
M.Hosnidokht09523be2021-08-24 09:00:42 -0400135 - name: INTERNAL_PORT_1
136 value: {{ .Values.service.internalPort | quote }}
137 - name: INTERNAL_PORT_2
138 value: {{ .Values.service.internalPort2 | quote }}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100139 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100140 - mountPath: /etc/localtime
141 name: localtime
142 readOnly: true
143 - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties
144 name: {{ include "common.fullname" . }}-config
145 subPath: janusgraph-realtime.properties
146 - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties
147 name: {{ include "common.fullname" . }}-config
148 subPath: janusgraph-cached.properties
149 - mountPath: /opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties
150 name: {{ include "common.fullname" . }}-config
151 subPath: aaiconfig.properties
152 - mountPath: /opt/aai/logroot/AAI-RES
Maciej Wereskid523d122021-09-21 11:22:13 +0200153 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100154 - mountPath: /opt/app/aai-resources/resources/logback.xml
155 name: {{ include "common.fullname" . }}-config
156 subPath: logback.xml
157 - mountPath: /opt/app/aai-resources/resources/localhost-access-logback.xml
158 name: {{ include "common.fullname" . }}-config
159 subPath: localhost-access-logback.xml
160 - mountPath: /opt/app/aai-resources/resources/etc/auth/realm.properties
161 name: {{ include "common.fullname" . }}-config
162 subPath: realm.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100163 - mountPath: /opt/app/aai-resources/resources/aaf/bath_config.csv
164 name: {{ include "common.fullname" . }}-aaf-certs
165 subPath: bath_config.csv
166 - mountPath: /opt/app/aai-resources/resources/aaf/org.onap.aai.props
167 name: {{ include "common.fullname" . }}-aaf-properties
168 subPath: org.onap.aai.props
169 - mountPath: /opt/app/aai-resources/resources/aaf/org.osaaf.location.props
170 name: {{ include "common.fullname" . }}-aaf-properties
171 subPath: org.osaaf.location.props
172 - mountPath: /opt/app/aai-resources/resources/aaf/permissions.properties
173 name: {{ include "common.fullname" . }}-aaf-properties
174 subPath: permissions.properties
175 - mountPath: /opt/app/aai-resources/resources/cadi.properties
176 name: {{ include "common.fullname" . }}-aaf-properties
177 subPath: cadi.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100178 - mountPath: /opt/app/aai-resources/resources/application.properties
179 name: {{ include "common.fullname" . }}-config
180 subPath: application.properties
181 - mountPath: /opt/app/aai-resources/resources/application-keycloak.properties
182 name: {{ include "common.fullname" . }}-config
183 subPath: application-keycloak.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100184 ports:
185 - containerPort: {{ .Values.service.internalPort }}
186 - containerPort: {{ .Values.service.internalPort2 }}
M.Hosnidokht09523be2021-08-24 09:00:42 -0400187 lifecycle:
188 # wait for active requests (long-running tasks) to be finished
189 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
190 preStop:
191 exec:
192 command:
193 - sh
194 - -c
195 - |
196 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
197 do sleep 10
198 done
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100199 # disable liveness probe when breakpoints set in debugger
200 # so K8s doesn't restart unresponsive container
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100201 {{- if .Values.liveness.enabled }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100202 livenessProbe:
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700203 httpGet:
204 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100205 port: {{ .Values.service.internalPort }}
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700206 scheme: HTTP{{ (eq "true" (include "common.needTLS" .)) | ternary "S" "" }}
207 httpHeaders:
208 - name: X-FromAppId
209 value: LivenessCheck
210 - name: X-TransactionId
211 value: LiveCheck_TID
212 - name: Accept
213 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100214 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
215 periodSeconds: {{ .Values.liveness.periodSeconds }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100216 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100217 readinessProbe:
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700218 httpGet:
219 path: /aai/util/echo?action=checkDB
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100220 port: {{ .Values.service.internalPort }}
Rommel Pawarc8845ef2022-09-22 14:04:14 -0700221 scheme: HTTP{{ (eq "true" (include "common.needTLS" .)) | ternary "S" "" }}
222 httpHeaders:
223 - name: X-FromAppId
224 value: ReadinessCheck
225 - name: X-TransactionId
226 value: ReadinessCheck_TID
227 - name: Accept
228 value: application/json
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100229 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
230 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100231 resources: {{ include "common.resources" . | nindent 12 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100232 {{- if .Values.nodeSelector }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100233 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100234 {{- end }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100235 {{- if .Values.affinity }}
236 affinity: {{ toYaml .Values.affinity | nindent 8 }}
237 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100238 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200239 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200240 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100241 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100242 - name: localtime
243 hostPath:
244 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200245 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100246 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200247 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100248 - name: {{ include "common.fullname" . }}-config
249 configMap:
Sylvain Desbureauxb4e038d2020-12-15 12:00:26 +0100250 name: {{ include "common.fullname" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100251 - name: {{ include "common.fullname" . }}-aaf-properties
252 configMap:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100253 name: {{ include "common.fullname" . }}-aaf-props
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100254 - name: {{ include "common.fullname" . }}-aaf-certs
255 secret:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100256 secretName: {{ include "common.fullname" . }}-aaf-keys
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100257 restartPolicy: {{ .Values.restartPolicy }}
258 imagePullSecrets:
259 - name: "{{ include "common.namespace" . }}-docker-registry-key"