-
Notifications
You must be signed in to change notification settings - Fork 683
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
Force name and namespace from --merge-into target #286
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A frequent operation is to take an existing sealed secrets and update a single entry in it. We even have a fancy command now that helps this tedious operation: `--merge-into` (documented in the README). The rationale for implementing that command was not only to help lazy users to merge strings into the right place into a YAML file but also to address one of the most common and confusing user errors: ```bash $ echo -n foo | kubectl create secret generic goodname --dry-run --from-file=bar=/dev/stdin -o json \ | kubeseal >sealed.yml $ echo -n bar | kubectl create secret generic baadname --dry-run --from-file=bar=/dev/stdin -o json \ | kubeseal --merge-into sealed.yml ``` It's even more subtle when the namespace is concerned, since it's often taken from the current kubeconfig context. This PR turns `--merge-into` into what it was intended: a helper that helps, leaning more on the "do what I mean" rather than blindly "do what I told you": It treats the state of the existing sealed secret the user is merging new values into as the home for the sensible parameters of the sealing process. A subsequent PR will do something similar for the "scope", since that also affects how the entries are encrypted and has subtle consequences when you get it wrong (and it's harder to deal with in one-liners, since you cannot set an annotation during `kubectl create secret...`). --- Enhances the tests for the mergeInto command so that they also decrypt the values. This resulted in a noisy refactoring due to the fact that until now the kubeseal code only encrypted values using a dummy public key for which we had no private key.
atomatt
approved these changes
Oct 4, 2019
bors r+ |
bors bot
added a commit
that referenced
this pull request
Oct 4, 2019
286: Force name and namespace from --merge-into target r=mkmik a=mkmik A frequent operation is to take an existing sealed secrets and update a single entry in it. We even have a fancy command now that helps this tedious operation: `--merge-into` (documented in the README). The rationale for implementing that command was not only to help lazy users to merge strings into the right place into a YAML file but also to address one of the most common and confusing user errors: ```bash $ echo -n foo | kubectl create secret generic goodname --dry-run --from-file=bar=/dev/stdin -o json \ | kubeseal >sealed.yml $ echo -n bar | kubectl create secret generic baadname --dry-run --from-file=bar=/dev/stdin -o json \ | kubeseal --merge-into sealed.yml ``` It's even more subtle when the namespace is concerned, since it's often taken from the current kubeconfig context. This PR turns `--merge-into` into what it was intended: a helper that helps, leaning more on the "do what I mean" rather than blindly "do what I told you": It treats the state of the existing sealed secret the user is merging new values into as the home for the sensible parameters of the sealing process. A subsequent PR will do something similar for the "scope", since that also affects how the entries are encrypted and has subtle consequences when you get it wrong (and it's harder to deal with in one-liners, since you cannot set an annotation during `kubectl create secret...`). Possibly relevant for #285 --- Enhances the tests for the mergeInto command so that they also decrypt the values. This resulted in a noisy refactoring due to the fact that until now the kubeseal code only encrypted values using a dummy public key for which we had no private key. Co-authored-by: Marko Mikulicic <[email protected]>
Build succeeded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A frequent operation is to take an existing sealed secrets and update a single entry in it.
We even have a fancy command now that helps this tedious operation:
--merge-into
(documented in the README).The rationale for implementing that command was not only to help lazy users to merge strings into the right place
into a YAML file but also to address one of the most common and confusing user errors:
It's even more subtle when the namespace is concerned, since it's often taken from the current kubeconfig context.
This PR turns
--merge-into
into what it was intended: a helper that helps, leaning more on the "do what I mean"rather than blindly "do what I told you":
It treats the state of the existing sealed secret the user is merging new values into as the home for the sensible
parameters of the sealing process.
A subsequent PR will do something similar for the "scope", since that also affects how the entries are encrypted and has subtle consequences when you get it wrong (and it's harder to deal with in one-liners, since you cannot set an annotation during
kubectl create secret...
).Possibly relevant for #285
Enhances the tests for the mergeInto command so that they also decrypt the values.
This resulted in a noisy refactoring due to the fact that until now the kubeseal code only encrypted values
using a dummy public key for which we had no private key.