Helm: how to add elements to a list of default values?

It might be a very simple question, though somewhy I can't google the answer.

Let's assume we have a Helm chart with some default values such as the following:

parameters:
- parameterName: parameter1
  value: value1
- parameterName: parameter2
  value: value2

I need to add an element to this list in my extra values file. Of course, I can just duplicate the default values to my extra values file and add my extra parameters to them:

parameters:
- parameterName: parameter1
  value: value1
- parameterName: parameter2
  value: value2
- parameterName: parameterN
  value: valueN

I don't like this idea, because when the maintainers of this Helm chart change their defaults, my defaults will override instead of following them.

What is the proper way to add my parameterN to the default values?

Thanks in advance?


Solution 1:

According to https://github.com/helm/helm/issues/6569, this is not possible. This is by design, because lists are designed to be used as immutable data. The answers on that github issue suggest to use a map instead of a list, if this is possible in your situation.

Solution 2:

You could use Kustomize for this, with a json9602 patch as described in https://skryvets.com/blog/2019/05/15/kubernetes-kustomize-json-patches-6902/#append-to-a-list. A nice method to combine Kustomize with Helm: https://austindewey.com/2020/07/27/patch-any-helm-chart-template-using-a-kustomize-post-renderer/.