I have an issue when trying to use a file from a library chart. Helm fails when I try to access a file from the library. I have followed the example from theΒ library_charts documentation
Everything is the same as the documentation except two parts: I have added the file mylibchart/files/foo.conf and this file is referenced in mylibchart/templates/_configmap.yaml's data key (in the documentation, data is an empty object)
.
βββ mychart
β βββ Chart.yaml
β βββ templates
β βββ configmap.yaml
βββ mylibchart
βββ Chart.yaml
βββ files
β βββ foo.conf
βββ templates
βββ _configmap.yaml
βββ _util.yaml
When I run the following commands, I would expect to see:
$ cd mychart
$ helm dependency update
Saving 1 charts
Deleting outdated charts
$ helm template .
---
# Source: mychart/templates/configmap.yaml
apiVersion: v1
data:
foo.conf: mylibchart/files/foo.conf's content
fromlib: true
myvalue: Hello World
kind: ConfigMap
metadata:
name: mychart-RELEASE-NAME
But what I get is:
$ helm template .
---
# Source: mychart/templates/configmap.yaml
Error: 'error converting YAML to JSON: yaml: line 8: did not find expected key'
data:
myvalue: Hello World
This error is caused by the fact that mychart/files/foo.conf does not exist. If I create it, it yields the expected result... But it's not mychart/files/foo.conf's content that I want but mylibchart/files/foo.conf's content! I checked and the file foo.conf does exist inside the file generated by "helm dependency update":
$ tar -tf mychart/charts/mylibchart-0.1.0.tgz
mylibchart/Chart.yaml
mylibchart/templates/_configmap.yaml
mylibchart/templates/_utils.yaml
mylibchart/files/foo.conf
How can I use that file from the .tgz file?