New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(helm): Add Files.AsSecrets, Files.AsConfig, path functions #1666
Conversation
// Add some extra functionality | ||
extra := template.FuncMap{ | ||
"toYaml": chartutil.ToYaml, | ||
"base": path.Base, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my preference would be to have these path functions rolled into Sprig. We try to only put "special" functions here. If you put them in Sprig, I'll roll another Sprig release ASAP, too.
Other than discussing the possibility of moving the |
I don't suppose I can coerce you into also doing this one too, could I? ;-) #1548 |
Manually tested |
This PR adds a number of useful utilities for working with files and file paths.
Files
type learned to serialize itself to valid YAML maps for both config maps and secrets viaFiles.AsConfig()
andFiles.AsSecrets()
A few possible edits I was unsure on:
AsConfig()
andAsSecrets()
could instead return maps intended to be passed totoYaml
ortoJson
(does that exist?) to support either use case. I chose YAML because I think that's probably the most commonly used language, but I know there are people out there using JSON.{{ Files.Glob "secrets/*" | secretMap | flattenDir | toYaml }}
.ToKubeConfigMapYAMLKeys()
or some such nonsense. 😄