0

I'm using this values.yaml file:

global:
  sites:
    - name: site3
    - name: site2

fluent-bit:
  config:
    outputs: |
      {{- range .Values.global.sites }}
      [OUTPUT]
          Name stackdriver
          Match kube.*daemon-{{ .name }}*
          google_service_credentials /opt/auth-{{ .name }}/auth.json
      {{- end }}

  daemonSetVolumes:
    - name: varlog
      hostPath:
        path: /var/log
    - name: varlibdockercontainers
      hostPath:
        path: /var/lib/docker/containers
    - name: etcmachineid
      hostPath:
        path: /etc/machine-id
        type: File
    {{- range .Values.global.sites }}
    - name: auth-{{ .name }}
      secret:
        secretName: auth-{{ .name }}
        defaultMode: 420
    {{- end }}

  daemonSetVolumeMounts:
    - name: varlog
      mountPath: /var/log
    - name: varlibdockercontainers
      mountPath: /var/lib/docker/containers
      readOnly: true
    - name: etcmachineid
      mountPath: /etc/machine-id
      readOnly: true
    {{- range .Values.global.sites }}
    - name: auth-{{ .name }}
      mountPath: /opt/auth-{{ .name }}/auth.json
      subPath: auth.json
    {{- end }}

I'm getting this error: error converting YAML to JSON: yaml: line 23: could not find expected ':'

How can I use the range in that case?

I tried use indent but it didn't solve that issue

  • You can't use `{{ ... }}` templating in the `values.yaml` file; it must be a flat YAML file. If you control the chart then potentially you can use Helm's `tpl` function, or you might be able to use a wrapper tool like Helmfile that does support it. – David Maze May 31 '23 at 10:43
  • Thanks for the reply David, interesting becasue the values for the output are being passed succesfullly and I can see them in the template output. I will have a look on how I can achieve that with 'tpl' Thanks gain! – Elias Casperakos May 31 '23 at 11:52

0 Answers0