blob: 7c09d976427fcb3558c4e1d1d4fd2c1aa9e56500 [file] [log] [blame]
Jakub Latusek0ef82312020-10-21 13:36:30 +02001{{/*
jasmineWenfb56f0f2018-08-29 15:55:28 +00002# Copyright © 2017 Amdocs, Bell Canada
Andreas Geissler74790422023-02-27 10:31:01 +01003# Modifications © 2023 Deutsche Telekom
jasmineWenfb56f0f2018-08-29 15:55:28 +00004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
Jakub Latusek0ef82312020-10-21 13:36:30 +020016*/}}
jasmineWenfb56f0f2018-08-29 15:55:28 +000017
18apiVersion: batch/v1
19kind: Job
20metadata:
21 name: {{ include "common.fullname" . }}-init-postgres
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}-job
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000027 heritage: {{ .Release.Service }}
28spec:
29 backoffLimit: 20
30 template:
31 metadata:
32 labels:
33 app: {{ include "common.name" . }}-job
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010034 release: {{ include "common.release" . }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000035 spec:
36 restartPolicy: Never
37 initContainers:
38 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020039 - /app/ready.py
jasmineWenfb56f0f2018-08-29 15:55:28 +000040 args:
41 - --container-name
42 - "{{ .Values.postgres.nameOverride }}"
43 env:
44 - name: NAMESPACE
45 valueFrom:
46 fieldRef:
47 apiVersion: v1
48 fieldPath: metadata.namespace
Sylvain Desbureaux50f9c5d2020-11-19 17:25:17 +010049 image: {{ include "repositoryGenerator.image.readiness" . }}
dkamdocs6ad3a1c2018-12-21 09:25:53 +000050 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy}}
jasmineWenfb56f0f2018-08-29 15:55:28 +000051 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +010052 resources:
53 limits:
54 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010055 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010056 requests:
57 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010058 memory: "20Mi"
jasmineWenfb56f0f2018-08-29 15:55:28 +000059 containers:
60 - name: {{ include "common.name" . }}-job
Sylvain Desbureaux50f9c5d2020-11-19 17:25:17 +010061 image: {{ include "repositoryGenerator.image.postgres" . }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000062 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63 env:
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020064 - name: PGUSER
65 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000066 - name: PGPASSWORD
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020067 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000068 command:
69 - /bin/sh
70 - -c
71 - |
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020072 psql -h $(VNFSDK_DBPRI_SERVICE_HOST) -f /aaa/init/marketplace_tables_postgres.sql
jasmineWenfb56f0f2018-08-29 15:55:28 +000073 volumeMounts:
74 - name: init-data
75 mountPath: /aaa/init/marketplace_tables_postgres.sql
76 subPath: marketplace_tables_postgres.sql
Andreas Geissler74790422023-02-27 10:31:01 +010077 {{ include "common.waitForJobContainer" . | indent 6 | trim }}
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +010078 {{- include "common.imagePullSecrets" . | nindent 6 }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000079 volumes:
80 - name: init-data
81 configMap:
82 name: {{ include "common.fullname" . }}