python-helm is a helm client for python(tiller version: 2.9.1).
最近在写自己的个人博客,马上就写完,写完后把这个项目按计划好好更新一波
目录:
python-helm 可以实现对Tiller的访问
helm grpc 生成方式:
The helm gRPC libraries are located in the hapi directory.
They were generated with the grpc_tools.protoc utility against Helm 2.9.1.
Should you wish to re-generate them you can easily do so:
grpc python协议文件生成
# git clone https://github.com/kubernetes/helm ./helm
# python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. ./helm/_proto/hapi/chart/*
# python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. ./helm/_proto/hapi/services/*
# python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. ./helm/_proto/hapi/release/*
# python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. ./helm/_proto/hapi/version/*
完成后,将在当前目录下生成hapi目录,这就是我们需要的grpc协议文件
# ls ./hapi
# total 0
# drwxr-xr-x 2 root root 200 Jul 9 16:47 chart
# drwxr-xr-x 2 root root 294 Jul 9 16:47 release
# drwxr-xr-x 2 root root 53 Jul 9 16:47 rudder
# drwxr-xr-x 2 root root 53 Jul 9 16:47 services
# drwxr-xr-x 2 root root 55 Jul 9 16:47 version
In [1]: from pyhelm.repo import RepoUtils
In [2]: chart_path = from_repo('https://kubernetes-charts.storage.googleapis.com/', 'mariadb')
In [3]: print(chart_path)
"/tmp/pyhelm-kibwtj8d/mongodb"
In [1]: from pyhelm.chartbuilder import ChartBuilder
In [2]: chart = ChartBuilder({'name': 'mongodb', 'source': {'type': 'directory', 'location': '/tmp/pyhelm-kibwtj8d/mongodb'}})
from pyhelm.chartbuilder import ChartBuilder
from pyhelm.tiller import Tiller
# 构建chart元数据
chart = ChartBuilder({'name': 'mongodb', 'source': {'type': 'directory', 'location': '/tmp/pyhelm-kibwtj8d/mongodb'}})
# 生成tiller连接实例
tiller_ins = Tiller(tiller_host, tiller_port)
# 安装 release
tiller_ins.install_release(chart.get_helm_chart(), dry_run=False, namespace='default')
# 列出 release
tiller_ins.list_releases(limit=RELEASE_LIMIT, status_codes=[], namespace=None)
# 删除 release
tiller_ins.uninstall_release(release_name)
# 获得 release 版本历史
tiller_ins.get_history(name, max=MAX_HISTORY)
# 回滚 release
tiller_ins.rollback_release(name, version, timeout=REQUEST_TIMEOUT)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。