How to create ConfigMap from directory using helm
10,532
Inside a Helm template, you can use the Files.Glob
and AsConfig
helper functions to achieve this:
{{- (.Files.Glob "postman/**.json").AsConfig | nindent 2 }}
Or, to give a full example of a Helm template:
apiVersion: v1
kind: ConfigMap
metadata:
name: test-config
data:
{{- (.Files.Glob "postman/**.json").AsConfig | nindent 2 }}
See the documentation (especially the section on "ConfigMap and secrets utility functions") for more information.
Author by
Vatan Soni
Updated on June 05, 2022Comments
-
Vatan Soni almost 2 years
I have a folder with 3 json files in a
postman
folder. How can I create a ConfigMap using a Helm yaml template?kubectl create configmap test-config --from- file=clusterfitusecaseapihelm/data/postman/
The above solution works, but I need this as yaml file as I am using Helm.