Skip to content

Conversation

@jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Dec 3, 2025

The vMCP implementation currently has duplicated logic between the operator and vMCP server. The operator discovers backends, resolves ExternalAuthConfigs, and embeds backend configuration into a ConfigMap. Meanwhile, the vMCP server has its own discovery code but only loads config statically from the ConfigMap at startup.

This duplication creates inconsistency risk, requires pod restarts for backend changes to take effect, and has grown the operator complex with auth resolution logic scattered across components.

This proposal flips responsibilities: the operator becomes a "dumb" infrastructure manager handling only Deployment/Service/RBAC, while vMCP becomes "smart" by running controller-runtime with informers to watch MCPServer/ExternalAuthConfig/Secret resources directly.

Relates-to: #2855

@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Dec 3, 2025
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.00%. Comparing base (e7e1f5f) to head (eae57be).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2884   +/-   ##
=======================================
  Coverage   56.00%   56.00%           
=======================================
  Files         328      328           
  Lines       32314    32314           
=======================================
+ Hits        18096    18099    +3     
+ Misses      12680    12670   -10     
- Partials     1538     1545    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 4, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 4, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 4, 2025
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 4, 2025
jhrozek and others added 4 commits December 8, 2025 21:43
The vMCP implementation currently has duplicated logic between the operator
and vMCP server. The operator discovers backends, resolves
ExternalAuthConfigs, and embeds backend configuration into a ConfigMap.
Meanwhile, the vMCP server has its own discovery code but only loads
config statically from the ConfigMap at startup.

This duplication creates inconsistency risk, requires pod restarts for
backend changes to take effect, and has grown the operator complex with
auth resolution logic scattered across components.

This proposal flips responsibilities: the operator becomes a "dumb"
infrastructure manager handling only Deployment/Service/RBAC, while
vMCP becomes "smart" by running controller-runtime with informers to
watch MCPServer/ExternalAuthConfig/Secret resources directly.

Relates-to: #2855
Clarify that vMCP's K8s API access to secrets is scoped to the same
namespace through two mechanisms:

1. RBAC: Operator creates namespace-scoped Role (not ClusterRole)
2. API design: SecretKeyRef has no Namespace field

Also document the idiomatic controller-runtime pattern for secret
change propagation using Watches() with mapping functions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Introduce two mutually exclusive discovery modes for VirtualMCPServer,
selected via outgoingAuth.source:

Dynamic mode (discovered):
- vMCP runs controller-runtime with informers
- Watches MCPServer/ExternalAuthConfig/Secret resources
- Real-time backend updates without pod restarts
- Requires namespace-scoped K8s API access

Static mode (inline):
- Operator discovers MCPServers, embeds config in ConfigMap
- All auth configuration inline in VirtualMCPServer spec
- Secrets mounted as environment variables by operator
- vMCP has zero K8s API access (no RBAC resources created)

This addresses security concerns about internet-facing vMCP pods
having K8s API access while still supporting dynamic discovery
for environments that need it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
CLI mode and K8s static mode both use one-time discovery at startup
with immutableRegistry. Only K8s dynamic mode adds controller-runtime
complexity. This simplifies implementation since CLI and K8s static
share identical vMCP binary behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/M Medium PR: 300-599 lines changed labels Dec 8, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 8, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 9, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 9, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 9, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 9, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants