pyhelm3
Python library for managing Helm releases using Helm 3 (i.e. Tiller-less Helm).
Installation
pyhelm3
can be installed from PyPI:
pip install pyhelm3
Usage
from pyhelm3 import Client
client = Client()
client = Client(kubeconfig = "/path/to/kubeconfig")
client = Client(kubecontext = "kubecontext")
client = Client(executable = "/path/to/helm")
releases = await client.list_releases(all = True, all_namespaces = True)
for release in releases:
revision = await release.current_revision()
print(release.name, release.namespace, revision.revision, str(revision.status))
revision = await client.get_current_revision("cert-manager", namespace = "cert-manager")
chart_metadata = await revision.chart_metadata()
print(
revision.release.name,
revision.release.namespace,
revision.revision,
str(revision.status),
chart_metadata.name,
chart_metadata.version
)
chart = await client.get_chart(
"cert-manager",
repo = "https://charts.jetstack.io",
version = "v1.8.x"
)
print(chart.metadata.name, chart.metadata.version)
print(await chart.readme())
revision = await client.install_or_upgrade_release(
"cert-manager",
chart,
{ "installCRDs": True },
atomic = True,
wait = True
)
print(
revision.release.name,
revision.release.namespace,
revision.revision,
str(revision.status)
)
revision = await client.get_current_revision("cert-manager", namespace = "cert-manager")
await revision.release.uninstall(wait = True)
await client.uninstall_release("cert-manager", namespace = "cert-manager", wait = True)