mirror of
https://github.com/outbackdingo/home-ops.git
synced 2026-01-27 10:19:11 +00:00
17 lines
397 B
Bash
Executable File
17 lines
397 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
function delete_namespace () {
|
|
echo "Deleting namespace $1"
|
|
kubectl get namespace $1 -o json > tmp.json
|
|
sed -i 's/"kubernetes"//g' tmp.json
|
|
kubectl replace --raw "/api/v1/namespaces/$1/finalize" -f ./tmp.json
|
|
rm ./tmp.json
|
|
}
|
|
|
|
TERMINATING_NS=$(kubectl get ns | awk '$2=="Terminating" {print $1}')
|
|
|
|
for ns in $TERMINATING_NS
|
|
do
|
|
delete_namespace $ns
|
|
done
|