tigerquoll opened a new pull request, #1068:
URL: https://github.com/apache/yunikorn-k8shim/pull/1068

   ### What is this PR for?
   
   `removeNode` orphans every pod on the removed node's NodeInfo, including 
pods that were only *assumed* on it. An assumed pod's `Spec.NodeName` was 
stamped by the shim at assume time -- it is not an assignment the cluster made 
-- so when the node comes back, the orphan adoption path matches on a node name 
we invented ourselves: the never-bound pod is assigned to the node again, 
`Context.addNode` re-registers it, and task recovery reports an existing 
allocation to the core for a bind that never happened. A node flap (a kubelet 
re-registration, for example) is enough to create the phantom allocation of 
YUNIKORN-3355 without a single failed bind. The shim cache self-heals on the 
next informer update for the pod, but the core-side allocation persists.
   
   The fix: in `removeNode`, a pod that is still assumed is reverted instead of 
orphaned -- assumed and assigned state dropped, node name cleared on a 
`DeepCopy`, pod kept in the cache as pending. It is then simply rescheduled on 
whatever node is available, which is also the correct outcome, as the node it 
was assumed on is gone. Pods the cluster actually placed on the node keep the 
existing orphan/adopt behaviour unchanged: their assignment is real.
   
   This is the same discipline the YUNIKORN-3355 fix (#1066) established for 
`forgetPod`. Found by the invariant property fuzzer of YUNIKORN-3373 (#1067), 
whose "a pod that never bound is not assigned to a node" invariant fails on 
master via this path on every seed; with this fix (and #1066) the fuzzer passes.
   
   Note: this PR duplicates two small test helpers (`newTestNode`/`newTestPod`) 
also added by #1066; whichever merges second will be rebased to drop the 
duplicate.
   
   ### How was this patch tested?
   
   - New regression test: assume a pod, remove its node, re-add the node; 
asserts the pod is unassigned, not assumed, not orphaned, and not adopted. 
Fails on unmodified master (`assumed pod is returned as an orphan`), passes 
with the fix.
   - Companion test pins the preserved behaviour: a pod the cluster reports as 
bound to the node IS orphaned on removal and adopted on re-add.
   - Full package suites green with `-race` and deadlock detection; `make lint` 
and `make license-check` clean.
   - The YUNIKORN-3373 fuzzer, run on top of this fix plus #1066, is green over 
150+ seeds and 100k-step runs.
   
   Generated by the Author with assistance from Claude Code
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to