Skip to content

Commit

Permalink
add on-error annotation for velero hooks (#2319)
Browse files Browse the repository at this point in the history
Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ authored Dec 10, 2024
1 parent cd34284 commit c038c3e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ spec:
annotations:
backup.velero.io/backup-volumes: cs-db-backup
pre.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /cs-db/cs-db-backup/database; /cs-db/br_cs-db.sh backup <cs-db namespace>"]'
pre.hook.backup.velero.io/on-error: Fail
pre.hook.backup.velero.io/timeout: 300s
post.hook.restore.velero.io/command: '["sh", "-c", "/cs-db/br_cs-db.sh restore <cs-db namespace>"]'
post.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/wait-timeout: 300s
post.hook.restore.velero.io/exec-timeout: 300s
post.hook.restore.velero.io/timeout: 720s
Expand Down
3 changes: 3 additions & 0 deletions velero/schedule/keycloak/keycloak-backup-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ spec:
annotations:
backup.velero.io/backup-volumes: keycloak-backup
pre.hook.backup.velero.io/command: '["sh", "-c", "/keycloak/br_keycloak.sh backup <keycloak namespace>"]'
pre.hook.backup.velero.io/on-error: Fail
pre.hook.backup.velero.io/timeout: 300s
post.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /keycloak/keycloak-backup/database && rm -rf /keycloak/keycloak-backup/secrets"]'
post.hook.backup.velero.io/on-error: Fail
post.hook.restore.velero.io/command: '["sh", "-c", "/keycloak/br_keycloak.sh restore <keycloak namespace>"]'
post.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/wait-timeout: 300s
post.hook.restore.velero.io/exec-timeout: 300s
post.hook.restore.velero.io/timeout: 720s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ spec:
annotations:
backup.velero.io/backup-volumes: lsr-backup
pre.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /lsr/lsr-backup/database; /lsr/br_lsr.sh <lsr namespace> backup"]'
pre.hook.backup.velero.io/on-error: Fail
pre.hook.backup.velero.io/timeout: 300s
post.hook.restore.velero.io/command: '["sh", "-c", "/lsr/br_lsr.sh <lsr namespace> restore"]'
post.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/wait-timeout: 300s
post.hook.restore.velero.io/exec-timeout: 300s
post.hook.restore.velero.io/timeout: 600s
Expand Down
2 changes: 2 additions & 0 deletions velero/schedule/mongodb-backup-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ spec:
annotations:
backup.velero.io/backup-volumes: mongodump
pre.hook.backup.velero.io/command: '["bash", "-c", "rm -rf /dump/dump/*; cat /cred/mongo-certs/tls.crt /cred/mongo-certs/tls.key > /work-dir/mongo.pem; cat /cred/cluster-ca/tls.crt /cred/cluster-ca/tls.key > /work-dir/ca.pem; mongodump --oplog --out /dump/dump --host mongodb:$MONGODB_SERVICE_PORT --username $ADMIN_USER --password $ADMIN_PASSWORD --authenticationDatabase admin --ssl --sslCAFile /work-dir/ca.pem --sslPEMKeyFile /work-dir/mongo.pem"]'
pre.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/command: '["bash", "-c", "cat /cred/mongo-certs/tls.crt /cred/mongo-certs/tls.key > /work-dir/mongo.pem; cat /cred/cluster-ca/tls.crt /cred/cluster-ca/tls.key > /work-dir/ca.pem; mongorestore --db platform-db --host rs0/icp-mongodb-0.icp-mongodb.<mongo namespace>.svc.cluster.local,icp-mongodb-1.icp-mongodb.<mongo namespace>.svc.cluster.local,icp-mongodb-2.icp-mongodb.<mongo namespace>.svc.cluster.local --port $MONGODB_SERVICE_PORT --username $ADMIN_USER --password $ADMIN_PASSWORD --authenticationDatabase admin --ssl --sslCAFile /work-dir/ca.pem --sslPEMKeyFile /work-dir/mongo.pem /dump/dump/platform-db --drop"]'
post.hook.restore.velero.io/on-error: Fail
name: mongodb-backup
namespace: <mongo namespace>
labels:
Expand Down
2 changes: 2 additions & 0 deletions velero/schedule/zen-backup-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ spec:
annotations:
backup.velero.io/backup-volumes: zendump
pre.hook.backup.velero.io/command: '["sh", "-c", "/zen4/zen4-br.sh <zenservice namespace> true"]'
pre.hook.backup.velero.io/on-error: Fail
pre.hook.backup.velero.io/timeout: 300s
post.hook.restore.velero.io/command: '["sh", "-c", "/zen4/zen4-br.sh <zenservice namespace> false"]'
post.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/wait-timeout: 300s
post.hook.restore.velero.io/exec-timeout: 300s
post.hook.restore.velero.io/timeout: 600s
Expand Down
2 changes: 2 additions & 0 deletions velero/schedule/zen5-backup-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ spec:
annotations:
backup.velero.io/backup-volumes: zen5-backup
pre.hook.backup.velero.io/command: '["sh", "-c", "rm -rf /zen5/zen-backup/database && rm -rf /zen5/zen-backup/objstorage && rm -rf /zen5/zen-backup/secrets && rm -rf /zen5/zen-backup/workspace; /zen5/backup_zen5.sh <zenservice namespace>"]'
pre.hook.backup.velero.io/on-error: Fail
pre.hook.backup.velero.io/timeout: 300s
post.hook.restore.velero.io/command: '["sh", "-c", "/zen5/restore_zen5.sh <zenservice namespace> <zenservice name>"]'
post.hook.restore.velero.io/on-error: Fail
post.hook.restore.velero.io/wait-timeout: 1000s
post.hook.restore.velero.io/exec-timeout: 1000s
post.hook.restore.velero.io/timeout: 1000s
Expand Down

0 comments on commit c038c3e

Please sign in to comment.