Created
January 31, 2023 06:28
-
-
Save IronCore864/ca1e74a65f4a97937d93c63c094e9d32 to your computer and use it in GitHub Desktop.
This file contains 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
import subprocess | |
def get_releases(namespace: str = "default"): | |
ret = subprocess.run( | |
["helm", "list", "-n", namespace, "-q"], | |
capture_output=True, | |
check=True, | |
) | |
return ret.stdout.decode().splitlines() | |
def helm_uninstall(release: str, namespace: str): | |
subprocess.run( | |
["helm", "uninstall", release, "--namespace", namespace], | |
capture_output=True, | |
check=True, | |
) | |
def uninstall_all_releases_in_ns(namespace: str): | |
releases = get_releases(namespace) | |
for release in releases: | |
helm_uninstall(release, namespace) | |
if __name__ == "__main__": | |
uninstall_all_releases_in_ns("default") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment