helm:kubernetes包管理器的python绑定
pyhelm的Python项目详细描述
Helm包管理器的Python绑定
如何使用pyhelm
要使用Pyhelm安装头盔图表,可以执行以下步骤:
使用ChartBuilder加载图表
frompyhelm.chartbuilderimportChartBuilderchart=ChartBuilder({"name":"nginx-ingress","source":{"type":"repo","location":"https://kubernetes-charts.storage.googleapis.com"}})
这将导致图表在本地克隆,任何对chart的额外使用都将引用本地副本。 您还可以使用"type": "directory"来使用本地图表,也可以使用"type": "git"从git repo克隆图表
安装图表
frompyhelm.chartbuilderimportChartBuilderfrompyhelm.tillerimportTillertiller=Tiller(TILLER_HOST)chart=ChartBuilder({"name":"nginx-ingress","source":{"type":"repo","location":"https://kubernetes-charts.storage.googleapis.com"}})tiller.install_release(chart.get_helm_chart(),dry_run=False,namespace='default')
此代码段将在安装Tiller的Kubernetes集群上安装nginx-ingress图表(假设TILLER_HOST指向活动的Tiller实例)请注意,在大多数舵机安装中,舵机无法以这种方式访问,您需要执行Kubernetes端口转发操作才能访问舵机。 Tiller类支持安装以外的其他操作,包括发布列表、发布更新、发布卸载和获取发布内容
赫尔姆gRPC
helm grpc库位于hapi目录中。它们是用grpc_tools.protoc实用程序针对helm 2.14生成的。如果您希望重新生成它们,您可以轻松地执行此操作:
git clone https://github.com/kubernetes/helm ./helm python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. _proto/hapi/chart/* python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. _proto/hapi/services/* python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. _proto/hapi/release/* python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. _proto/hapi/version/*