[Bug][RayJob] Stop spurious CR updates once the finalizer is removed - #5090
Open
zacheryasc wants to merge 1 commit into
Open
[Bug][RayJob] Stop spurious CR updates once the finalizer is removed#5090zacheryasc wants to merge 1 commit into
zacheryasc wants to merge 1 commit into
Conversation
zacheryasc
requested review from
MortalHappiness,
andrewsykim,
kevin85421 and
rueian
as code owners
August 5, 2026 20:07
On the RayJob deletion path, the reconciler removed its own finalizer and issued an Update unconditionally on every reconcile. When another controller's finalizer keeps the RayJob alive after deletion, KubeRay's finalizer is gone after the first reconcile, yet Update kept firing every requeue, bumping resourceVersion and producing "object has been modified" conflicts for the other controller managing the same RayJob. Guard the remove+update behind controllerutil.ContainsFinalizer so the Update only fires while the finalizer is still present. Add TestReconcileRayJobDeletionFinalizer: - own finalizer present: removed once, an external finalizer preserved; - own finalizer already absent: no Update is issued. Closes ray-project#1626 Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
zacheryasc
force-pushed
the
fix/rayjob-finalizer-spurious-update
branch
from
August 7, 2026 08:33
9ba526b to
271b9ba
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 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.
Why are these changes needed?
On the RayJob deletion path, the reconciler removed its own finalizer and issued an
Updateunconditionally on every reconcile. When another controller's finalizer keeps the RayJob alive after deletion, KubeRay's finalizer is gone after the first reconcile, yetUpdatekept firing every requeue, bumpingresourceVersionand producing "object has been modified" conflicts for the other controller managing the same RayJob.Guard the remove+update behind
controllerutil.ContainsFinalizerso theUpdateonly fires while the finalizer is still present.Adds
TestReconcileRayJobDeletionFinalizer:Updateis issued.The new test fails before the guard (
expected: 0, actual: 1Updatecalls) and passes after.Related issue number
Closes #1626
Labels
doc-updates-requiredlabel.breaking-changelabel.Checks