之前正常工作的 helmfile 现在会出错,提示“key “chart” already set in map”

之前正常工作的 helmfile 现在会出错,提示“key “chart” already set in map”

helmfile几个月后我第一次重新同步已运行多年的项目时,突然发现key "chart" already set in map每个项目都出现错误。

我不确定helmfile它最后在哪个版本上运行(错误至少发生在0.153.1+),但我发现了一些相关问题这里(初始)这里(据称已解决)这似乎表明旧版本实际上存在此错误,但新版本解决了它;对我来说,情况恰恰相反。

摘录自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

...

并且输出有错误:

...
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 

编辑:出现了新的搜索同一问题的报告,尚未答复...

答案1

查看:https://github.com/helmfile/helmfile/issues/917

使用其中之一export HELMFILE_GOCCY_GOYAML=true或使用inherit发布模板的功能,如下所述:https://helmfile.readthedocs.io/en/latest/writing-helmfile/#release-template-conventional-directory-structure

相关内容