I can create a ConfigMap without issues with kubectl create configmap settings --from-file settings.yaml, but I don't want to manually create it but as part of a helm install.
So, I created a template file:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.settingsConfigMap }}
data:
settings.yaml: |-
{{ .Files.Get "settings.yaml" | indent 4}}
but whenever I run helm install I get an error saying that
invalid type for io.k8s.api.core.v1.ConfigMap.data: got "map", expected "string"
So, what can I do to create this ConfigMap with Helm loading the content from a YAML file?
UPDATE
It turns out the error mentioned above is related to some issues with the indentation. By removing the indent 4, I managed to get a step further, but now it's failing because all my settings are detected as unknown fields, for example:
unknown field "customers" in io.k8s.api.core.v1.ConfigMap, ValidationError(ConfigMap): unknown field "deploy_name" in io.k8s.api.core.v1.ConfigMap, ValidationError(ConfigMap): unknown field "system" in io.k8s.api.core.v1.ConfigMap
deploy_name, system and customers are the top level keys of my settings.yaml file.
version.BuildInfo{Version:"v3.3.4", GitCommit:"a61ce5633af99708171414353ed49547cf05013d", GitTreeState:"dirty", GoVersion:"go1.15.2"}