Skip to content

Instantly share code, notes, and snippets.

@jfblaine
Created February 27, 2020 09:23
Show Gist options
  • Select an option

  • Save jfblaine/9d05204ac8732d210f350e074376aec7 to your computer and use it in GitHub Desktop.

Select an option

Save jfblaine/9d05204ac8732d210f350e074376aec7 to your computer and use it in GitHub Desktop.
Remove terminating namespace
#!/bin/bash
#pass project name argument while running this shell script
kubectl proxy &
echo "Deleting the namespace $1"
oc project $1
oc delete --all all,secret,pvc > /dev/null
oc get ns $1 -o json > tempfile
sed -i 's/"kubernetes"//g' tempfile
curl --silent -H "Content-Type: application/json" -X PUT --data-binary @tempfile http://127.0.0.1:8001/api/v1/namespaces/"$1"/finalize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment