I am using Helm to deploy to a Kubernetes cluster. I have researched configmaps and found it is possible to retrieve data from a file and put it into the configmap.
I have the following configmap.yaml:
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ .Values.app.configMap }}
namespace: {{ .Values.app.namespace }}
data:
config.json: |-
{{ .Files.Glob "my-config.json" | indent 2}}
and my deployment.yaml contains the relevant volumeMount (if I put actual json data directly into configmap.yaml then the config deploys). My configmap.yaml and deployment.yaml are both kept in /chart/templates but I keep my-config.json within the base helm chart directory, outside of the templates folder.
When I try deploying with the chart, I get the following error:
Error: template: chart/templates/configmap.yaml:8:54: executing "chart/templates/configmap.yaml" at <2>: wrong type for value; expected string; got engine.files
How can I use the .json file in my configmap without putting the raw json data directly into the yaml file?