19

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
  • 457
  • 1
  • 6
  • 21

1 Answers1

39

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.

mckelvin
  • 3,918
  • 1
  • 29
  • 22
Scott Rigby
  • 634
  • 6
  • 6
  • 1
    The links in this answer no longer exist. – Armando Jan 14 '20 at 13:55
  • 1
    @Armando Here are the current working links to the chart template guide (the Search bar on the left is useful for looking up broken links): https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#scrollpane https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#overriding-values-from-a-parent-chart – lcary Jan 15 '20 at 15:05
  • Note that you can only specify values for direct dependencies atm. That means you can't override values for your sub-chart's sub-chart – tu4n Feb 17 '20 at 02:56
  • @rocketspacer I tried overriding a sub-chart's sub-chart value and worked `sub-chart: sub-chart2: value_key: value` – Firas Omrane Oct 20 '22 at 15:47
  • Yeah my comment was way back during Helm 3.2 – tu4n Oct 26 '22 at 06:39