Fix cleanup replicasets to only look at those in this ns#41
Merged
Conversation
jackkleeman
force-pushed
the
fix-rs-ownership
branch
from
August 11, 2025 17:32
f5194c2 to
726588d
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 a bug where its possible for the cleanup logic to operate on replicasets in other namespaces, if there is a restatedeployment with the same name elsewhere, as we only checked the owned-by label which is just the name.
The owned-by label isn't really necessary, and was a hangover from when I thought we might want to do a label selector list. As the kube-rs caching mechanisms force us to range over all replicasets in all namespaces, a label approach doesn't make things any faster. So instead, we will check the namespace as a sense check, and then if that passes, check the uid and kind. Technically just a uid check would be sufficient, but no harm in some extra defense.