fix: batch stickiness — nodes in NodePriority finish all packages before new nodes are picked#183
Merged
fix: batch stickiness — nodes in NodePriority finish all packages before new nodes are picked#183
Conversation
…ore new nodes are picked Between packages, IntrospectNode transitions nodes from InProgress → Waiting, causing getInProgressCount() to return 0 and createNewBatch() to pick new nodes prematurely. With a Fixed 1-by-1 strategy, this meant all nodes processed in parallel instead of sequentially. GetNodesForNextBatch now checks NodePriority (via getStickyBatchNodes) before falling through to createNewBatch. Nodes already in NodePriority that aren't Complete are returned as the current sticky batch.
043a053 to
f112ddd
Compare
Packages need to know their position for kubeadm upgrades (first node runs "kubeadm upgrade apply", subsequent nodes run "kubeadm upgrade node"). - Add NodeOrderOffset to SkyhookStatus, incremented via RemoveNodePriority - Add RemoveNodePriority/NodeOrder methods on *Skyhook wrapper - Replace 3 raw delete(NodePriority) sites with RemoveNodePriority - Add SKYHOOK_NODE_ORDER to getAgentConfigEnvVars for all pods - Add name tiebreaker to node sort for deterministic ordering - Reset NodeOrderOffset and NodePriority on CLI reset - Remove omitempty from NodePriority/NodeOrderOffset so nil/0 serialize in merge patches
f112ddd to
641a42d
Compare
riceriley59
approved these changes
Mar 17, 2026
ayuskauskas
approved these changes
Mar 17, 2026
lockwobr
added a commit
that referenced
this pull request
Mar 17, 2026
lockwobr
added a commit
that referenced
this pull request
Mar 19, 2026
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.
Summary
Batch stickiness fix: Nodes picked for a batch now finish all their packages before new nodes are selected. Previously,
IntrospectNodetransitioning nodes from InProgress → Waiting between packages causedGetNodesForNextBatch()to pick new nodes prematurely — a Fixed 1-by-1 strategy would process all nodes in parallel instead of sequentially.Monotonic node ordering: Pods now receive
SKYHOOK_NODE_ORDERenv var so packages can know their position (e.g., first node runskubeadm upgrade apply, subsequent nodes runkubeadm upgrade node). Order is computed fromNodeOrderOffset + positionin the sortedNodePrioritymap, and all pruning goes throughRemoveNodePriorityto keep the offset in sync.CLI reset:
skyhook resetnow clearsNodeOrderOffsetandNodePriorityso ordering starts fresh. Removedomitemptyfrom both fields sonil/0values serialize correctly in merge patches.Test plan
RemoveNodePriority(offset increment, no-op on missing/nil),NodeOrder(offset+position, name tiebreaker),CleanupRemovedNodes(offset assertion),createPodFromPackage(monotonic order across batches),getStickyBatchNodes(sticky returned, complete excluded, anti-leak tests)SKYHOOK_NODE_ORDER=0on kind-worker config pod,SKYHOOK_NODE_ORDER=1on kind-worker2 config pod,nodeOrderOffset: 2on completed Skyhook statusnodeOrderOffset: 0afterskyhook reset