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 |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 52 | resources: |
| 53 | limits: |
| 54 | cpu: "100m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 55 | memory: "500Mi" |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 56 | requests: |
| 57 | cpu: "3m" |
Andreas Geissler | 8cbb3d9 | 2024-03-12 16:44:56 +0100 | [diff] [blame] | 58 | memory: "20Mi" |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 59 | containers: |
| 60 | - name: {{ include "common.name" . }}-job |
Sylvain Desbureaux | 50f9c5d | 2020-11-19 17:25:17 +0100 | [diff] [blame] | 61 | image: {{ include "repositoryGenerator.image.postgres" . }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 62 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 63 | env: |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 64 | - name: PGUSER |
| 65 | {{- 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] | 66 | - name: PGPASSWORD |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 67 | {{- 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] | 68 | command: |
| 69 | - /bin/sh |
| 70 | - -c |
| 71 | - | |
Krzysztof Opasiak | 79677d3 | 2020-05-05 01:42:23 +0200 | [diff] [blame] | 72 | psql -h $(VNFSDK_DBPRI_SERVICE_HOST) -f /aaa/init/marketplace_tables_postgres.sql |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 73 | volumeMounts: |
| 74 | - name: init-data |
| 75 | mountPath: /aaa/init/marketplace_tables_postgres.sql |
| 76 | subPath: marketplace_tables_postgres.sql |
Andreas Geissler | 7479042 | 2023-02-27 10:31:01 +0100 | [diff] [blame] | 77 | {{ include "common.waitForJobContainer" . | indent 6 | trim }} |
Andreas Geissler | bd0d31a | 2024-03-20 09:51:32 +0100 | [diff] [blame] | 78 | {{- include "common.imagePullSecrets" . | nindent 6 }} |
jasmineWen | fb56f0f | 2018-08-29 15:55:28 +0000 | [diff] [blame] | 79 | volumes: |
| 80 | - name: init-data |
| 81 | configMap: |
| 82 | name: {{ include "common.fullname" . }} |