如何为子头盔图表设置不同的命名空间? [英] How to set a different namespace for child helm charts?

查看:98
本文介绍了如何为子头盔图表设置不同的命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您安装带有未指定命名空间的子图表的图表时,Helm将使用通过--namespace在命令行上指定的图表.是否可以为特定的子图表覆盖此标志?

When you install a chart with a child chart that doesn't specify a namespace, Helm will use the one specified on command line via --namespace. Is it possible to override this flag for a specific child chart?

例如,如果我有一个依赖于图表B的图表A,并且指定了--namespace foo,则我希望能够自定义图表B的资源,以将其安装到其他命名空间bar而不是foo中.

For example if I have chart A which depends on chart B and I specify --namespace foo, I want to be able to customize the resources of chart B to be installed into some other namespace bar instead of foo.

推荐答案

更新2: Helm 3添加了对多名称空间的支持 https://github.com/helm/helm/issues/2060

Update 2: Helm 3 added support for multi namespaces https://github.com/helm/helm/issues/2060

更新1: 如果资源模板指定metadata.namespace,则它将安装在该命名空间中.例如,如果我有一个带有metadata.namespace: x的容器并且运行了helm install mychart --namespace y,则该容器将安装在x中.我想您可以使用带有名称空间的常规头盔模板对其进行参数化.

Update 1: If a resource template specifies a metadata.namespace, then it will be installed in that namespace. For example, if I have a pod with metadata.namespace: x and I run helm install mychart --namespace y, that pod will be installed in x. I guess you could use regular helm templates with the namespace to parameterize it.

原始答案:

直到Helm 3.0,我们才打算完全支持多名称空间的发行版 https://github.com/kubernetes/helm/issues/2060#issuecomment-306847365

We do not plan on fully supporting multi-namespaced releases until Helm 3.0 https://github.com/kubernetes/helm/issues/2060#issuecomment-306847365

作为一种解决方法,您可以使用--skip-dependencies

As a workaround, you install for each namespace individually using --skip-dependencies or with dependency conditions

这篇关于如何为子头盔图表设置不同的命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆