blob: 88fbe4788ac2b8078c9f0bc4e383ee3aeece7cec [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002# Copyright (c) 2017-2018 AT&T
3# Modifications Copyright (c) 2018 Amdocs, Bell Canada
Sylvain Desbureaux5b651322020-12-07 15:34:15 +01004# Modifications Copyright (c) 2020 Nokia, Orange
efiacord12c1672023-03-23 12:10:50 +00005# Modifications Copyright © 2023 Nordix Foundation
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
20{{ if .Values.global.jobs.updateQueryData.enabled }}
21
22apiVersion: batch/v1
23kind: Job
24metadata:
25 name: {{ include "common.fullname" . }}-update-query-data
26 namespace: {{ include "common.namespace" . }}
27 labels:
28 app: {{ include "common.name" . }}
29 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
30 release: {{ include "common.release" . }}
31 heritage: {{ .Release.Service }}
32{{ if .Values.global.jobs.migration.enabled }}
33 annotations:
34 "helm.sh/hook": post-upgrade,post-rollback,post-install
35 "helm.sh/hook-weight": "2"
36 "helm.sh/hook-delete-policy": before-hook-creation
37{{ end }}
38spec:
39 template:
40 metadata:
41 labels:
42 app: {{ include "common.name" . }}-job
43 release: {{ include "common.release" . }}
44 name: {{ include "common.name" . }}
45 spec:
46 initContainers:
47 - command:
48 - /app/ready.py
49 args:
Andreas Geissleree119102024-04-11 13:53:39 +020050 - --service-name
Sylvain Desbureaux70070412020-11-09 21:58:48 +010051 - aai
Sylvain Desbureaux70070412020-11-09 21:58:48 +010052 env:
53 - name: NAMESPACE
54 valueFrom:
55 fieldRef:
56 apiVersion: v1
57 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010058 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010059 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +010061 resources:
62 limits:
63 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010064 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010065 requests:
66 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010067 memory: "20Mi"
Sylvain Desbureaux70070412020-11-09 21:58:48 +010068 containers:
69 - name: {{ include "common.name" . }}-job
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010070 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010071 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72 command:
73 - bash
74 - "-c"
75 - |
osk1146127fd7d82021-06-18 00:51:17 +020076 set -x
77 if [ ! -d /opt/aai/logroot/AAI-GQ/misc ]; then mkdir -p /opt/aai/logroot/AAI-GQ/misc; fi
osk1146127fd7d82021-06-18 00:51:17 +020078 until nc -w10 -z -v aai.{{.Release.Namespace}} 80; do echo "Retrying to reach aai on port 80"; done;
79 bash -x /opt/app/aai-traversal/docker-entrypoint.sh install/updateQueryData.sh ;
othman touijer51176672021-12-01 16:21:18 +010080 {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }}
efiacord12c1672023-03-23 12:10:50 +000081
Sylvain Desbureaux70070412020-11-09 21:58:48 +010082 env:
83 - name: LOCAL_USER_ID
84 value: {{ .Values.global.config.userId | quote }}
85 - name: LOCAL_GROUP_ID
86 value: {{ .Values.global.config.groupId | quote }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +010087 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010088 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010089 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
90 name: {{ include "common.fullname" . }}-config
91 subPath: janusgraph-realtime.properties
92 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties
93 name: {{ include "common.fullname" . }}-config
94 subPath: janusgraph-cached.properties
95 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
96 name: {{ include "common.fullname" . }}-config
97 subPath: aaiconfig.properties
98 - mountPath: /opt/aai/logroot/AAI-GQ/
99 name: {{ include "common.fullname" . }}-logs
100 - mountPath: /opt/aai/logroot/AAI-GQ/misc
101 name: {{ include "common.fullname" . }}-logs-misc
102 - mountPath: /opt/app/aai-traversal/resources/logback.xml
103 name: {{ include "common.fullname" . }}-config
104 subPath: logback.xml
105 - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml
106 name: {{ include "common.fullname" . }}-config
107 subPath: localhost-access-logback.xml
108 - mountPath: /opt/app/aai-traversal/resources/application.properties
109 name: {{ include "common.fullname" . }}-config
110 subPath: application.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100111 # disable liveness probe when breakpoints set in debugger
112 # so K8s doesn't restart unresponsive container
Andreas Geisslerceac2602023-07-17 18:55:54 +0200113 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100114 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100115 - name: {{ include "common.fullname" . }}-logs
116 emptyDir: {}
117 - name: {{ include "common.fullname" . }}-logs-misc
118 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200119 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100120 - name: {{ include "common.fullname" . }}-config
121 configMap:
Sylvain Desbureauxa41dfc02021-02-15 10:14:22 +0100122 name: {{ include "common.fullname" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100123 restartPolicy: OnFailure
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +0100124 {{- include "common.imagePullSecrets" . | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100125{{ end }}