Exclude terminating pods from MCPServer ReadyReplicas count#4609
Open
olamide226 wants to merge 1 commit intostacklok:mainfrom
Open
Exclude terminating pods from MCPServer ReadyReplicas count#4609olamide226 wants to merge 1 commit intostacklok:mainfrom
olamide226 wants to merge 1 commit intostacklok:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4609 +/- ##
==========================================
+ Coverage 68.83% 68.90% +0.07%
==========================================
Files 505 505
Lines 52437 52439 +2
==========================================
+ Hits 36095 36135 +40
+ Misses 13550 13510 -40
- Partials 2792 2794 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3f0980b to
1e57da6
Compare
During rolling updates, pods with DeletionTimestamp set were still counted as ready, inflating ReadyReplicas beyond the desired replica count. Add a guard clause in categorizePodStatus() to skip pods that are being terminated. Fixes stacklok#4498
1e57da6 to
0e460c4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes inflated MCPServer status ReadyReplicas during rolling updates by excluding terminating (DeletionTimestamp set) pods from readiness counting.
Changes:
- Add an early return in
categorizePodStatus()to skip terminating pods. - Add unit-style coverage for
categorizePodStatus()and a status update test ensuring terminating-but-ready pods don’t inflateReadyReplicas.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/thv-operator/controllers/mcpserver_controller.go | Excludes terminating pods from running/pending/failed counts used to compute ReadyReplicas. |
| cmd/thv-operator/controllers/mcpserver_replicas_test.go | Adds tests validating terminating pods are excluded from categorizePodStatus and updateMCPServerStatus. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
DeletionTimestampset (terminating) were still counted as ready inMCPServerstatus, inflatingReadyReplicasbeyond the desired replica countcategorizePodStatus()to return early for terminating pods, excluding them from running/pending/failed countsFixes #4498
Type of change
Test plan
task test)task lint-fix)Changes
cmd/thv-operator/controllers/mcpserver_controller.goDeletionTimestamp != nilincategorizePodStatus()cmd/thv-operator/controllers/mcpserver_replicas_test.goDoes this introduce a user-facing change?
No — fixes incorrect status reporting during rolling updates. No API or CRD changes.