Created
January 22, 2021 16:15
-
-
Save seitosan/b051470c852b9938fa65d34d569ea0bf to your computer and use it in GitHub Desktop.
Remove all ressources on a namespace
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
param ( | |
[string] $namespace="default", | |
[bool] $delete=0 | |
) | |
$types=kubectl.exe api-resources --verbs=list --namespaced -o name | |
echo $namespace | |
foreach($type in $types) | |
{ | |
echo $type; echo "###"; | |
kubectl.exe get $type -n $namespace ; | |
if ($delete ) | |
{ | |
echo "will destroy all $type on $namespace" | |
kubectl.exe delete $type --all | |
} | |
echo "###"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script allows you to delete all the resources present in a namespace given as a parameter.
It is possible to put it only in observation with the boolean delete left in default parameter (namely false)