Skip to content

Commit e2bf48b

Browse files
backup only awf db
1 parent 7faa531 commit e2bf48b

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

charts/workflows-cluster/templates/postgres-backup-cronjob.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ spec:
1717
initContainers:
1818
- name: create-backup
1919
image: docker.io/postgres
20-
command: ["pg_dumpall"]
20+
command: ["pg_dump"]
2121
args:
22+
- -h
23+
- $(PGHOST)
24+
- -U
25+
- $(PGUSER)
26+
- -d
27+
- $(DB)
2228
- --clean
2329
- --if-exists
2430
- --no-password
@@ -27,18 +33,19 @@ spec:
2733
- name: PGPASSWORD
2834
valueFrom:
2935
secretKeyRef:
30-
name: postgres-passwords-x-workflows-x-workflows-cluster
36+
name: postgres-argo-workflows-password
3137
key: password
3238
- name: PGHOST
3339
value: workflows-postgresql-ha-pgpool-x-workflows-x-workflows-cluster
3440
- name: PGUSER
35-
value: postgres
41+
valueFrom:
42+
secretKeyRef:
43+
name: postgres-argo-workflows-password
44+
key: username
3645
- name: DB
37-
value: argo-workflows
46+
value: argo_workflows
3847
- name: PGPORT
3948
value: "5432"
40-
- name: PGDUMP_DIR
41-
value: {{ $.Values.backup.postgres.snapshotDir | quote }}
4249
volumeMounts:
4350
- mountPath: {{ $.Values.backup.postgres.snapshotDir | quote }}
4451
name: backup

charts/workflows-cluster/templates/postgres-restore-cronjob.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,27 @@ spec:
4646
command: ["/bin/sh", "-c"]
4747
args:
4848
- |
49-
for host in \
50-
workflows-postgresql-ha-postgresql-0.workflows.svc.cluster.local \
51-
workflows-postgresql-ha-postgresql-1.workflows.svc.cluster.local \
52-
workflows-postgresql-ha-postgresql-2.workflows.svc.cluster.local
53-
do
54-
if PGPASSWORD="$PGPASSWORD" psql -h "$host" -U postgres -tAc "SELECT NOT pg_is_in_recovery()" | grep -q t; then
55-
PRIMARY="$host"
56-
echo "Primary found: $PRIMARY"
57-
break
58-
fi
59-
done
49+
host="workflows-postgresql-ha-postgresql-1.workflows-postgresql-ha-postgresql-headless"
50+
if PGPASSWORD="$PGPASSWORD" psql -h "$host" -U postgres -tAc "SELECT NOT pg_is_in_recovery()" | grep -q t; then
51+
PRIMARY="$host"
52+
echo "Primary verified: $PRIMARY"
53+
break
54+
fi
55+
sleep infinity
6056
# psql -h "$PRIMARY" -f /snapshot/snapshot.pgdump
6157
env:
6258
- name: PGPASSWORD
6359
valueFrom:
6460
secretKeyRef:
65-
name: postgres-passwords
61+
name: postgres-argo-workflows-password
6662
key: password
6763
- name: PGUSER
68-
value: argo-workflows
64+
valueFrom:
65+
secretKeyRef:
66+
name: postgres-argo-workflows-password
67+
key: username
6968
- name: DB
70-
value: argo-workflows
69+
value: argo_workflows
7170
- name: PGPORT
7271
value: "5432"
7372
volumeMounts:

0 commit comments

Comments
 (0)