Simplify controller and add E2E tests for status reporting#3468
Conversation
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
There was a problem hiding this comment.
Pull request overview
This pull request simplifies the VirtualMCPServer controller by removing duplicate backend discovery logic (~130 lines) and delegating all backend discovery and health monitoring to the vMCP runtime via its StatusReporter mechanism. The change aligns with the architectural principle of separation of concerns: the controller manages infrastructure (RBAC, Deployment, Service, ConfigMap), while the vMCP runtime handles backend discovery, health monitoring, and status updates.
Changes:
- Removed
discoverBackends()method from controller (delegated to vMCP runtime with K8sReporter) - Removed controller-side backend discovery tests (virtualmcpserver_discover_backends_test.go)
- Removed integration test TestDiscoverBackendsWithExternalAuthConfigIntegration from virtualmcpserver_externalauth_test.go
- Added comprehensive E2E tests for status reporting (virtualmcp_status_reporting_test.go) with 2 test cases covering backend discovery, health monitoring, and failure recovery
- Added GetMCPServerDeployment helper function for E2E tests
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/thv-operator/virtualmcp/virtualmcp_status_reporting_test.go | New E2E test suite validating vMCP runtime status reporting for backend discovery and health monitoring |
| test/e2e/thv-operator/virtualmcp/helpers.go | Added GetMCPServerDeployment helper function to retrieve MCPServer deployments by name |
| cmd/thv-operator/controllers/virtualmcpserver_externalauth_test.go | Removed TestDiscoverBackendsWithExternalAuthConfigIntegration (170 lines) as backend discovery moved to runtime |
| cmd/thv-operator/controllers/virtualmcpserver_discover_backends_test.go | Deleted entire file (643 lines of controller-side backend discovery tests) |
| cmd/thv-operator/controllers/virtualmcpserver_controller.go | Removed discoverBackends method and unused imports (groups, aggregator); added comprehensive documentation explaining responsibility split |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
Large PR justification has been provided. Thank you!
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/e2e/thv-operator/virtualmcp/virtualmcp_status_reporting_test.go
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3468 +/- ##
==========================================
- Coverage 65.27% 65.25% -0.03%
==========================================
Files 399 399
Lines 38955 39004 +49
==========================================
+ Hits 25429 25452 +23
- Misses 11560 11572 +12
- Partials 1966 1980 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/e2e/thv-operator/virtualmcp/virtualmcp_status_reporting_test.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jhrozek
left a comment
There was a problem hiding this comment.
I think tightening the RBAC should be a follow-up
Simplify VirtualMCPServer controller by delegating to runtime status reporter
Remove ~1200 lines by delegating backend discovery and health monitoring
from controller to vMCP runtime StatusReporter.
Key changes:
Controller now focuses on infrastructure (RBAC, Deployment, Service).
Runtime handles discovery, health monitoring, and status updates.
Related-to: #3149
Large PR Justification
This is a cleanup pr, that removes substantial lines of code to replace with newer ones. It also includes tests to validate the new behaviour.