fix reconciliation cycle - #2142
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
WalkthroughThis change adds a conditional guard to nodepool reconciliation logic, ensuring that historical scale-up failure counter checks and target-size rollbacks only occur when no in-flight task is active. The guard prevents counter-based state updates from interfering with ongoing in-flight rollback operations. ChangesReconciliation scale-up failure rollback guard
Kustomize image tag updates
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
services/manager/internal/service/reconciliation.go (1)
185-238: 💤 Low valueGuard is correct and necessary to prevent conflicting rollbacks.
The guard correctly prevents counter-based target-size rollback from modifying
state.Currentwhen an in-flight rollback task exists. Without this guard, the counter-based logic would modify the outercurrent(which isstate.Currentfrom line 61) while the diff-based rollback uses the in-flight state as current (innercurrentreassigned at line 298), leading to conflicting rollback behaviors.The implementation aligns with the reconciliation flow where in-flight failed tasks are rolled back via diff-based logic, making this guard essential for correctness.
Optional: Consider more defensive guard condition
For consistency with line 66's
hasInFlightStatecheck, the guard could also checkTask:- if state.InFlight == nil { + if state.InFlight == nil || state.InFlight.Task == nil {This would be more defensive, though the current implementation appears safe based on the codebase patterns.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@services/manager/internal/service/reconciliation.go` around lines 185 - 238, The guard that skips counter-based target-size rollback when an in-flight state exists should also ensure there is no in-flight Task; change the condition around the block that currently reads "if state.InFlight == nil" to also check the Task (e.g., run the rollback block only when state.InFlight == nil || state.InFlight.Task == nil) so you don't modify state.Current while an in-flight task-based rollback is active; update the check near the event_switch that surrounds the K8SNodePoolScaleUpFailed loop (references: state.InFlight, state.InFlight.Task, clusterResult, nodepools.FindByName, dyn.AutoscalerConfig.TargetSize).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@services/manager/internal/service/reconciliation.go`:
- Around line 185-238: The guard that skips counter-based target-size rollback
when an in-flight state exists should also ensure there is no in-flight Task;
change the condition around the block that currently reads "if state.InFlight ==
nil" to also check the Task (e.g., run the rollback block only when
state.InFlight == nil || state.InFlight.Task == nil) so you don't modify
state.Current while an in-flight task-based rollback is active; update the check
near the event_switch that surrounds the K8SNodePoolScaleUpFailed loop
(references: state.InFlight, state.InFlight.Task, clusterResult,
nodepools.FindByName, dyn.AutoscalerConfig.TargetSize).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b8c56fdb-8dee-4ec6-b826-51104279d69d
📒 Files selected for processing (1)
services/manager/internal/service/reconciliation.go
Summary by CodeRabbit