Repository navigation
[API]: Add historical node replacement scheduling for RoleSet - #2628
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces historical-node replacement scheduling for RoleSets, allowing replacement Pods to prefer nodes that previously ran the same role workload. It adds the necessary API fields, CRD updates, controller logic to track and persist node bindings via annotations, and comprehensive tests. The review feedback highlights two critical issues: first, the non-deterministic ordering of retrieved pods can shuffle bindings and trigger infinite reconciliation loops, which should be resolved by sorting the pods deterministically; second, mutating the roleSet object in-place before patching is risky and should be performed on a deep copy to prevent state inconsistency on patch failures.
5761012 to
351c0fd
Compare
031712f to
1282e8c
Compare
Signed-off-by: CYJiang <[email protected]>
1282e8c to
66698b1
Compare
Signed-off-by: CYJiang <[email protected]>
7a9680e to
18c29ae
Compare
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18c29aef71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Key: v1.LabelHostname, | ||
| Operator: v1.NodeSelectorOpIn, | ||
| Values: nodeNames, |
There was a problem hiding this comment.
Match the recorded node by metadata.name
When a cluster's kubernetes.io/hostname label differs from the Node object's name, this preference never identifies the historical node: the stored values come from pod.Spec.NodeName, but they are compared against the hostname label. Replacement Pods therefore lose the advertised locality preference in such clusters; use a MatchFields requirement for metadata.name, or resolve and persist the node's hostname label value.
Useful? React with 👍 / 👎.
|
Four findings, most severe first: |
Signed-off-by: CYJiang <[email protected]>
|
Addressed the four findings in
|
Summary
spec.roles[].updateStrategy.replacementScheduling.historicalNode.mode=Preferredto let replacement Pods prefer nodes that previously ran the same role workload.orchestration.aibrix.ai/historical-node-bindings, so remembered nodes survive controller restarts.kubernetes.io/hostnamenode affinity for replacement Pods while preserving existing hard scheduling constraints.Stateful vs Stateless behavior
worker/0remains the same logical replica after deletion and recreation. The controller records bindings such asworker/0 -> node-a, and a replacement Pod for that slot prefers the remembered node.worker -> [node-a, node-b], and rollout replacement Pods prefer those nodes.CRD/API impact
RoleSetwithspec.roles[].updateStrategy.replacementScheduling.historicalNode.StormServiceCRDs and Helm CRDs because StormService templates carry RoleSet role specs.RoleReplacementSchedulingandHistoricalNodeSchedulingPolicy.When historical nodes are used
podGroupSize > 1; the controller logs the skip reason.Fixes #2561