From 9b6f5b267fedcf47b771b2af4db75ab3198c92ae Mon Sep 17 00:00:00 2001 From: "Parsons, Cliff (cp769u)" Date: Wed, 20 May 2020 16:06:46 +0000 Subject: [PATCH] Add backup/restore configuration secret This patchset adds a secret containing the backup/restore configuration for Postgresql, in case it is needed for invoking a backup/restore operation from a different application or from a different namespace (like from a utility container). Default is to not produce the secret. Change-Id: I273fe169e7ee533c3fe04ad33c97af64b29bc16f --- .../templates/secret-backup-restore.yaml | 27 +++++++++++++++++++ postgresql/values.yaml | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 postgresql/templates/secret-backup-restore.yaml diff --git a/postgresql/templates/secret-backup-restore.yaml b/postgresql/templates/secret-backup-restore.yaml new file mode 100644 index 0000000000..adb5b88d16 --- /dev/null +++ b/postgresql/templates/secret-backup-restore.yaml @@ -0,0 +1,27 @@ +{{/* +This manifest results a secret being created which has the key information +needed for backing up and restoring the Postgresql databases. +*/}} + +{{- if and .Values.conf.backup.enabled .Values.manifests.secret_backup_restore }} + +{{- $envAll := . }} +{{- $userClass := "backup_restore" }} +{{- $secretName := index $envAll.Values.secrets.postgresql $userClass }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} +type: Opaque +data: + BACKUP_ENABLED: {{ $envAll.Values.conf.backup.enabled | b64enc }} + BACKUP_BASE_PATH: {{ $envAll.Values.conf.backup.base_path | b64enc }} + LOCAL_DAYS_TO_KEEP: {{ $envAll.Values.conf.backup.days_to_keep | quote | b64enc }} + PG_DUMPALL_OPTIONS: {{ $envAll.Values.conf.backup.pg_dumpall_options | b64enc }} + REMOTE_BACKUP_ENABLED: {{ $envAll.Values.conf.backup.remote_backup.enabled | b64enc }} + REMOTE_BACKUP_CONTAINER: {{ $envAll.Values.conf.backup.remote_backup.container_name | b64enc }} + REMOTE_BACKUP_DAYS_TO_KEEP: {{ $envAll.Values.conf.backup.remote_backup.days_to_keep | quote | b64enc }} + REMOTE_BACKUP_STORAGE_POLICY: {{ $envAll.Values.conf.backup.remote_backup.storage_policy | b64enc }} +... +{{- end }} diff --git a/postgresql/values.yaml b/postgresql/values.yaml index 892adf594a..49b3139e01 100644 --- a/postgresql/values.yaml +++ b/postgresql/values.yaml @@ -419,6 +419,7 @@ secrets: server: postgresql-server-pki exporter: postgresql-exporter audit: postgresql-audit + backup_restore: postgresql-backup-restore identity: admin: keystone-admin-user postgresql: postgresql-backup-user @@ -532,6 +533,7 @@ manifests: secret_server: true secret_etc: true secret_audit: true + secret_backup_restore: false service: true statefulset: true cron_job_postgresql_backup: false