blob: 7e9f866d5f57f6c1646b304171c291066085192a [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002#
3# ============LICENSE_START=======================================================
4# org.onap.aai
5# ================================================================================
6# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7# Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +01008# Copyright (c) 2020-2021 Orange Intellectual Property. All rights reserved.
efiacord12c1672023-03-23 12:10:50 +00009# Modifications Copyright © 2023 Nordix Foundation
Sylvain Desbureaux70070412020-11-09 21:58:48 +010010# ================================================================================
11# Licensed under the Apache License, Version 2.0 (the "License");
12# you may not use this file except in compliance with the License.
13# You may obtain a copy of the License at
14#
15# http://www.apache.org/licenses/LICENSE-2.0
16#
17# Unless required by applicable law or agreed to in writing, software
18# distributed under the License is distributed on an "AS IS" BASIS,
19# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20# See the License for the specific language governing permissions and
21# limitations under the License.
22# ============LICENSE_END=========================================================
23
24# In ONAP, the following job will always be run on each installation
25# The following job will go through the latest oxm and
26# create properties based on the data type defined in the oxm
27# and create the required indexes for the appropriate properties
28# This can be run multiple times as the code if the index or property already exists
29# then the index or property won't be created again
30# NOTE - During the execution of the createSchema job, there should
31# be no other janusgraph connection to the graph as its the reason
32# that resources traversal and graphadmin wait until this job is done
33# If you are using an existing cassandra cluster not coming from oom
34# then it is your job to ensure that there are no connections to the database
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010035*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010036
37{{- if .Values.global.jobs.migration.enabled }}
38---
39apiVersion: batch/v1
40kind: Job
41metadata:
42 name: {{ include "common.fullname" . }}-migration
43 namespace: {{ include "common.namespace" . }}
44 labels:
45 app: {{ include "common.name" . }}-job
46 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
47 release: {{ include "common.release" . }}
48 heritage: {{ .Release.Service }}
49 annotations:
50 "helm.sh/hook": post-upgrade,post-rollback,post-install
51 "helm.sh/hook-weight": "1"
52 "helm.sh/hook-delete-policy": before-hook-creation
53spec:
54 backoffLimit: 20
55 template:
56 metadata:
57 labels:
58 app: {{ include "common.name" . }}-job
59 release: {{ include "common.release" . }}
60 name: {{ include "common.name" . }}
61 spec:
efiacord12c1672023-03-23 12:10:50 +000062 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010063 - command:
64 - /app/ready.py
65 args:
66 - --container-name
67 {{- if .Values.global.cassandra.localCluster }}
68 - aai-cassandra
69 {{- else }}
70 - cassandra
71 {{- end }}
72 - --container-name
73 - aai-schema-service
74 env:
75 - name: NAMESPACE
76 valueFrom:
77 fieldRef:
78 apiVersion: v1
79 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010080 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010081 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82 name: {{ include "common.name" . }}-readiness
83 - command:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010084 - sh
85 args:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010086 - -c
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010087 - |
88 bash docker-entrypoint.sh dataRestoreFromSnapshot.sh `ls -t /opt/app/aai-graphadmin/logs/data/dataSnapshots|head -1|awk -F".P" '{ print $1 }'`
Sylvain Desbureaux70070412020-11-09 21:58:48 +010089 env:
90 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010091 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010092 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010093 value: {{ .Values.securityContext.group_id | quote }}
efiacord12c1672023-03-23 12:10:50 +000094 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010095 - mountPath: /etc/localtime
96 name: localtime
97 readOnly: true
98 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010099 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100100 subPath: janusgraph-realtime.properties
101 - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100102 name: snapshots
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100103 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100104 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105 subPath: janusgraph-cached.properties
106 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100107 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100108 subPath: aaiconfig.properties
109 - mountPath: /opt/aai/logroot/AAI-GA
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100110 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100111 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100112 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100113 subPath: logback.xml
114 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100115 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100116 subPath: localhost-access-logback.xml
117 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100118 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100119 subPath: application.properties
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100120 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100121 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
122 name: {{ include "common.name" . }}-restore-backup
123 containers:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100124 - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100125 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
126 name: {{ include "common.name" . }}-perform-migration
127 command:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100128 - sh
129 args:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100130 - -c
osk1146127fd7d82021-06-18 00:51:17 +0200131 - |
Andreas Geissler8624d222022-05-13 17:16:41 +0200132 {{- if include "common.onServiceMesh" . }}
133 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
osk1146127fd7d82021-06-18 00:51:17 +0200134 bash docker-entrypoint.sh run_Migrations.sh -e UpdateAaiUriIndexMigration --commit --skipPreMigrationSnapShot --runDisabled RebuildAllEdges ;
othman touijer51176672021-12-01 16:21:18 +0100135 {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100136 env:
137 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100138 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100139 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100140 value: {{ .Values.securityContext.group_id | quote }}
efiacord12c1672023-03-23 12:10:50 +0000141 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100142 - mountPath: /etc/localtime
143 name: localtime
144 readOnly: true
145 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100146 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100147 subPath: janusgraph-realtime.properties
148 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100149 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100150 subPath: janusgraph-cached.properties
151 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100152 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100153 subPath: aaiconfig.properties
154 - mountPath: /opt/aai/logroot/AAI-GA
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100155 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100156 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100157 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100158 subPath: logback.xml
159 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100160 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100161 subPath: localhost-access-logback.xml
162 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100163 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100164 subPath: application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100165 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100166 {{- if .Values.nodeSelector }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100167 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100168 {{- end }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100169 {{- if .Values.affinity }}
170 affinity: {{ toYaml .Values.affinity | nindent 8 }}
171 {{- end }}
efiacord12c1672023-03-23 12:10:50 +0000172 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100173 - name: localtime
174 hostPath:
175 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200176 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100177 - name: {{ include "common.fullname" . }}-logs
178 emptyDir: {}
179 - name: {{ include "common.fullname" . }}-config
180 configMap:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100181 name: {{ include "common.fullname" . }}-configmap
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100182 - name: {{ include "common.fullname" . }}-snapshots
183 persistentVolumeClaim:
184 claimName: {{ include "common.fullname" . }}-migration
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100185 - name: properties
othman touijer51176672021-12-01 16:21:18 +0100186 configMap:
187 name: {{ include "common.fullname" . }}-properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100188 restartPolicy: Never
189 imagePullSecrets:
190 - name: "{{ include "common.namespace" . }}-docker-registry-key"
191---
192apiVersion: batch/v1
193kind: Job
194metadata:
195 name: {{ include "common.fullname" . }}-db-backup-job
196 namespace: {{ include "common.namespace" . }}
197 labels:
198 app: {{ include "common.name" . }}-db-backup-job
199 release: {{ include "common.release" . }}
200 heritage: {{ .Release.Service }}
201 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
202 annotations:
203 "helm.sh/hook": pre-upgrade,pre-install
204 "helm.sh/hook-weight": "2"
205 "helm.sh/hook-delete-policy": before-hook-creation
206spec:
207 backoffLimit: 20
208 template:
209 metadata:
210 labels:
211 app: {{ include "common.name" . }}-db-backup-job
212 release: {{ include "common.release" . }}
213 name: {{ include "common.name" . }}
214 spec:
efiacord12c1672023-03-23 12:10:50 +0000215 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100216 {{ if eq .Values.global.jobs.migration.remoteCassandra.enabled false }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100217 - command:
218 - /bin/bash
219 - -c
220 - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra
221 env:
222 - name: NAMESPACE
223 valueFrom:
224 fieldRef:
225 apiVersion: v1
226 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100227 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100228 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
229 name: {{ include "common.name" . }}-db-backup-readiness
230 {{- end }}
231 containers:
232 - name: {{ include "common.name" . }}-db-backup-job
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100233 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100234 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
235 command:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100236 - sh
237 args:
osk1146127fd7d82021-06-18 00:51:17 +0200238 - -c
239 - |
Andreas Geissler8624d222022-05-13 17:16:41 +0200240 {{- if include "common.onServiceMesh" . }}
241 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100242 bash docker-entrypoint.sh dataSnapshot.sh
othman touijer51176672021-12-01 16:21:18 +0100243 {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100244 env:
245 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100246 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100247 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100248 value: {{ .Values.securityContext.group_id | quote }}
efiacord12c1672023-03-23 12:10:50 +0000249 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100250 - mountPath: /etc/localtime
251 name: localtime
252 readOnly: true
253 - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100254 name: snapshots
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100255 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100256 name: migration
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100257 subPath: janusgraph-migration-real.properties
258 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100259 name: migration
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100260 subPath: janusgraph-migration-cached.properties
261 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100262 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100263 subPath: aaiconfig.properties
264 - mountPath: /opt/aai/logroot/AAI-RES/
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100265 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100266 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100267 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100268 subPath: logback.xml
269 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100270 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100271 subPath: localhost-access-logback.xml
272 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100273 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100274 subPath: application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100275 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100276 {{- if .Values.nodeSelector }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100277 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100278 {{- end }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100279 {{- if .Values.affinity }}
280 affinity: {{ toYaml .Values.affinity | nindent 8 }}
281 {{- end }}
282 volumes: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100283 - name: localtime
284 hostPath:
285 path: /etc/localtime
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100286 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100287 emptyDir: {}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100288 - name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100289 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100290 name: {{ include "common.fullname" . }}
291 - name: properties-input
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100292 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100293 name: {{ include "common.fullname" . }}-properties
294 - name: properties
295 emptyDir:
296 medium: Memory
297 - name: migration
298 configMap:
299 name: {{ include "common.fullname" . }}-migration
300 - name: snapshots
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100301 persistentVolumeClaim:
302 claimName: {{ include "common.fullname" . }}-migration
303 restartPolicy: Never
304 imagePullSecrets:
305 - name: "{{ include "common.namespace" . }}-docker-registry-key"
306{{ end }}