Secrets: change Keeper schema to treat updates as PUT operation #98325
+72
−29
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.
We have the following yaml, which we use to create a new
Keeper
.If we try to update this keeper, by changing it from
aws
togcp
for example:This would fail. By default Kubernetes will try to merge fields on an UPDATE, which means the final spec would both have
aws
andgcp
.And that's the main change of this PR, which alters the strategy used when patching (updating) Keepers. Instead of merging, we will
replace
the wholespec
.There's a trade-off. While we gain flexibility by being able to completely change all fields of the spec, we aren't able to issue partial updates (patches) anymore.
If after creating the initial keeper, we tried to update its title:
This would not work, because the validation would be missing a keeper configuration, since that's replace.
While before the change, it would use the
aws
field from the old object, and thetitle
from the new, merging them.I think that for now keeping the updates working as a PUT verb rather than PATCH is easier to reason about, but we can discuss it if needed.
Reference material I used: