diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index 3462679..a7fa353 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -3413,6 +3413,10 @@ EOF local snapshot_resource="${snapshot_ref#*/}" namespace="${pvc_ref%%/*}" pvc="${pvc_ref#*/}" + if [[ "${snapshot_namespace}" != "${namespace}" ]]; then + echo "Snapshot and restored PVC must be in the same namespace (${snapshot_namespace} != ${namespace})." >&2 + return 1 + fi kubectl --kubeconfig "${kubeconfig}" -n "${snapshot_namespace}" get volumesnapshot "${snapshot_resource}" >/dev/null if [[ "$(kubectl --kubeconfig "${kubeconfig}" -n "${snapshot_namespace}" get volumesnapshot "${snapshot_resource}" -o jsonpath='{.status.readyToUse}' 2>/dev/null)" != "true" ]]; then echo "VolumeSnapshot ${snapshot_namespace}/${snapshot_resource} is not ready to use." >&2