represent helm chart values.yaml in helmfile.yaml

891 views Asked by At

I am trying to represent the following in the helmfile.yaml but I am getting an error. Can anyone help me to set it up?

values.yaml

extraVolumes:
 - name: google-cloud-key
   secret:
     secretName: gcloud-auth

I tried the following in helmfile.yaml

repositories:
  - name: loki 
    url: https://grafana.github.io/loki/charts

releases:
  - name: loki
    namespace: monitoring
    chart: loki/loki
    set: 
    - name: extraVolumes.name
      value: google-cloud-key
    - name: extraVolumes.secret.secretName
      value: gcloud-auth

The error I am getting is

coalesce.go:160: warning: skipped value for extraVolumes: Not a table.

I also tried with the following in helmfile.yaml

    - name: extraVolumes.name[]
      value: google-cloud-key

This gave me the following error

Error: failed parsing --set data: key map "extraVolumes" has no value

Any idea?

1

There are 1 answers

0
David Maze On

Helmfile has two ways to provide values to the charts it installs. You're using set:, which mimics the finicky helm install --set option. However, Helmfile also supports values:, which generally maps to helm install -f. Helmfile values: supports two extensions: if a filename in the list ends in *.gotmpl then the values file itself is processed as a template file before being given to Helm; or you can put inline YAML-syntax values directly in helmfile.yaml.

This last option is probably easiest. Instead of using set:, use values:, and drop that block of YAML directly into helmfile.yaml.

releases:
  - name: loki
    namespace: monitoring
    chart: loki/loki
    values:                         # not `set:`
      - extraVolumes:               # inline YAML content as a single list item
          - name: google-cloud-key
            secret:
              secretName: gcloud-auth

values: is set to a list of either filenames or inline mappings. If you're not deeply familiar with YAML syntax, this means you need to put a - list-item indicator before the inline YAML block. If you already have a list of values: files you can add this additional item into the list wherever appropriate.