Use single config file into 2 subCharts in helm

11/21/2019

Currently I use a .Files.get function to copy the contents of the config files into a configMap of a subchart.

Parent_chart
|-Charts
|  |- subchart1
   |    |- config file
   |    |- templates/
   |    |- Charts.yaml
   |    
   |- subchart2
        |- templates/
        |- Chart.yaml

Now a request has arrived to use the same config file for another sub chart.

I do not want to copy the files twice in 2 location inside subchart. Is there any way I can use a single location which can accessed by both sub charts?

-- yog raj
kubernetes-helm

1 Answer

11/21/2019

One way to solve it is to create a third chart to manage the configMap and make it a dependency on your charts.

To do that the main point is to use a relative folder as a repository in your requirements.yaml of each chart you want to use the config like this:

dependencies:
  - name: config
    repository: file://../config
    version: x.x.x
-- wolmi
Source: StackOverflow