From 74a5bb0a0168f89c8eb76b0e252d775913c72d6b Mon Sep 17 00:00:00 2001 From: Gandalf the Greybeard Date: Fri, 20 Mar 2026 22:45:12 +0000 Subject: [PATCH] fix: teardown-e2e-headlamp.sh gracefully skips missing namespace When the headlamp-e2e namespace does not exist, teardown now exits early with a clear message instead of failing with a misleading RBAC error. Addresses PRI-443. Co-Authored-By: Paperclip --- scripts/teardown-e2e-headlamp.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/teardown-e2e-headlamp.sh b/scripts/teardown-e2e-headlamp.sh index 2c4ae19..d1a0025 100755 --- a/scripts/teardown-e2e-headlamp.sh +++ b/scripts/teardown-e2e-headlamp.sh @@ -13,6 +13,12 @@ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" E2E_NAMESPACE="${E2E_NAMESPACE:-headlamp-e2e}" E2E_RELEASE="${E2E_RELEASE:-headlamp-e2e}" +# Exit early if the namespace does not exist — nothing to tear down. +if ! kubectl get namespace "$E2E_NAMESPACE" >/dev/null 2>&1; then + echo "Namespace $E2E_NAMESPACE does not exist, nothing to tear down." + exit 0 +fi + echo "=== E2E Headlamp Teardown ===" echo " Namespace: $E2E_NAMESPACE" echo " Release: $E2E_RELEASE"