Merge two Value files in helm

1/12/2020

I'm looking to merge two values files in helm.

secrets.yaml:

    serviceMonitor:
       endpoints:
         - module: oracledb
           port: http
           scheme: http
           url: "http://user:password@ip:port/xxx" 

I have another values.yaml file which has multiple endpoints. I want to merge both the values files. I'm tried using append function to do that: {{$endpoints := (append .Values.serviceMonitor.endpoints .Values.oracle_db.serviceMonitor.endpoints) }} When I do a dry-run, I see its picking up both the values but won't merge. Any one come across this?

-- karthick
kubernetes-helm
yaml

1 Answer

1/15/2020

In the current Helm version (3) merging values is not supported.

This feature was discussed in this Github issue: Helm should preform deep merge on multiple values files.

One important quote from there

If this is implemented, it should be optional, i. e. the merge mode should be specified as a command-line flag. Anything else would be a breaking change and, I think, in most cases not desirable. The problem is that you would not be able to override defaults for lists.

See: https://github.com/helm/helm/issues/3486#issuecomment-364534501

-- LazerBass
Source: StackOverflow