从基本模板图表覆盖舵图和值Yaml [英] helm overriding Chart and Values yaml from a base template chart

查看:45
本文介绍了从基本模板图表覆盖舵图和值Yaml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义了一个称为基本微服务的父图表,可以在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

它创建并部署基础微服务,而不是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仓库中的子图表和全局值文档页面.它涵盖了创建子图表,向子图表添加值和模板,从父图表覆盖值,全局图表值以及与子图表共享模板.听起来好像您想要覆盖来自父级图表.请注意,从父级传递到子图表的所有值都嵌套在YAML键下面,其名称与子图表相同. --set语法是相同的概念,只是在键的前面加上子图名称(--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文档,并且范围,依赖关系和值部分为上述用例以及其他用例提供了更多上下文.

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.

这篇关于从基本模板图表覆盖舵图和值Yaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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