-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsetup-postgresql.yaml
More file actions
49 lines (48 loc) · 1.75 KB
/
Copy pathsetup-postgresql.yaml
File metadata and controls
49 lines (48 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
apiVersion: batch/v1
kind: Job
metadata:
name: setup-db-job
spec:
template:
spec:
initContainers:
# The postgres image does not contain curl or wget...
- name: download-dump
image: oci.stackable.tech/sdp/testing-tools:0.2.0-stackable25.7.0
command:
- bash
- -c
- |
kubectl rollout status --watch statefulset/postgresql-superset
cd /tmp
curl --fail -O https://raw.githubusercontent.com/stackabletech/demos/release-25.7/stacks/end-to-end-security/postgres_superset_dump.sql
# We need to omit changing the users password, as otherwise the content in the Secrets does not match
# the actual password in Postgres.
grep -vwE '(CREATE ROLE postgres;|CREATE ROLE superset;|ALTER ROLE postgres|ALTER ROLE superset)' postgres_superset_dump.sql > /dump/postgres_superset_dump.sql
volumeMounts:
- name: dump
mountPath: /dump/
containers:
- name: restore-postgres
image: docker.io/bitnamilegacy/postgresql:16.1.0-debian-11-r11 # Same image as the bitnami postgres helm-chart is using
command:
- bash
- -c
- |
echo "Preparing restore..."
psql --host postgresql-superset --user postgres < /dump/postgres_superset_dump.sql
env:
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: postgresql-superset
key: postgres-password
volumeMounts:
- name: dump
mountPath: /dump/
volumes:
- name: dump
emptyDir: {}
restartPolicy: OnFailure
backoffLimit: 20