From b6ef62f3f2823f1ab4ceadb4aab31b6e6e60634c Mon Sep 17 00:00:00 2001 From: Saurov Chandra Biswas <48715910+souravbiswassanto@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:35:03 +0600 Subject: [PATCH] Add postgres 17.2 version support for stash (#383) Signed-off-by: souravbiswassanto Signed-off-by: Tamal Saha Co-authored-by: Tamal Saha --- catalog/copy-images.sh | 1 + catalog/export-images.sh | 1 + catalog/imagelist.yaml | 1 + catalog/import-images.sh | 1 + catalog/import-into-k3s.sh | 1 + .../17.2/postgres-backup-function.yaml | 39 ++++++++++++++++ .../postgres/17.2/postgres-backup-task.yaml | 14 ++++++ .../17.2/postgres-restore-function.yaml | 30 +++++++++++++ .../postgres/17.2/postgres-restore-task.yaml | 14 ++++++ .../17.2/postgres-backup-function.yaml | 44 +++++++++++++++++++ .../postgres/17.2/postgres-backup-task.yaml | 18 ++++++++ .../17.2/postgres-restore-function.yaml | 35 +++++++++++++++ .../postgres/17.2/postgres-restore-task.yaml | 18 ++++++++ 13 files changed, 217 insertions(+) create mode 100644 catalog/raw/postgres/17.2/postgres-backup-function.yaml create mode 100644 catalog/raw/postgres/17.2/postgres-backup-task.yaml create mode 100644 catalog/raw/postgres/17.2/postgres-restore-function.yaml create mode 100644 catalog/raw/postgres/17.2/postgres-restore-task.yaml create mode 100644 charts/stash-catalog/templates/postgres/17.2/postgres-backup-function.yaml create mode 100644 charts/stash-catalog/templates/postgres/17.2/postgres-backup-task.yaml create mode 100644 charts/stash-catalog/templates/postgres/17.2/postgres-restore-function.yaml create mode 100644 charts/stash-catalog/templates/postgres/17.2/postgres-restore-task.yaml diff --git a/catalog/copy-images.sh b/catalog/copy-images.sh index efc1c3b2..976e4054 100755 --- a/catalog/copy-images.sh +++ b/catalog/copy-images.sh @@ -80,6 +80,7 @@ $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-post $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:14.0-v21 $IMAGE_REGISTRY/stashed/stash-postgres:14.0-v21 $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:15.1-v13 $IMAGE_REGISTRY/stashed/stash-postgres:15.1-v13 $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:16.1-v2 $IMAGE_REGISTRY/stashed/stash-postgres:16.1-v2 +$CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:17.2 $IMAGE_REGISTRY/stashed/stash-postgres:17.2 $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:9.6.19-v32 $IMAGE_REGISTRY/stashed/stash-postgres:9.6.19-v32 $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-redis:5.0.13-v21 $IMAGE_REGISTRY/stashed/stash-redis:5.0.13-v21 $CMD cp --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-redis:6.2.5-v21 $IMAGE_REGISTRY/stashed/stash-redis:6.2.5-v21 diff --git a/catalog/export-images.sh b/catalog/export-images.sh index 11d93322..d7ca50c3 100755 --- a/catalog/export-images.sh +++ b/catalog/export-images.sh @@ -77,6 +77,7 @@ $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-po $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:14.0-v21 images/stashed-stash-postgres-14.0-v21.tar $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:15.1-v13 images/stashed-stash-postgres-15.1-v13.tar $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:16.1-v2 images/stashed-stash-postgres-16.1-v2.tar +$CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:17.2 images/stashed-stash-postgres-17.2.tar $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-postgres:9.6.19-v32 images/stashed-stash-postgres-9.6.19-v32.tar $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-redis:5.0.13-v21 images/stashed-stash-redis-5.0.13-v21.tar $CMD pull --allow-nondistributable-artifacts --insecure ghcr.io/stashed/stash-redis:6.2.5-v21 images/stashed-stash-redis-6.2.5-v21.tar diff --git a/catalog/imagelist.yaml b/catalog/imagelist.yaml index 341b3e16..b40fa537 100644 --- a/catalog/imagelist.yaml +++ b/catalog/imagelist.yaml @@ -43,6 +43,7 @@ - ghcr.io/stashed/stash-postgres:14.0-v21 - ghcr.io/stashed/stash-postgres:15.1-v13 - ghcr.io/stashed/stash-postgres:16.1-v2 +- ghcr.io/stashed/stash-postgres:17.2 - ghcr.io/stashed/stash-postgres:9.6.19-v32 - ghcr.io/stashed/stash-redis:5.0.13-v21 - ghcr.io/stashed/stash-redis:6.2.5-v21 diff --git a/catalog/import-images.sh b/catalog/import-images.sh index 62817152..e4a732db 100755 --- a/catalog/import-images.sh +++ b/catalog/import-images.sh @@ -71,6 +71,7 @@ $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-pos $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-postgres-14.0-v21.tar $IMAGE_REGISTRY/stashed/stash-postgres:14.0-v21 $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-postgres-15.1-v13.tar $IMAGE_REGISTRY/stashed/stash-postgres:15.1-v13 $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-postgres-16.1-v2.tar $IMAGE_REGISTRY/stashed/stash-postgres:16.1-v2 +$CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-postgres-17.2.tar $IMAGE_REGISTRY/stashed/stash-postgres:17.2 $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-postgres-9.6.19-v32.tar $IMAGE_REGISTRY/stashed/stash-postgres:9.6.19-v32 $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-redis-5.0.13-v21.tar $IMAGE_REGISTRY/stashed/stash-redis:5.0.13-v21 $CMD push --allow-nondistributable-artifacts --insecure images/stashed-stash-redis-6.2.5-v21.tar $IMAGE_REGISTRY/stashed/stash-redis:6.2.5-v21 diff --git a/catalog/import-into-k3s.sh b/catalog/import-into-k3s.sh index fadbbdba..ee6faff4 100755 --- a/catalog/import-into-k3s.sh +++ b/catalog/import-into-k3s.sh @@ -69,6 +69,7 @@ k3s ctr images import images/stashed-stash-postgres-13.1-v29.tar k3s ctr images import images/stashed-stash-postgres-14.0-v21.tar k3s ctr images import images/stashed-stash-postgres-15.1-v13.tar k3s ctr images import images/stashed-stash-postgres-16.1-v2.tar +k3s ctr images import images/stashed-stash-postgres-17.2.tar k3s ctr images import images/stashed-stash-postgres-9.6.19-v32.tar k3s ctr images import images/stashed-stash-redis-5.0.13-v21.tar k3s ctr images import images/stashed-stash-redis-6.2.5-v21.tar diff --git a/catalog/raw/postgres/17.2/postgres-backup-function.yaml b/catalog/raw/postgres/17.2/postgres-backup-function.yaml new file mode 100644 index 00000000..0aa16b06 --- /dev/null +++ b/catalog/raw/postgres/17.2/postgres-backup-function.yaml @@ -0,0 +1,39 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: Function +metadata: + name: postgres-backup-17.2 +spec: + args: + - backup-pg + - --provider=${REPOSITORY_PROVIDER:=} + - --bucket=${REPOSITORY_BUCKET:=} + - --endpoint=${REPOSITORY_ENDPOINT:=} + - --insecure-tls=${REPOSITORY_INSECURE_TLS:=} + - --region=${REPOSITORY_REGION:=} + - --path=${REPOSITORY_PREFIX:=} + - --storage-secret-name=${REPOSITORY_SECRET_NAME:=} + - --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=} + - --scratch-dir=/stash-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:=} + - --appbinding-namespace=${TARGET_NAMESPACE:=} + - --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:=} + - --user=${user:=} + image: ghcr.io/stashed/stash-postgres:17.2 diff --git a/catalog/raw/postgres/17.2/postgres-backup-task.yaml b/catalog/raw/postgres/17.2/postgres-backup-task.yaml new file mode 100644 index 00000000..5e51cc41 --- /dev/null +++ b/catalog/raw/postgres/17.2/postgres-backup-task.yaml @@ -0,0 +1,14 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: Task +metadata: + name: postgres-backup-17.2 +spec: + steps: + - name: postgres-backup-17.2 + params: + - name: outputDir + value: /stash-tmp/output + - name: update-status + params: + - name: outputDir + value: /stash-tmp/output diff --git a/catalog/raw/postgres/17.2/postgres-restore-function.yaml b/catalog/raw/postgres/17.2/postgres-restore-function.yaml new file mode 100644 index 00000000..f1782429 --- /dev/null +++ b/catalog/raw/postgres/17.2/postgres-restore-function.yaml @@ -0,0 +1,30 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: Function +metadata: + name: postgres-restore-17.2 +spec: + args: + - restore-pg + - --provider=${REPOSITORY_PROVIDER:=} + - --bucket=${REPOSITORY_BUCKET:=} + - --endpoint=${REPOSITORY_ENDPOINT:=} + - --insecure-tls=${REPOSITORY_INSECURE_TLS:=} + - --region=${REPOSITORY_REGION:=} + - --path=${REPOSITORY_PREFIX:=} + - --storage-secret-name=${REPOSITORY_SECRET_NAME:=} + - --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=} + - --scratch-dir=/stash-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:=} + - --appbinding-namespace=${TARGET_NAMESPACE:=} + - --snapshot=${RESTORE_SNAPSHOTS:=} + - --output-dir=${outputDir:=} + - --license-apiservice=${LICENSE_APISERVICE:=} + - --user=${user:=} + image: ghcr.io/stashed/stash-postgres:17.2 diff --git a/catalog/raw/postgres/17.2/postgres-restore-task.yaml b/catalog/raw/postgres/17.2/postgres-restore-task.yaml new file mode 100644 index 00000000..99b4d25f --- /dev/null +++ b/catalog/raw/postgres/17.2/postgres-restore-task.yaml @@ -0,0 +1,14 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: Task +metadata: + name: postgres-restore-17.2 +spec: + steps: + - name: postgres-restore-17.2 + params: + - name: outputDir + value: /stash-tmp/output + - name: update-status + params: + - name: outputDir + value: /stash-tmp/output diff --git a/charts/stash-catalog/templates/postgres/17.2/postgres-backup-function.yaml b/charts/stash-catalog/templates/postgres/17.2/postgres-backup-function.yaml new file mode 100644 index 00000000..b651390a --- /dev/null +++ b/charts/stash-catalog/templates/postgres/17.2/postgres-backup-function.yaml @@ -0,0 +1,44 @@ +{{ if .Values.postgres.enabled }} +apiVersion: stash.appscode.com/v1beta1 +kind: Function +metadata: + name: 'postgres-backup-17.2' + labels: + {{- include "stash-catalog.labels" . | nindent 4 }} +spec: + args: + - backup-pg + - --provider=${REPOSITORY_PROVIDER:=} + - --bucket=${REPOSITORY_BUCKET:=} + - --endpoint=${REPOSITORY_ENDPOINT:=} + - --insecure-tls=${REPOSITORY_INSECURE_TLS:=} + - --region=${REPOSITORY_REGION:=} + - --path=${REPOSITORY_PREFIX:=} + - --storage-secret-name=${REPOSITORY_SECRET_NAME:=} + - --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=} + - --scratch-dir=/stash-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:=} + - --appbinding-namespace=${TARGET_NAMESPACE:=} + - --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:=} + - --user=${user:=} + image: '{{ include "catalog.registry" (merge (dict "_reg" "ghcr.io" "_repo" "stashed") + .Values) }}/stash-postgres:17.2' +{{ end }} diff --git a/charts/stash-catalog/templates/postgres/17.2/postgres-backup-task.yaml b/charts/stash-catalog/templates/postgres/17.2/postgres-backup-task.yaml new file mode 100644 index 00000000..5bc2b04b --- /dev/null +++ b/charts/stash-catalog/templates/postgres/17.2/postgres-backup-task.yaml @@ -0,0 +1,18 @@ +{{ if .Values.postgres.enabled }} +apiVersion: stash.appscode.com/v1beta1 +kind: Task +metadata: + name: 'postgres-backup-17.2' + labels: + {{- include "stash-catalog.labels" . | nindent 4 }} +spec: + steps: + - name: postgres-backup-17.2 + params: + - name: outputDir + value: /stash-tmp/output + - name: update-status + params: + - name: outputDir + value: /stash-tmp/output +{{ end }} diff --git a/charts/stash-catalog/templates/postgres/17.2/postgres-restore-function.yaml b/charts/stash-catalog/templates/postgres/17.2/postgres-restore-function.yaml new file mode 100644 index 00000000..af9e1d49 --- /dev/null +++ b/charts/stash-catalog/templates/postgres/17.2/postgres-restore-function.yaml @@ -0,0 +1,35 @@ +{{ if .Values.postgres.enabled }} +apiVersion: stash.appscode.com/v1beta1 +kind: Function +metadata: + name: 'postgres-restore-17.2' + labels: + {{- include "stash-catalog.labels" . | nindent 4 }} +spec: + args: + - restore-pg + - --provider=${REPOSITORY_PROVIDER:=} + - --bucket=${REPOSITORY_BUCKET:=} + - --endpoint=${REPOSITORY_ENDPOINT:=} + - --insecure-tls=${REPOSITORY_INSECURE_TLS:=} + - --region=${REPOSITORY_REGION:=} + - --path=${REPOSITORY_PREFIX:=} + - --storage-secret-name=${REPOSITORY_SECRET_NAME:=} + - --storage-secret-namespace=${REPOSITORY_SECRET_NAMESPACE:=} + - --scratch-dir=/stash-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:=} + - --appbinding-namespace=${TARGET_NAMESPACE:=} + - --snapshot=${RESTORE_SNAPSHOTS:=} + - --output-dir=${outputDir:=} + - --license-apiservice=${LICENSE_APISERVICE:=} + - --user=${user:=} + image: '{{ include "catalog.registry" (merge (dict "_reg" "ghcr.io" "_repo" "stashed") + .Values) }}/stash-postgres:17.2' +{{ end }} diff --git a/charts/stash-catalog/templates/postgres/17.2/postgres-restore-task.yaml b/charts/stash-catalog/templates/postgres/17.2/postgres-restore-task.yaml new file mode 100644 index 00000000..652ef7f1 --- /dev/null +++ b/charts/stash-catalog/templates/postgres/17.2/postgres-restore-task.yaml @@ -0,0 +1,18 @@ +{{ if .Values.postgres.enabled }} +apiVersion: stash.appscode.com/v1beta1 +kind: Task +metadata: + name: 'postgres-restore-17.2' + labels: + {{- include "stash-catalog.labels" . | nindent 4 }} +spec: + steps: + - name: postgres-restore-17.2 + params: + - name: outputDir + value: /stash-tmp/output + - name: update-status + params: + - name: outputDir + value: /stash-tmp/output +{{ end }}