helm overriding Chart and Values yaml from a base template chart

3/30/2018

I have defined a parent chart called base-microservice and is available at mycompany.github.com/pages/base-microservice

Structure is as follows :

 base-microservice
    - templates
        - deployment.yaml
                 - ingress.yaml
         - service.yaml
    - Chart.yaml
    - values.yaml
- index.yaml
- base-microservice-0.1.0.tgz

I would like to define a customapp chart which inherits from the parent chart.

Structure is as follows :

customapp-service
    - customapp
                - Chart.yaml
        - charts
        - requirements.yaml
        - values.yaml
    - src

requirements.yaml is as follows :

dependencies:
    - name: base-microservice
      repository: https://mycompany.github.com/pages/base-microservice
      version: 0.1.0

When I do

helm install --repo https://mycompany.github.com/pages/base-microservice --name customapp --values customapp/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 ?

-- hackmabrain
kubernetes
kubernetes-helm
yaml

1 Answer

3/30/2018

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.

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.

-- Scott Rigby
Source: StackOverflow