From 9f2c4171649a05b02155f5c5ba5869972aa4d8f9 Mon Sep 17 00:00:00 2001 From: Aaron Riedel Date: Sun, 27 Aug 2023 23:59:16 +0200 Subject: [PATCH] refine restore script --- velero/restore.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/velero/restore.sh b/velero/restore.sh index af21f50..678de6f 100755 --- a/velero/restore.sh +++ b/velero/restore.sh @@ -34,7 +34,7 @@ echo "Waiting for $pod_name_pattern pods to be created in namespace $namespace.. # Wait loop to check pod creation elapsed_time=0 while [ $elapsed_time -lt $wait_timeout ]; do - pod_names=$(kubectl get pods -n "$namespace" --output=jsonpath='{.items[*].metadata.name}' | grep -E "^$pod_name_pattern") + pod_names=$(kubectl get pods -n "$namespace" --output=jsonpath='{.items[*].metadata.name}' | grep -E "$pod_name_pattern") if [ -n "$pod_names" ]; then break @@ -49,8 +49,9 @@ if [ -z "$pod_names" ]; then exit 1 fi -echo "$pod_name_pattern pods detected. Proceeding with deletion..." +echo "$pod_name_pattern pods detected. Proceeding with deletion in 10s..." +sleep 10 ###### # Delete Longhorn Instance Pods @@ -83,4 +84,4 @@ while :; do fi done echo "Restore everything else" -velero restore create --from-backup $BACKUPNAME --exclude-resources persistentvolumes,persistentvolumeclaims restore-part-3 || exit 1 +velero restore create --from-backup "$BACKUPNAME" --exclude-resources persistentvolumes,persistentvolumeclaims restore-part-3 || exit 1