helm icon indicating copy to clipboard operation
helm copied to clipboard

How to load file contents into a dict in helm

Open himmakam opened this issue 6 years ago • 6 comments

himmakam avatar Jun 23 '20 10:06 himmakam

@himmakam Some suggestions in https://github.com/helm/helm/issues/8020 and https://stackoverflow.com/questions/55345358/convert-yaml-string-to-dict-in-helm-template that might be worth trying.

hickeyma avatar Jun 23 '20 11:06 hickeyma

@himmakam Example from @tamalsaha in https://github.com/helm/helm/issues/8020#issuecomment-648272488:

{{- $res := .Values.resources -}}
{{- $machines := .Files.Get "data/machines.yaml" | fromYaml -}}
{{- if and .Values.machine (hasKey $machines .Values.machine) }}
  {{- $res := get (get $machines .Values.machine) "resources" }}
{{- end }}

hickeyma avatar Jun 23 '20 16:06 hickeyma

There is a page in the docs on this at https://helm.sh/docs/chart_template_guide/accessing_files/. Does that help?

mattfarina avatar Jun 23 '20 17:06 mattfarina

@himmakam Did you get this working as per the thread in #8020?

hickeyma avatar Jun 24 '20 07:06 hickeyma

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

github-actions[bot] avatar Sep 23 '20 00:09 github-actions[bot]

Closing as answered.

bridgetkromhout avatar Sep 28 '20 16:09 bridgetkromhout