helmfile: Values in maps not available for namespace

This looks like a bug to me.

Given this hemlfile.yaml:

environments:
  default:
    values:
    - defaults.yaml

repositories:
# Kubernetes incubator repo of helm charts
- name: "kubernetes-incubator"
  url: "https://kubernetes-charts-incubator.storage.googleapis.com"

releases:
- name: 'test'
  chart: "kubernetes-incubator/raw"
  namespace: "{{ .Values.map.key }}"
  version: "0.2.3"
  values:
  - resources:
    - apiVersion: v1
      kind: ConfigMap
      metadata:
        name: test
      data:
        test.yaml: |
          test:
            namespace: "{{ .Values.map.key }}"

and this defaults.yaml:

map:
  key: map.value

mapkey: flat.value

helmfile chokes:

$ helmfile -version
helmfile version v0.109.0
$ helmfile diff
in ./helmfile.yaml: error during helmfile.yaml.part.0 parsing: template: stringTemplate:14:24: executing "stringTemplate" at <.Values.map.key>: map has no entry for key "map"

But changing line 14

  namespace: "{{ .Values.map.key }}"

to

  namespace: "{{ .Values.mapkey }}"

works fine, despite the reference to {{ .Values.map.key }} in the values section. So this is not a case of the value never being available, or of not being able to use .Values to set the namespace, this is something particular to using maps.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17

Most upvoted comments

I tried that before and it didn’t work

What error did you see when you used ---?