Skip to content

Fix/issue 302 clear address when not ready - #309

Open
ibm-adarsh wants to merge 5 commits into
kubernetes-sigs:mainfrom
ibm-adarsh:fix/issue-302-clear-address-when-not-ready
Open

Fix/issue 302 clear address when not ready#309
ibm-adarsh wants to merge 5 commits into
kubernetes-sigs:mainfrom
ibm-adarsh:fix/issue-302-clear-address-when-not-ready

Conversation

@ibm-adarsh

@ibm-adarsh ibm-adarsh commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #302 by stopping the controller from publishing status.address.url while an MCPServer is not ready, and by emitting a Warning event when deployment health reports DeploymentUnavailable.

  • Only set status.address.url when Ready=True with reason Available (after a successful handshake).
  • Emit a deduplicated Warning event on the deployment health-check path (ImagePullBackOff, CrashLoopBackOff, pods not ready, etc.), matching Service and NetworkPolicy failure behavior.

Problem

When a Deployment fails, the reconciler still wrote the cluster DNS URL to status.address.url even though Ready=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

Area Change
mcpserver_controller.go Conditionally apply status.address only when the server is actually available
mcpserver_controller.go Call maybeEmitDeploymentUnavailableEvent after reconcileReadyCondition when Ready=False / DeploymentUnavailable
Unit tests Assert address is omitted and Warning is emitted in the deployment-unavailable envtest
Unit tests Update address URL tests to reconcile through Available before asserting URL
E2E Assert status.address is unset in image-pull and crash-loop failure scenarios

Small helper extractions (maybeEmitDeploymentUnavailableEvent, withAddressWhenAvailable) keep Reconcile under the gocyclo limit.

Test plan

  • go test ./internal/controller/...
  • golangci-lint run ./internal/controller/...
  • E2E: TestImagePullFailure, TestContainerCrashLoop (address unset when Ready=False)
  • Manual: create MCPServer with bad image → Ready=False, no status.address.url, Warning event present

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.
@kubernetes-prow

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 12, 2026
@netlify

netlify Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploy Preview for mcp-lifecycle-operator ready!

Name Link
🔨 Latest commit 300a72a
🔍 Latest deploy log https://app.netlify.com/projects/mcp-lifecycle-operator/deploys/6a82d71a58fa180008cae535
😎 Deploy Preview https://deploy-preview-309--mcp-lifecycle-operator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow
kubernetes-prow Bot requested review from aliok and matzew August 12, 2026 10:51
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ibm-adarsh, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8befe2ac-034d-4b90-b8b3-f2f00531c568

📥 Commits

Reviewing files that changed from the base of the PR and between cb30327 and 300a72a.

📒 Files selected for processing (4)
  • internal/controller/mcpserver_controller.go
  • internal/controller/mcpserver_controller_service_test.go
  • internal/controller/mcpserver_controller_test.go
  • test/e2e/failure_scenarios_test.go

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.87%. Comparing base (e221991) to head (300a72a).
⚠️ Report is 10 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Extract deployment-unavailable event emission and conditional address
setting into helpers so Reconcile stays under the gocyclo limit.
@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2026
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).
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ibm-adarsh
Once this PR has been reviewed and has the lgtm label, please assign jaideepr97 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
@ibm-adarsh
ibm-adarsh marked this pull request as ready for review August 17, 2026 09:46
@kubernetes-prow
kubernetes-prow Bot requested review from mikebrow and mrunalp August 17, 2026 09:46
@ibm-adarsh ibm-adarsh changed the title [WIP]: Fix/issue 302 clear address when not ready Fix/issue 302 clear address when not ready Aug 17, 2026
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 17, 2026
@kubernetes-prow

Copy link
Copy Markdown

@ibm-adarsh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
presubmit-mcp-lifecycle-operator-e2e-test 300a72a link false /test presubmit-mcp-lifecycle-operator-e2e-test

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.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

status.address.url populated when Ready=False

1 participant