helm 覆盖来自基本模板图表的 Chart 和 Values yaml [英] helm overriding Chart and Values yaml from a base template chart
问题描述
我定义了一个名为 base-microservice 的父图表,可在 mycompany.github.com/pages/base-microservice 上找到
I have defined a parent chart called base-microservice and is available at mycompany.github.com/pages/base-microservice
结构如下:
base-microservice
- templates
- deployment.yaml
- ingress.yaml
- service.yaml
- Chart.yaml
- values.yaml
- index.yaml
- base-microservice-0.1.0.tgz
我想定义一个继承自父图表的 customapp 图表.
I would like to define a customapp chart which inherits from the parent chart.
结构如下:
customapp-service
- customapp
- Chart.yaml
- charts
- requirements.yaml
- values.yaml
- src
requirements.yaml 如下:
requirements.yaml is as follows :
dependencies:
- name: base-microservice
repository: https://mycompany.github.com/pages/base-microservice
version: 0.1.0
当我这样做时
helm install --repo https://mycompany.github.com/pages/base-microservice --name customapp --values customapp/values.yaml
它创建和部署 base-microservice 而不是 customapp..换句话说,我在自定义应用程序图表中的 Chart.yaml 和 values.yaml 不会覆盖基础中定义的内容一个..
It creates and deploys base-microservice instead of customapp.. in other words my Chart.yaml and values.yaml in custom app chart don’t override what was defined in the base one..
请建议如何构建应用程序?
Kindly advice how to structure the app ?
推荐答案
您可能需要阅读 子图表和 Helm 仓库中的 Global Values 文档页面.它包括创建子图表、向子图表添加值和模板、覆盖父图表中的值、全局图表值以及与子图表共享模板.听起来您想要 Overriding Values from a父图表.请注意,从父级传递到子图的所有值都嵌套在与子图同名的 YAML 键下方.--set
语法是同一个概念,只是在key前加上子图名(--set subchartname.subchartkey=myvalue
.
You may want to read the Subcharts and Global Values doc page within Helm's repo. It covers Creating a Subchart, Adding Values and a Template to the Subchart, Overriding Values from a Parent Chart, Global Chart Values, and Sharing Templates with Subcharts. It sounds like you want the example in Overriding Values from a Parent Chart. Note that all values passed from the parent to the subchart are nested below a YAML key by the same name as the subchart. --set
syntax is the same concept, just prefix the key with the subchart name (--set subchartname.subchartkey=myvalue
.
此外,docs.helm.sh 具有良好的整合 Helm 文档,以及 Scope, Dependencies, and Values Intro To Charts 部分为上述用例和其他用例提供了更多背景信息.
Also, docs.helm.sh has good, consolidated Helm documentation, and the Scope, Dependencies, and Values section of Intro To Charts gives more context to the use case above as well as others.
这篇关于helm 覆盖来自基本模板图表的 Chart 和 Values yaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!