I have a common set of files that goes into configmap from common/config-dir
and few chart specific config files in appchart/config-dir
I am following the documentation from Helm.sh for using library charts to merge common and chart specific data. I am specifying {{ (.Files.Glob "config-dir/*").AsConfig | indent 2 }}
right under data
in both common
library chart as well as appchart
, However, library chart is not picking up the config-dir
files from common
chart.
Attaching _configmap.yaml
from common
library chart and configmap.yaml
from application chart.
_configmap.yaml
{{- define "common.configmap.tpl" -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name | printf "%s-%s" .Chart.Name }}
data:
{{ (.Files.Glob "config-dir/*").AsConfig | indent 2 }}
{{- end -}}
{{- define "common.configmap" -}}
{{- include "common.util.merge" (append . "common.configmap.tpl") -}}
{{- end -}}
configmap.yaml
{{- include "common.configmap" (list . "appchart.configmap") -}}
{{- define "appchart.configmap" -}}
data:
{{ (.Files.Glob "config-dir/*").AsConfig | indent 2 }}
{{- end -}}
Before getting into the problem, what is the size of those library files? There is a hard-limit of configmap not from kubernetes but from etcd of 1MB. If the files per configmap are greater than 1MB you should be using volumes for that purpose.
Please check configmap hard-limits. Kubernetes ConfigMap size limitation
Next can you run the helm install command with --debug and --dry-run flag and paste the output.
Next step can be to further go into the granularity separate the subchart and try using the same template and check it.