Repository navigation
feat(kubeseal): accept --from-file with --merge-into - #2087
Open
basitalisandhu wants to merge 1 commit into
Open
basitalisandhu wants to merge 1 commit into
basitalisandhu wants to merge 1 commit into
Conversation
Items can be added to an existing sealed secret straight from files, without building a Secret first. The new items are sealed with the scope of the target file, which also fixes merging a plain Secret into a cluster-wide or namespace-wide sealed secret. Signed-off-by: Muhammad Basit Ali <62793038+basitalisandhu@users.noreply.github.com>
basitalisandhu
requested review from
agarcia-oss and
alvneiayu
as code owners
October 28, 2026 10:16
This branch has not been deployed
This file contains hidden or 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
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.
Description of the change
--from-filenow works together with--merge-into, so an item can be added to or replaced in an existing sealed secret without building a temporary Secret first:The name and namespace already came from the target file. The scope did not: new items were sealed with the scope of the input Secret (strict unless annotated), so merging into a cluster-wide or namespace-wide file wrote items the controller can't decrypt.
SealMergingIntonow uses the target's scope unless--scopeis given. This covers the old TODO inTestMergeIntoabout scope mismatch.Benefits
This is the "update one key" flow asked for in #1689. I went with a flag instead of a
set KEY VALUEsubcommand because kubeseal has no subcommands, and reading the value from a file or stdin keeps it out of shell history andps.Possible drawbacks
None that I can see. Without
--from-file, the only behaviour change is the scope fix for non-strict targets.Applicable issues
Additional information
Tests:
TestMergeInto/cluster-wide(fails on main withno key could decrypt secret (foo)),TestSecretFromFiles, andTestMergeIntoFromFile, which seals a cluster-wide secret, merges a file item throughrunCLIand unseals it with the private key.go test ./cmd/... ./pkg/...,go vetand golangci-lint 2.15.0 pass. I also checked it by hand with a self-signed cert and--recovery-unseal.