blob: ac40f095cb382a5a026d5df9462a41d728c9843f [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 and ( not .Values.global.jobs.migration.enabled ) ( .Values.global.jobs.createSchema.enabled ) }}
38apiVersion: batch/v1
39kind: Job
40metadata:
41 name: {{ include "common.fullname" . }}-create-db-schema
42 namespace: {{ include "common.namespace" . }}
43 labels:
44 app: {{ include "common.name" . }}-job
45 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
46 release: {{ include "common.release" . }}
47 heritage: {{ .Release.Service }}
48spec:
49 backoffLimit: 20
50 template:
51 metadata:
52 labels:
53 app: {{ include "common.name" . }}-job
54 release: {{ include "common.release" . }}
55 name: {{ include "common.name" . }}
56 spec:
efiacord12c1672023-03-23 12:10:50 +000057 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010058 - command:
59 - /app/ready.py
60 args:
Andreas Geisslercfd84342023-08-16 17:18:49 +020061 - --app-name
Sylvain Desbureaux70070412020-11-09 21:58:48 +010062 {{- if .Values.global.cassandra.localCluster }}
Andreas Geisslerb0530252023-11-10 11:28:49 +010063 - aai-cassandra
Sylvain Desbureaux70070412020-11-09 21:58:48 +010064 {{- else }}
Andreas Geisslerb0530252023-11-10 11:28:49 +010065 - cassandra
Sylvain Desbureaux70070412020-11-09 21:58:48 +010066 {{- end }}
67 - --container-name
68 - aai-schema-service
69 env:
70 - name: NAMESPACE
71 valueFrom:
72 fieldRef:
73 apiVersion: v1
74 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010075 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010076 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +010078 resources:
79 limits:
80 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010081 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010082 requests:
83 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010084 memory: "20Mi"
Sylvain Desbureaux70070412020-11-09 21:58:48 +010085 containers:
86 - name: {{ include "common.name" . }}-job
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 }}
89 command:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010090 - sh
91 args:
osk1146127fd7d82021-06-18 00:51:17 +020092 - -c
93 - |
Andreas Geissler8624d222022-05-13 17:16:41 +020094 {{- if include "common.onServiceMesh" . }}
95 echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
96 bash docker-entrypoint.sh createDBSchema.sh;
othman touijer51176672021-12-01 16:21:18 +010097 {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010098 env:
99 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100100 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100101 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100102 value: {{ .Values.securityContext.group_id | quote }}
efiacord12c1672023-03-23 12:10:50 +0000103 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100104 - mountPath: /etc/localtime
105 name: localtime
106 readOnly: true
107 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100108 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100109 subPath: janusgraph-realtime.properties
110 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100111 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 subPath: janusgraph-cached.properties
113 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100114 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100115 subPath: aaiconfig.properties
116 - mountPath: /opt/aai/logroot/AAI-GA
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100117 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100118 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100119 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100120 subPath: logback.xml
121 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100122 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100123 subPath: localhost-access-logback.xml
124 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100125 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100126 subPath: application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100127 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100128 {{- if .Values.nodeSelector }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100129 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100130 {{- end }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100131 {{- if .Values.affinity }}
132 affinity: {{ toYaml .Values.affinity | nindent 8 }}
133 {{- end }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200134 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacord12c1672023-03-23 12:10:50 +0000135 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100136 - name: localtime
137 hostPath:
138 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200139 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100140 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100141 emptyDir: {}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100142 - name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100143 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100144 name: {{ include "common.fullname" . }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100145 - name: properties
othman touijer51176672021-12-01 16:21:18 +0100146 configMap:
147 name: {{ include "common.fullname" . }}-properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100148 restartPolicy: Never
149 imagePullSecrets:
osk1146127fd7d82021-06-18 00:51:17 +0200150 - name: {{ include "common.namespace" . }}-docker-registry-key
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100151{{ end }}