Skip to content

Commit

Permalink
Add Backup and Restore support for Postgres v14.0 (#205)
Browse files Browse the repository at this point in the history
Signed-off-by: Emon46 <emon@appscode.com>
  • Loading branch information
Emon46 authored Oct 7, 2021
1 parent 9ffc6aa commit 48c528c
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 1 deletion.
3 changes: 2 additions & 1 deletion catalog/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"10.14-v10",
"11.9-v10",
"12.4-v10",
"13.1-v7"
"13.1-v7",
"14.0"
]
},
{
Expand Down
38 changes: 38 additions & 0 deletions catalog/raw/postgres/14.0/postgres-backup-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: postgres-backup-14.0
spec:
args:
- backup-pg
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --backup-cmd=${backupCMD:=pg_dumpall}
- --pg-args=${args:=}
- --wait-timeout=${waitTimeout:=300}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --backupsession=${BACKUP_SESSION:=}
- --retention-keep-last=${RETENTION_KEEP_LAST:=0}
- --retention-keep-hourly=${RETENTION_KEEP_HOURLY:=0}
- --retention-keep-daily=${RETENTION_KEEP_DAILY:=0}
- --retention-keep-weekly=${RETENTION_KEEP_WEEKLY:=0}
- --retention-keep-monthly=${RETENTION_KEEP_MONTHLY:=0}
- --retention-keep-yearly=${RETENTION_KEEP_YEARLY:=0}
- --retention-keep-tags=${RETENTION_KEEP_TAGS:=}
- --retention-prune=${RETENTION_PRUNE:=false}
- --retention-dry-run=${RETENTION_DRY_RUN:=false}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: stashed/stash-postgres:14.0
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
22 changes: 22 additions & 0 deletions catalog/raw/postgres/14.0/postgres-backup-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: postgres-backup-14.0
spec:
steps:
- name: postgres-backup-14.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
29 changes: 29 additions & 0 deletions catalog/raw/postgres/14.0/postgres-restore-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: postgres-restore-14.0
spec:
args:
- restore-pg
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --source-hostname=${SOURCE_HOSTNAME:=}
- --pg-args=${args:=}
- --wait-timeout=${waitTimeout:=300}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --snapshot=${RESTORE_SNAPSHOTS:=}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: stashed/stash-postgres:14.0
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
22 changes: 22 additions & 0 deletions catalog/raw/postgres/14.0/postgres-restore-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: postgres-restore-14.0
spec:
steps:
- name: postgres-restore-14.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ if .Values.postgres.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: 'postgres-backup-14.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
args:
- backup-pg
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --backup-cmd=${backupCMD:=pg_dumpall}
- --pg-args=${args:={{ .Values.postgres.backup.args }}}
- --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --backupsession=${BACKUP_SESSION:=}
- --retention-keep-last=${RETENTION_KEEP_LAST:=0}
- --retention-keep-hourly=${RETENTION_KEEP_HOURLY:=0}
- --retention-keep-daily=${RETENTION_KEEP_DAILY:=0}
- --retention-keep-weekly=${RETENTION_KEEP_WEEKLY:=0}
- --retention-keep-monthly=${RETENTION_KEEP_MONTHLY:=0}
- --retention-keep-yearly=${RETENTION_KEEP_YEARLY:=0}
- --retention-keep-tags=${RETENTION_KEEP_TAGS:=}
- --retention-prune=${RETENTION_PRUNE:=false}
- --retention-dry-run=${RETENTION_DRY_RUN:=false}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: '{{ include "catalog.registry" . }}/stash-postgres:14.0'
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ if .Values.postgres.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: 'postgres-backup-14.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
steps:
- name: postgres-backup-14.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ if .Values.postgres.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Function
metadata:
name: 'postgres-restore-14.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
args:
- restore-pg
- --provider=${REPOSITORY_PROVIDER:=}
- --bucket=${REPOSITORY_BUCKET:=}
- --endpoint=${REPOSITORY_ENDPOINT:=}
- --region=${REPOSITORY_REGION:=}
- --path=${REPOSITORY_PREFIX:=}
- --secret-dir=/etc/repository/secret
- --scratch-dir=/tmp
- --enable-cache=${ENABLE_CACHE:=true}
- --max-connections=${MAX_CONNECTIONS:=0}
- --hostname=${HOSTNAME:=}
- --source-hostname=${SOURCE_HOSTNAME:=}
- --pg-args=${args:={{ .Values.postgres.restore.args }}}
- --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}}
- --namespace=${NAMESPACE:=default}
- --appbinding=${TARGET_NAME:=}
- --snapshot=${RESTORE_SNAPSHOTS:=}
- --output-dir=${outputDir:=}
- --license-apiservice=${LICENSE_APISERVICE:=}
image: '{{ include "catalog.registry" . }}/stash-postgres:14.0'
volumeMounts:
- mountPath: /etc/repository/secret
name: ${secretVolume}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ if .Values.postgres.enabled }}
apiVersion: stash.appscode.com/v1beta1
kind: Task
metadata:
name: 'postgres-restore-14.0'
labels:
{{- include "stash-catalog.labels" . | nindent 4 }}
spec:
steps:
- name: postgres-restore-14.0
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
- name: update-status
params:
- name: outputDir
value: /tmp/output
- name: secretVolume
value: secret-volume
volumes:
- name: secret-volume
secret:
secretName: ${REPOSITORY_SECRET_NAME}
{{ end }}

0 comments on commit 48c528c

Please sign in to comment.