Sample Header Ad - 728x90

.Files.Glob pattern for a helm configmap

0 votes
1 answer
836 views
I have directory structure like this $ tree . . ├── Chart.yaml ├── datafiles │   ├── index.html │   ├── style.css │   ├── exclude.txt │   └── text │   ├── file1.txt │   ├── file2.txt I want to create configmaps with these conditions 1. Include files from datafiles directory only, and exclude any child directory like text 2. ability to exclude selective file(s) from parent dir like exclude.txt 3. able to templatize values from values file, say some values in index.html will be coming from values.yaml file, so use of tpl function is expected. I am able to create configmaps by using below pattern, but it tends to include all files in child directories too, also unable to include tpl function for files like index.html --- apiVersion: v1 kind: ConfigMap metadata: name: tpl-index data: {{ $currentScope := . }} {{- range $path, $_ := .Files.Glob "datafiles/**" }} {{- if not .Files.IsDir $path }} {{ (base $path) }}: |- {{ tpl .Files.Get $path | indent 4 }} {{- end }} {{- end }}
Asked by Sollosa (1993 rep)
Feb 14, 2024, 07:28 PM
Last activity: Jun 7, 2024, 11:23 AM