🩹 postgres-external-backup hook

This commit is contained in:
auricom
2022-12-02 22:53:36 +01:00
parent 06d31b264c
commit 6ebfa7f056
3 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -e
# Possible actions: error, pre-backup, post-backup
ACTION="$1"
if [ "$WEBHOOK_URL" != "**None**" ]; then
case "$ACTION" in
"error")
echo "Execute error webhook call to $WEBHOOK_URL"
curl --url "$WEBHOOK_URL" \
--header 'Content-Type: application/json' \
--max-time 10 \
--retry 5 \
$WEBHOOK_EXTRA_ARGS
;;
# "pre-backup")
# echo "Nothing to do"
# ;;
"post-backup")
echo "Execute post-backup webhook call to $WEBHOOK_URL"
curl --url "$WEBHOOK_URL" \
--header 'Content-Type: application/json' \
--max-time 10 \
--retry 5 \
$WEBHOOK_EXTRA_ARGS
;;
esac
fi

View File

@@ -75,8 +75,15 @@ spec:
volumeMounts:
- name: backups
mountPath: /backups
- name: files
subPath: 00-webhook
mountPath: /hooks/00-webhook
volumes:
- name: backups
nfs:
server: "${LOCAL_LAN_TRUENAS}"
path: /mnt/storage/backups/postgresql
- name: files
configMap:
name: postgres-external-backup
defaultMode: 0555

View File

@@ -2,3 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helm-release.yaml
configMapGenerator:
- name: postgres-external-backup
files:
- ./00-webhook
generatorOptions:
disableNameSuffixHash: true