如何使用Helm获取子图表的名称? [英] How to get the name of a child chart with Helm?
问题描述
我有一个舵图,要求将stable/redis
作为子图.父图表需要将redis服务公开为环境变量.
I have a helm chart that requires stable/redis
as a child chart. The parent chart needs to expose the redis service as an environment variable.
redis图表包含一个名为redis.fullname
的模板.如何在我的父图表中参考呢? IE.我希望在我的父级部署中使用类似的方法,但是它不起作用:
The redis chart includes a template called redis.fullname
. How can I refer to this in my parent chart? I.e. I want something like this in my parent deployment but it doesn't work:
kind: Deployment
spec:
template:
containers:
env:
- name: REDIS_CLUSTER_SERVICE_HOST
value: {{ template "redis.fullname" . }}
推荐答案
您可以在父图表中使用'{{ .Release.Name }}-redis'
.我有同样的要求.这是我的示例,以备您查看-> https://github.com/kubernetes/charts/tree/master/incubator/distribution
You can use '{{ .Release.Name }}-redis'
in your parent chart. I had same requirement. This is my example in case you want to take a look ->https://github.com/kubernetes/charts/tree/master/incubator/distribution
这篇关于如何使用Helm获取子图表的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!