Skip to content

Instantly share code, notes, and snippets.

@IronCore864
Created January 31, 2023 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IronCore864/ca1e74a65f4a97937d93c63c094e9d32 to your computer and use it in GitHub Desktop.
Save IronCore864/ca1e74a65f4a97937d93c63c094e9d32 to your computer and use it in GitHub Desktop.
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