Helm 3: Access /files of library chart

5/11/2020

I have a library chart that is used as a dependency in multiple other charts. I already share a few named templates using this. I have a few files that I also want to share using the library chart. The content of the file should end up in a config map.

I tried adding a /files directory to the library chart (next to the /templates directory), placed the files inside and used the following named template

{{- define "lib-chart.all-files-as-data" -}}
data:
{{- range $path, $bytes := $.Files.Glob "files/*" }}
  {{ $path | base }}: |{{ (tpl ($bytes | toString) $ ) | nindent 6 }}
{{- end -}}
{{- end -}}

This however only picks up files from the chart which uses the library chart and not the library chart itself.

Is there a way to access the content of the /files folder of a library chart?

Thanks!

-- Fabian
kubernetes-helm

0 Answers