-
Notifications
You must be signed in to change notification settings - Fork 181
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
controllers: improve decryptor and add tests #619
Conversation
db389a4
to
15a45e3
Compare
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.
LGTM
- Refactored recursion while iterating over Kustomization files. References of files that have been visited are cached, and not visited again. In addition, symlinks are confirmed to not traverse outside the working directory. - Optimized various bits around (un)marshalling (encrypted) data, and YAML -> JSON -> YAML roundtrips are prevented where not required. - Added support for decrypting INI Kustomize EnvSource references using the dedicated SOPS store for the format. - Introduced support for decrypting Kustomize FileSources: https://pkg.go.dev/sigs.k8s.io/kustomize@v1.0.2/pkg/types#DataSources Signed-off-by: Hidde Beydals <hello@hidde.co>
15a45e3
to
105ebd9
Compare
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.
LGTM
Awesome improvements! Thanks @hiddeco 🥇
// sopsFormatToMarkerBytes contains a list of formats and their byte | ||
// order markers, used to detect if a Secret data field is SOPS' encrypted. | ||
sopsFormatToMarkerBytes = map[formats.Format][]byte{ | ||
// formats.Binary is a JSON envelop at encrypted rest |
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.
// formats.Binary is a JSON envelop at encrypted rest | |
// formats.Binary is a JSON envelope. |
// file it is called with. | ||
// After a successful decrypt, the absolute path of the file is added to the | ||
// given map. | ||
func (d *KustomizeDecryptor) decryptKustomizationEnvSources(visited map[string]struct{}) visitKustomization { |
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.
See #636 for a few revisions to this method.
References of files that have been visited are cached, and not
visited again.
YAML -> JSON -> YAML roundtrips are prevented where not required.
the dedicated SOPS store for the format.
https://pkg.go.dev/sigs.k8s.io/kustomize@v1.0.2/pkg/types#DataSources