Ever tried to use .Files.Glob from your parent chart to read configuration files stored in a subchart? Maybe you expected the parent to simply access files in charts/my-subchart/configs/*.yaml — but instead, you got... nothing. You're not alone! This is one of Helm's most confusing behaviors for newcomers.
Helm's .Files.Glob function can only read files from within the same chart.
This means a parent chart CANNOT read files that exist in a subchart.
This is by design - see the Helm documentation.
helm-files-glob-demo/
├── README.md
├── run-demo.sh # Runs all 3 demos
│
├── problem/ # Demonstrates the PROBLEM
│ ├── parent-chart/ # Parent chart tries to read subchart files
│ │ ├── Chart.yaml
│ │ ├── templates/
│ │ │ └── configmap.yaml # Tries .Files.Glob on subchart (FAILS!)
│ │ └── charts/
│ │ └── child-chart/ # Subchart with config files
│ │ ├── Chart.yaml
│ │ ├── configs/
│ │ │ ├── database.yaml
│ │ │ └── cache.yaml
│ │ └── templates/
│ │ └── _helpers.tpl
│ └── test.sh
│
├── standalone/ # SOLUTION: Standalone chart
│ ├── Chart.yaml # No dependencies
│ ├── configs/ # Config files in same chart
│ │ ├── database.yaml
│ │ ├── cache.yaml
│ │ └── networking.yaml
│ ├── templates/
│ │ ├── _helpers.tpl
│ │ └── configmap.yaml # .Files.Glob works here!
│ ├── values.yaml
│ └── test.sh
│
└── configmap/ # ALTERNATIVE: Subchart creates ConfigMap
├── parent-chart/ # Parent references subchart's ConfigMap
│ ├── Chart.yaml
│ ├── templates/
│ │ └── deployment.yaml # Mounts ConfigMap from subchart
│ └── charts/
│ └── child-chart/ # Subchart creates its own ConfigMap
│ ├── Chart.yaml
│ ├── configs/
│ ├── templates/
│ │ ├── _helpers.tpl
│ │ └── configmap.yaml # Subchart reads its own files
└── test.sh
cd problem/parent-chart
helm dependency update .
helm template .
# Result: Empty output - .Files.Glob finds NO files in subchartcd standalone
helm template .
# Result: All config files are correctly loadedcd configmap/parent-chart
helm dependency update .
helm template .
# Result: Subchart creates ConfigMap, parent can mount it- Helm compiles each chart independently
- The
.Filesobject only contains files from the current chart - Subcharts are separate charts with their own
.Filesscope - There is no way to reference subchart files from a parent chart
Make the chart standalone without dependencies. Files are directly in the chart. Use case: When you need file contents during Helm template rendering.
→ Demonstrated in the standalone/ folder.
The subchart creates a ConfigMap with its file contents. Parent mounts that ConfigMap. Use case: When you only need the data at runtime (in containers).
→ Demonstrated in the configmap/ folder.
Put all configuration in values.yaml instead of separate files. Use case: When configuration is simple and doesn't need file structure.
Make sure you have Helm installed. See the official Helm installation guide for instructions.
# Run all demos
./run-demo.sh
# Or individually:
./problem/test.sh # Shows the problem
./standalone/test.sh # Shows standalone solution
./configmap/test.sh # Shows ConfigMap alternativeThe ConfigMap approach only works for runtime data access. If you need file contents during Helm template rendering (e.g., to generate Kubernetes resources based on file contents), you must use the standalone chart approach.