programmatically overriding values in sub-charts in helm

8/12/2019

I searched for hours, but I can't find any solution for my problem.

Short Version: Is it possible to genarate new .Value properties at templating time?

Long Version: I want to deploy the ElasticStack with Logstash, Kibana, Elasticsearch and I want to use the offical helm templates for Kibana and Elasticsearch.

My Idea is to create a new Chart (elk) with the 3 subcharts.

elk
    charts
        elasticsearch (official helm template)
            values.yaml
        kibana (official helm template)
            values.yaml
        logstash
            values.yaml
    templates
    values.yaml

My problem is the multiple declaration of the same property in the top-level values.yaml

My elk/values.yaml looks like the following

elasticsearch:
  clusterName: "elasticsearchtest"
  imageTag: "7.3.0"
  replicas: 3
  minimumMasterNodes: 2
  volumeClaimTemplate:
    storageClassName: gp2-resize

kibana:
  elasticsearchHosts: "http://elasticsearchtest-master:9200"
  imageTag: "7.3.0"


logstash:
  elasticsearchHosts: "http://elasticsearchtest-master:9200"
  imageTag: "7.3.0"

Note the repitition if I want to change the clustername or specify the imagetag. It feels really bad to overwrite the subcharts' values in this way.

It is possible to create a top-level values.yaml like this:

clusterName: "elasticsearchtest"
imageTag: "7.3.0"

and overwrite the subcharts values at templating time?

-- Lukas
kubernetes
kubernetes-helm

1 Answer

8/12/2019

There is no way to template values.yaml, if you are not going to use external tools (eg. Ytt)

https://github.com/helm/helm/issues/2492

However, if you can change values.yaml in the subcharts, then you can assign it to the global variables, and define them once in the parent Helm chart.

-- Marcin Ginszt
Source: StackOverflow