blob: 5e9ad8a6fce774acda9114cc5a9ff6996c9d4fc2 [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
52 containers:
53 - name: {{ include "common.name" . }}-job
Sylvain Desbureaux50f9c5d2020-11-19 17:25:17 +010054 image: {{ include "repositoryGenerator.image.postgres" . }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000055 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56 env:
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020057 - name: PGUSER
58 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000059 - name: PGPASSWORD
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020060 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000061 command:
62 - /bin/sh
63 - -c
64 - |
Krzysztof Opasiak79677d32020-05-05 01:42:23 +020065 psql -h $(VNFSDK_DBPRI_SERVICE_HOST) -f /aaa/init/marketplace_tables_postgres.sql
jasmineWenfb56f0f2018-08-29 15:55:28 +000066 volumeMounts:
67 - name: init-data
68 mountPath: /aaa/init/marketplace_tables_postgres.sql
69 subPath: marketplace_tables_postgres.sql
Andreas Geissler74790422023-02-27 10:31:01 +010070 {{ include "common.waitForJobContainer" . | indent 6 | trim }}
jasmineWenfb56f0f2018-08-29 15:55:28 +000071 imagePullSecrets:
72 - name: "{{ include "common.namespace" . }}-docker-registry-key"
73 volumes:
74 - name: init-data
75 configMap:
76 name: {{ include "common.fullname" . }}