helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

values: [ namePrefix: "foo" ] prevents jsonPatches from being processed

Open eigood opened this issue 2 years ago • 0 comments

  - name: {{ .Values.prefix}}nfs-server
    namespace: {{ .Values.namespace }}
    chart: charts/nfs-server
    values:
      - namePrefix: {{ .Values.prefix }}
    jsonPatches:
      - target:
          group:
          version: v1
          kind: ReplicationController
          name: nfs-server
          namespace: {{ .Values.namespace }}
        patch:
          - op: replace
            path: /spec/template/spec/volumes/0/persistentVolumeClaim/claimName2
            value: {{ .Values.prefix }}nfs-data

Note that the jsonPatch references an invalid path; I would expect this to fail validation, but it does not. If I remove the namePrefix setting, then helmfile correctly tries to process the jsonPatch, which then fails the validation.

This particular chart has a PersistentVolumeClaim defined in it(with no PV, at least for now), the namePrefix allows me to install this in a shared namespace with other reusable charts, but I need to ensure that all such renamed objects also get updated wherever they are used.

I can confirm that encoding the above as a strategicMergePatch allows me to continue, but since that doesn't support merging of arrays, I'd have to duplicate the entire list of volumes[](if I had more than 1, it would be difficult to maintain).

If you need this boiled down to a shorter test case, then I'm willing to provide one.

eigood avatar Jan 18 '22 16:01 eigood