fix(spur-k8s): keep the cancel of a deleted SpurJob - #808
Open
pre wants to merge 1 commit into
Open
Conversation
handle_deletion discarded the result of cancel_job. A job that had no Pod yet, one waiting for resources, lives only in the controller queue, so a lost cancel left it there for ever: the custom resource went away, the finalizer was removed, and nothing was left that could cancel the job. Observed with a job that asked for more CPUs than any node has. The result is now checked. A failure is logged and returned, so the finalizer retries before the SpurJob is removed. NotFound is treated as success, because it means the controller has already forgotten the job.
pre
requested review from
biluriuday,
sajmera-pensando,
sgopinath1,
shiv-tyagi and
yansun1996
as code owners
September 2, 2026 12:47
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.
Related:
Motivation
Deleting a
SpurJobwhile its job is still queued leaves the job in thecontroller's queue for good. The Kubernetes object disappears, so nothing points at
the job any more, but it keeps its place in the queue and keeps holding whatever it
was waiting for. The only way out is to cancel it by hand through the CLI, and the
operator gives no sign that anything went wrong.
Technical Details
handle_deletioncalledcancel_joband discarded the result, then removed thefinalizer regardless. Any failure, a transient connection error included, was
silent and unrecoverable, because once the finalizer is gone the operator never
sees the object again.
It now inspects the result.
NotFoundis success, since the goal is that thecontroller no longer holds the job. Any other failure returns
ReconcileError::Other, so the finalizer stays and the delete is retried on thenext reconcile until the cancel is confirmed.
Related:
Test Plan
SpurJobobject.Test Result
Environment: three node RKE2 cluster on cloud VMs, 8 vCPU and 96 GiB each, no GPU.
SpurJob.spur queueno longer holds it, and the object is gone.cargo clippy --workspace --exclude spur-ffi --all-targets --lockedreportsnothing;
cargo test --lockedpasses 3522 tests.Submission Checklist