Helm 3: Access /files of library chart

Viewed 590

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!

1 Answers

I too came across similar kind of scenario As i checked in the internet i could able to find a way to access files in library chart Best possible way is you can create a subchart and extract them to your chart

How to create subchart in helm you see on 1 How to access subchart variables you can read 2

Related