add script to kill rogue namespaces [ci skip]

This commit is contained in:
Viktor Barzin 2024-02-20 22:13:23 +00:00
parent 0dc86792e4
commit 759db0360a
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
2 changed files with 12 additions and 0 deletions

12
kill_ns.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
NAMESPACE=$1
if [ -z "$NAMESPACE" ]; then
echo "Pass in parameter namespace"
exit 1
fi
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' > /tmp/kill_rogue_ns.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @/tmp/kill_rogue_ns.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
kill %1

Binary file not shown.