-
Notifications
You must be signed in to change notification settings - Fork 316
fix: set leader node only when cache is warmed #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: dkarpele <[email protected]>
WalkthroughAdds leader-awareness to startup and readiness: an atomic leader flag set when the manager elects this process; readiness now passes for non-leaders immediately but requires the leader to have a warmed cache; WebhookServerRunnable gains NeedLeaderElection() to indicate it should run only on the leader. Changes
Sequence Diagram(s)sequenceDiagram
participant Pod as Pod Replica
participant Manager as Controller Manager
participant Readiness as Readiness Probe
participant Cache as Cache Warmup
Note over Pod,Manager: Pod startup
Manager->>Manager: attempt leader election
alt acquires lease
Manager-->>Pod: mgr.Elected() event
Pod->>Pod: set isLeader = true
else loses election
Pod->>Pod: isLeader remains false
end
Note over Pod,Readiness: readiness checks run
Pod->>Readiness: probe request
alt isLeader == false
Readiness-->>Pod: healthy (non-leader)
else isLeader == true
Readiness->>Cache: check warmed
alt cache warmed
Readiness-->>Pod: healthy (leader + warmed)
else cache not warmed
Readiness-->>Pod: unhealthy (leader + not warmed)
end
end
Pre-merge checks✅ Passed checks (5 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)cmd/run_test.go (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (2)
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1369 +/- ##
==========================================
- Coverage 70.80% 70.72% -0.08%
==========================================
Files 49 49
Lines 4528 4533 +5
==========================================
Hits 3206 3206
- Misses 1125 1130 +5
Partials 197 197 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Assisted-by: Gemini AI Signed-off-by: dkarpele <[email protected]>
Closes #1368
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.