0

While re-syncing a helmfile that has been running for years for the first time since a few months, I suddenly get errors key "chart" already set in map for every item.

I'm not sure with which helmfile version it last worked (the error occurs at least on 0.153.1+), but I found a few related issues here (initial) and here (allegedly solved) that seem to suggest that actually old versions had this bug but new versions solved it; for me it's exactly the opposite.

An excerpt from the helmfile.yaml:

---
# Based on example https://github.com/costimuraru/helmfile-examples/tree/master/gotmpl
# Ordered list of releases.
helmfiles:
  - "common/repos.yaml"

# the rest based on this excellent article: https://www.arthurkoziel.com/managing-helm-charts-with-helmfile/
helmDefaults:
  atomic: true
  cleanupOnFail: true

templates:
  default: &default
    chart: charts/{{`{{ .Release.Name }}`}}
    missingFileHandler: Warn
    values:
    - charts/{{`{{ .Release.Name }}`}}/values-{{ .Environment.Name }}.yaml
    secrets:
    - charts/{{`{{ .Release.Name }}`}}/secrets-{{ .Environment.Name }}.yaml


releases:

- name: metallb
  <<: *default
  chart: metallb/metallb
  namespace: metallb

...

and the output with error:

...
first-pass produced: &{default  map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default  map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "helmfile.yaml.part.0":
...
35:  
36: - name: metallb
37:   <<: *default
38:   chart: metallb/metallb
39:   namespace: metallb
40:
...

err: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
  line 39: key "chart" already set in map 

EDIT: a new search turned up a report of the same issue, as yet unanswered...

ppenguin
  • 106
  • 7

1 Answers1

0

Check: https://github.com/helmfile/helmfile/issues/917

Use either export HELMFILE_GOCCY_GOYAML=true or use the inherit functionality for release template, as described here: https://helmfile.readthedocs.io/en/latest/writing-helmfile/#release-template-conventional-directory-structure