refine restore script

This commit is contained in:
Aaron Riedel 2023-08-27 23:59:16 +02:00
parent 1820c9888d
commit 9f2c417164
Signed by: aaron
GPG key ID: 643004654D40D577

View file

@ -34,7 +34,7 @@ echo "Waiting for $pod_name_pattern pods to be created in namespace $namespace..
# Wait loop to check pod creation # Wait loop to check pod creation
elapsed_time=0 elapsed_time=0
while [ $elapsed_time -lt $wait_timeout ]; do 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 if [ -n "$pod_names" ]; then
break break
@ -49,8 +49,9 @@ if [ -z "$pod_names" ]; then
exit 1 exit 1
fi 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 # Delete Longhorn Instance Pods
@ -83,4 +84,4 @@ while :; do
fi fi
done done
echo "Restore everything else" 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