Repository navigation
fix(operator): refuse to overwrite a Secret the operator does not manage - #326
Merged
Merged
Conversation
There was a problem hiding this comment.
The guard is correct. It runs inside the CreateOrUpdate mutate func, so a conflict aborts before any write. Fresh creates (ResourceVersion == "") and token targets are exempt as intended. Secrets written by earlier versions already carry ferrvault.com/managed-by, so upgrades don't trip it. TargetConflict requeues on the refresh interval through failReady, so it clears once the user deletes or annotates the Secret.
Nit (not from this PR): the annotation check only tests whether the key is present. Two FerrVaultSecrets that point at the same target name will still overwrite each other. If that matters, a follow-up could match on the controller ownerRef instead.
ferrflow Bot
added a commit
that referenced
this pull request
Oct 25, 2026
## [6.1.2] - 2026-10-25 ### Bug Fixes - fix(operator): refuse to overwrite a Secret the operator does not manage (#326)
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.
Closes #313
If the target Secret already exists without the
ferrvault.com/managed-byannotation or an owner reference to the CR, the reconcile now stops withReady=False, reasonTargetConflict, and leaves the Secret untouched. The connection token Secret keeps its existing behaviour (it is deliberately user-created).Existing reconcile fixtures that pre-created a target now carry the managed-by annotation, since they model operator-created Secrets.
Tests: unmanaged Secret untouched with condition set; managed and CR-owned Secrets still updated.