apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-backup-hook-config-map
  annotations:
    rollme: {{ randAlphaNum 5 | quote }}
data:
  entrypoint.sh: |-
    #!/bin/sh
    cmd="/docker-entrypoint.sh postgres"
    eval "${cmd}" & disown;
    until pg_isready -U "$POSTGRES_USER" -h "$pgHost"; do
      sleep 5;
    done;
    pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" -h "$pgHost" -f /postgres_backups/$BACKUP_NAME.sql;
