diff --git a/scripts/deploy-e2e-headlamp.sh b/scripts/deploy-e2e-headlamp.sh index 30edb91..bf20565 100755 --- a/scripts/deploy-e2e-headlamp.sh +++ b/scripts/deploy-e2e-headlamp.sh @@ -53,9 +53,54 @@ kubectl create configmap headlamp-rook-plugin \ echo "" echo "Removing any existing E2E deployment (clean-start)..." +kubectl delete clusterrolebinding headlamp-e2e-test-crb --ignore-not-found 2>/dev/null || true kubectl delete deployment "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait kubectl delete service "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait kubectl delete serviceaccount "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not-found --wait +kubectl delete serviceaccount headlamp-e2e-test -n "$E2E_NAMESPACE" --ignore-not-found 2>/dev/null || true + +echo "" +echo "Creating E2E service account..." +kubectl create serviceaccount headlamp-e2e-test -n "$E2E_NAMESPACE" + +echo "" +echo "Creating RBAC for E2E service account..." +kubectl apply -f - </dev/null || echo "") if [ -n "$TOKEN" ]; then echo "HEADLAMP_URL=${SVC_URL}" > "$REPO_ROOT/.env.e2e" diff --git a/scripts/teardown-e2e-headlamp.sh b/scripts/teardown-e2e-headlamp.sh index 218d74b..28063df 100755 --- a/scripts/teardown-e2e-headlamp.sh +++ b/scripts/teardown-e2e-headlamp.sh @@ -25,8 +25,10 @@ kubectl delete serviceaccount "${E2E_RELEASE}" -n "$E2E_NAMESPACE" --ignore-not- echo "Cleaning up ConfigMap..." kubectl delete configmap headlamp-rook-plugin -n "$E2E_NAMESPACE" --ignore-not-found -echo "Cleaning up test service account..." +echo "Cleaning up test service account and RBAC..." kubectl delete serviceaccount headlamp-e2e-test -n "$E2E_NAMESPACE" --ignore-not-found +kubectl delete clusterrolebinding headlamp-e2e-test-crb --ignore-not-found 2>/dev/null || true +kubectl delete clusterrole headlamp-e2e-test-reader --ignore-not-found 2>/dev/null || true if [ -f "$REPO_ROOT/.env.e2e" ]; then rm "$REPO_ROOT/.env.e2e"