Skip to content

Commit

Permalink
Fix backupcommand for builtin postgres DB
Browse files Browse the repository at this point in the history
* Switch to annotation on pod instead of on StS
* Add both `k8up.io` and `k8up.syn.tools` annotation to support k8up 2.0
* Add file-extention annotation
* Add `--clean` flag for a conistent restore
  • Loading branch information
glrf committed Dec 14, 2021
1 parent e172449 commit 828c3d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,11 @@ parameters:
registry: quay.io
# TODO: Rename master to primary when upgrading to Postgres 11 https://github.com/bitnami/charts/commit/7eabc85fd4fae43127228a22829c7ce3fe85c389
master:
annotations:
k8up.syn.tools/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER" PGPASSWORD="$POSTGRES_PASSWORD" pg_dump'
podAnnotations:
k8up.syn.tools/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER" PGPASSWORD="$POSTGRES_PASSWORD" pg_dump --clean'
k8up.syn.tools/file-extension: .sql
k8up.io/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER" PGPASSWORD="$POSTGRES_PASSWORD" pg_dump --clean'
k8up.io/file-extension: .sql
labels: ${keycloak:labels}
volumePermissions:
enabled: ${keycloak:database:tls:enabled}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
k8up.syn.tools/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER"
PGPASSWORD="$POSTGRES_PASSWORD" pg_dump'
annotations: null
labels:
app.kubernetes.io/component: keycloak
app.kubernetes.io/instance: builtin
Expand All @@ -21,6 +19,13 @@ spec:
serviceName: keycloak-postgresql-headless
template:
metadata:
annotations:
k8up.io/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER"
PGPASSWORD="$POSTGRES_PASSWORD" pg_dump --clean'
k8up.io/file-extension: .sql
k8up.syn.tools/backupcommand: sh -c 'PGDATABASE="$POSTGRES_DB" PGUSER="$POSTGRES_USER"
PGPASSWORD="$POSTGRES_PASSWORD" pg_dump --clean'
k8up.syn.tools/file-extension: .sql
labels:
app.kubernetes.io/instance: keycloak
app.kubernetes.io/managed-by: Helm
Expand Down

0 comments on commit 828c3d4

Please sign in to comment.