feat: Generate secrets from templating #264
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello ksops team!
This is a (non-breaking) feature pull request to add one advanced feature to the ksops plugin.
I have added usage and usecases to README.md, but in short, this feature allows you to use golang text/template to template a secret from variables read via sops.
Please feel free to correct my English in README if anything feels unnatural, because I am not a native English speaker.
My particular usecases include: templating a Gitea app.ini config file.
The app.ini is large, and has quite a few fields and a number of secret fields I would like to mask in a git repository.
(Since
.ini
is supported by sops, I guess technically I could useunencrypted_regex
to filter out fields in.sops.yaml
, but that would get the config file too cluttered. I would personally rather use this templating feature implemented in this PR.)I have uploaded a built docker image of this PR to ghcr.io/motoki317/ksops so I can try it out in my environment.
You can view my refactor commits using this feature from the following links:
motoki317/manifest@533de9f
motoki317/manifest@570a8f3
I should also note that this was partially inspired by external-secret's advanced templating feature.
https://external-secrets.io/latest/guides/templating/
Thank you in advance!