I am using helmfile as oppose to helm, and tried to follow this example: Kubernetes – How to define ConfigMap built using a file in a yaml? but didn’t seem to work (I guess its due to me using helmfile).
I have a values file with the following, with two data objects:
configmap:
configMapName: default-users-data-configmap
configMapData:
default-users-config.json: |-
{
"foo": "bar",
}
someJavaScriptFile.js: |-
{{ .Files.Get "js/someJavaScriptFile.js" }}
My configmap looks like this:
{{- with .Values.configmap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .configMapName }}
data:
{{- .configMapData | toYaml | nindent 2 }}
{{- end }}
Now what is positive is I am getting the json contents to show in configmap when I run a helmfile sync
But the issue is for the javascript contents its showing:
Data
someJavaScriptFile.js:
{{ .Files.Get “js/someJavaScriptFile.js” }}
Its not reading the contents from the javascript folder and putting it into config and can’t figure out if my syntax is wrong.
my structure of directory looks like the following:
helmfile -> charts -> contains charts
helmfile -> js -> someJavaScriptFile.js
helmfile -> helmfile.yaml
The charts directory contains my generic chart with my configmap.yaml, deployment.yaml, etc I’m running the sync in the helmfile directory so assumed it would pick up that javascript, it does dump the json, so assuming its struggling with the javascript.
Any ideas where the issue is? Thanks