Skip to content

add new file access (in kustomize/helm generators)#278

Merged
cbarbian-sap merged 4 commits into
mainfrom
read-file
Apr 29, 2025
Merged

add new file access (in kustomize/helm generators)#278
cbarbian-sap merged 4 commits into
mainfrom
read-file

Conversation

@cbarbian-sap
Copy link
Copy Markdown
Contributor

@cbarbian-sap cbarbian-sap commented Apr 29, 2025

Ths PR enhances HelmGenerator and KustomizeGenerator, adding mechanisms to access files from the provided Helm chart resp. Kustomization directory.

For HelmGenerator that means, that the .Files builtin is now supported. With some small differences to the original Helm behavior:

  • all paths reserved by Helm (such as Chart.yaml, templates/, crds/ and so on) cannot be retrieved through .Files
  • since HelmGenerator currently does not honor the .helmignore file at all, files that would be excluded with regular Helm can be accessed through .Files with HelmGenerator.

For KustomizeGenerator, there are now three new template functions available:

  • readFile: takes a path relative to the Kustomization directory and returns the raw content (as []byte slice)
  • existsFile: also expects a path relative to the Kustomization directory and returns a boolean indicating whether the file exists or not
  • listFiles: accepts a pattern and returns a all matching file paths in the Kustomization directory as string list.

@cbarbian-sap cbarbian-sap merged commit 662b899 into main Apr 29, 2025
9 checks passed
@cbarbian-sap cbarbian-sap deleted the read-file branch April 29, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant