Jakub Latusek | 0ef8231 | 2020-10-21 13:36:30 +0200 | [diff] [blame] | 1 | {{/* |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 2 | # Copyright © 2017 Amdocs, Bell Canada |
Andreas Geissler | 7479042 | 2023-02-27 10:31:01 +0100 | [diff] [blame] | 3 | # Modifications © 2023 Deutsche Telekom |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 4 | # |
| 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 Latusek | 0ef8231 | 2020-10-21 13:36:30 +0200 | [diff] [blame] | 16 | */}} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 17 | |
| 18 | apiVersion: batch/v1 |
| 19 | kind: Job |
| 20 | metadata: |
| 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 Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 26 | release: {{ include "common.release" . }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 27 | heritage: {{ .Release.Service }} |
| 28 | spec: |
| 29 | backoffLimit: 20 |
| 30 | template: |
| 31 | metadata: |
| 32 | labels: |
| 33 | app: {{ include "common.name" . }}-job |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 34 | release: {{ include "common.release" . }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 35 | spec: |
| 36 | restartPolicy: Never |
| 37 | initContainers: |
| 38 | - command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 39 | - /app/ready.py |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 40 | 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 Desbureaux | 50f9c5d | 2020-11-19 17:25:17 +0100 | [diff] [blame] | 49 | image: {{ include "repositoryGenerator.image.readiness" . }} |
dkamdocs | 6ad3a1c | 2018-12-21 09:25:53 +0000 | [diff] [blame] | 50 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy}} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 51 | name: {{ include "common.name" . }}-readiness |
| 52 | containers: |
| 53 | - name: {{ include "common.name" . }}-job |
Sylvain Desbureaux | 50f9c5d | 2020-11-19 17:25:17 +0100 | [diff] [blame] | 54 | image: {{ include "repositoryGenerator.image.postgres" . }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 55 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 56 | env: |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 57 | - name: PGUSER |
| 58 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 59 | - name: PGPASSWORD |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 60 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 61 | command: |
| 62 | - /bin/sh |
| 63 | - -c |
| 64 | - | |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 65 | psql -h $(VNFSDK_DBPRI_SERVICE_HOST) -f /aaa/init/marketplace_tables_postgres.sql |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 66 | volumeMounts: |
| 67 | - name: init-data |
| 68 | mountPath: /aaa/init/marketplace_tables_postgres.sql |
| 69 | subPath: marketplace_tables_postgres.sql |
Andreas Geissler | 7479042 | 2023-02-27 10:31:01 +0100 | [diff] [blame] | 70 | {{ include "common.waitForJobContainer" . | indent 6 | trim }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 71 | imagePullSecrets: |
| 72 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 73 | volumes: |
| 74 | - name: init-data |
| 75 | configMap: |
| 76 | name: {{ include "common.fullname" . }} |