Merge two Value files: helm

I’m trying to merge two values files in Helm: secrets.yaml and values.yaml. I have multiple endpoints in values.yaml, and I want to merge both the files. I tried using the append function:

{{$endpoints := (append .Values.serviceMonitor.endpoints .Values.oracle_db.serviceMonitor.endpoints) }}

However, when I do a dry-run, I see that both the values are picked up but they are not merged. Has anyone encountered this issue before?

Yes, I have encountered this issue before. Instead of using the append function, you can use the merge function to merge the two values. Here’s an example:

{{$endpoints := (merge .Values.serviceMonitor.endpoints .Values.oracle_db.serviceMonitor.endpoints) }}

This will merge the endpoints values from both serviceMonitor sections in values.yaml and secrets.yaml.