Created
January 15, 2024 19:52
-
-
Save mrhillsman/78158dff217a259fa5f263696084e987 to your computer and use it in GitHub Desktop.
Get all namespaces, filter by status Terminating, output the json, replace the finalizers with an empty set, then finally push the updated namespace's json representation back to the cluster.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ns in `kubectl get namespaces | awk '/Terminating/ NR>1 {print $1}'`; \ | |
do kubectl get namespace ${ns} -o json | tr -d "\n" | \ | |
sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | \ | |
kubectl replace --raw /api/v1/namespaces/${ns}/finalize -f -; done; |
Author
mrhillsman
commented
Feb 12, 2024
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment