Files
cozystack/examples/backups/redis/cleanup.sh
T
Andrey Kolkov 43b02bda30 test(e2e): run the Redis backup round-trip against Valkey
The Redis backup demo now takes APP_KIND=Valkey, which switches the app
kind and the chart prefix the helpers derive sentinel and Secret names
from. The demo BackupClass routes Valkey to the same demo strategy.

The valkey suite gains valkey-backup-roundtrip, which drives that demo
end to end: seed a marker, back it up, restore it in place and into a
copy. It writes to tenant-root's seaweedfs through seaweedfs-s3, so a
seaweedfs change now selects the valkey suite too, and since the
round-trip runs examples/backups/redis as its harness, an edit there
selects both the redis and the valkey suites. The reduced E2E install
keeps the backup stack for the valkey suite, as it does for the other
backup round-trip suites.

Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Assisted-By: LLM
2026-10-13 12:34:24 +04:00

31 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Cleanup: tear down everything provisioned by the demo so the cluster returns
# to its previous state. Idempotent — safe to run before a fresh round (a stale
# Succeeded BackupJob would otherwise falsely satisfy the wait).
# -e so a real API/permission failure aborts loudly instead of printing "Cleanup
# complete." over a half-torn-down demo; every delete below is
# --ignore-not-found, so an already-gone resource is not an error.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/00-helpers.sh"
print_header "Cleanup Redis backup demo"
kubectl -n "$NAMESPACE" delete restorejob "$RESTOREJOB_TOCOPY_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete restorejob "$RESTOREJOB_INPLACE_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete backupjob "$BACKUPJOB_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete backup "$BACKUPJOB_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete "$APP_RESOURCE" "$REDIS_RESTORE_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete "$APP_RESOURCE" "$REDIS_NAME" --ignore-not-found
# Demo-owned backups plumbing: the BackupClass and strategy CR are cluster-scoped
# (no -n). Deleting the Bucket releases its S3 objects and the projected keys.
kubectl delete backupclass "$BACKUPCLASS_NAME" --ignore-not-found
kubectl delete redis.strategy.backups.cozystack.io "$STRATEGY_NAME" --ignore-not-found
kubectl -n "$NAMESPACE" delete secret "$CREDS_SECRET" --ignore-not-found
kubectl -n "$NAMESPACE" delete secret "$CA_SECRET" --ignore-not-found
kubectl -n "$NAMESPACE" delete bucket "$BUCKET_NAME" --ignore-not-found
log_success "Cleanup complete."