Fix/issue 302 clear address when not ready - #309
Conversation
Only publish status.address.url when Ready=True with reason Available, and emit a Warning event when deployment health reports DeploymentUnavailable. Fixes kubernetes-sigs#302
…e diff Drop helper refactors and duplicate tests while keeping the address guard, deployment-unavailable Warning event, and focused test updates.
|
Skipping CI for Draft Pull Request. |
✅ Deploy Preview for mcp-lifecycle-operator ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 32 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #309 +/- ##
===========================================
+ Coverage 71.77% 86.87% +15.09%
===========================================
Files 22 15 -7
Lines 2172 1813 -359
===========================================
+ Hits 1559 1575 +16
+ Misses 558 192 -366
+ Partials 55 46 -9 🚀 New features to boost your workflow:
|
Extract deployment-unavailable event emission and conditional address setting into helpers so Reconcile stays under the gocyclo limit.
Resolve conflict in mcpserver_controller.go: keep conditional status.address (issue kubernetes-sigs#302) and defer capability-change side effects from main (PR kubernetes-sigs#282).
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ibm-adarsh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@ibm-adarsh: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Fixes #302 by stopping the controller from publishing
status.address.urlwhile an MCPServer is not ready, and by emitting a Warning event when deployment health reportsDeploymentUnavailable.status.address.urlwhenReady=Truewith reasonAvailable(after a successful handshake).Problem
When a Deployment fails, the reconciler still wrote the cluster DNS URL to
status.address.urleven thoughReady=False. Clients that discover MCP endpoints from that field could get a URL that returns connection refused with no clear signal.The deployment reconcile error path already emitted Warning events; the gap was the deployment unavailable path driven by pod/deployment status (the scenario described in the issue).
Solution
mcpserver_controller.gostatus.addressonly when the server is actually availablemcpserver_controller.gomaybeEmitDeploymentUnavailableEventafterreconcileReadyConditionwhenReady=False/DeploymentUnavailableAvailablebefore asserting URLstatus.addressis unset in image-pull and crash-loop failure scenariosSmall helper extractions (
maybeEmitDeploymentUnavailableEvent,withAddressWhenAvailable) keepReconcileunder the gocyclo limit.Test plan
go test ./internal/controller/...golangci-lint run ./internal/controller/...TestImagePullFailure,TestContainerCrashLoop(address unset whenReady=False)Ready=False, nostatus.address.url, Warning event present