Skip to content

Add EmbeddingServerRef to VirtualMCPServer for optimizer integration#3839

Merged
aponcedeleonch merged 7 commits intomainfrom
issue-3733/pr1-auto-deploy-embedding-v2
Feb 19, 2026
Merged

Add EmbeddingServerRef to VirtualMCPServer for optimizer integration#3839
aponcedeleonch merged 7 commits intomainfrom
issue-3733/pr1-auto-deploy-embedding-v2

Conversation

@aponcedeleonch
Copy link
Copy Markdown
Member

@aponcedeleonch aponcedeleonch commented Feb 16, 2026

Related to: #3733

Add embeddingServerRef field to VirtualMCPServer, allowing it to reference an existing EmbeddingServer resource for optimizer integration. The operator validates the reference, waits for EmbeddingServer readiness, and auto-populates the optimizer config with the resolved embedding service URL.

Key changes:

  • Add EmbeddingServerRef type and spec field on VirtualMCPServerSpec
  • Add webhook validation: ref name must be non-empty, optimizer requires either embeddingServerRef or manual embeddingService
  • Auto-populate optimizer with defaults when embeddingServerRef is set without explicit optimizer config
  • Add controller-level validation for referenced EmbeddingServer existence and readiness
  • Add EmbeddingServerReady condition type and status reporting
  • Add EmbeddingServer watch so status changes trigger VirtualMCPServer reconciliation
  • Resolve embedding service URL from EmbeddingServer Status.URL into optimizer config
  • Extract runValidations helper to reduce Reconcile complexity
  • Make EmbeddingServer model and image fields optional with sensible defaults (BAAI/bge-small-en-v1.5, cpu-latest)
  • Make OptimizerConfig embeddingService optional (auto-populated by operator)
  • Update E2E tests to use a real EmbeddingServer instead of dummy values
  • Update optimizer example YAML to demonstrate the embeddingServerRef flow

Large PR Justification

  • Multiple tightly coupled changes that would break if separated: CRD types, validation, controller logic, config wiring, and status reporting all depend on each other
  • ~400 lines of auto-generated code (deepcopy, CRD YAMLs, mocks), ~400 of tests, and ~400 of logic

@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Feb 16, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 46.39175% with 104 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.81%. Comparing base (6f93aa1) to head (9d04dfd).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...perator/controllers/virtualmcpserver_controller.go 43.63% 48 Missing and 14 partials ⚠️
...perator/controllers/virtualmcpserver_vmcpconfig.go 36.58% 21 Missing and 5 partials ⚠️
...operator/controllers/virtualmcpserver_embedding.go 42.85% 14 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3839      +/-   ##
==========================================
- Coverage   66.90%   66.81%   -0.10%     
==========================================
  Files         444      445       +1     
  Lines       44305    44507     +202     
==========================================
+ Hits        29644    29736      +92     
- Misses      12352    12444      +92     
- Partials     2309     2327      +18     

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

@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from 0fc5319 to afad2d0 Compare February 17, 2026 11:48
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from afad2d0 to 2aa161e Compare February 17, 2026 13:39
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from 2aa161e to efc3374 Compare February 17, 2026 13:46
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from efc3374 to 1094c78 Compare February 17, 2026 15:11
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
yrobla
yrobla previously approved these changes Feb 17, 2026
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@github-actions github-actions bot added the size/XL Extra large PR: 1000+ lines changed label Feb 17, 2026
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from 2122127 to 125189a Compare February 17, 2026 17:29
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from b025c08 to 5eca1ee Compare February 17, 2026 18:12
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Feb 17, 2026
Copy link
Copy Markdown
Contributor

@jerm-dro jerm-dro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor changes requested, but this mostly LGTM

aponcedeleonch and others added 7 commits February 18, 2026 14:18
Add hybrid EmbeddingServer pattern to VirtualMCPServer, enabling both
inline (1:1 auto-deployed) and reference (shared) modes. This allows
multiple VirtualMCPServers to share a single EmbeddingServer resource
via embeddingServerRef, reducing GPU/memory waste when using the same
embedding model.

Key changes:
- Add EmbeddingServerRef type and spec field (mutually exclusive with
  inline embeddingServer)
- Add webhook validation enforcing mutual exclusivity and
  optimizer/embedding co-dependency rules
- Add controller-level validation for referenced EmbeddingServer
  existence and readiness
- Add EmbeddingServer watch for reference-based reconciliation
- Add EmbeddingServerReady condition type and status reporting
- Extract runValidations helper to reduce Reconcile complexity
- Update config wiring to resolve embedding service name for both modes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aponcedeleonch aponcedeleonch force-pushed the issue-3733/pr1-auto-deploy-embedding-v2 branch from d0940d8 to 9d04dfd Compare February 18, 2026 15:23
@github-actions github-actions bot removed the size/XL Extra large PR: 1000+ lines changed label Feb 18, 2026
@aponcedeleonch aponcedeleonch changed the title Auto-deploy EmbeddingServer with inline and reference support Add EmbeddingServerRef to VirtualMCPServer for optimizer integration Feb 18, 2026
Copy link
Copy Markdown
Contributor

@jerm-dro jerm-dro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Suggestion: add some integration tests to validate the integration of all this code. Examples are here: https://github.com/stacklok/toolhive/blob/issue-3733/pr2-real-tei-client/cmd/thv-operator/test-integration/embedding-server/embeddingserver_update_test.go

You can do that in a separate PR, if at all.

@aponcedeleonch aponcedeleonch merged commit 5a77918 into main Feb 19, 2026
48 of 49 checks passed
@aponcedeleonch aponcedeleonch deleted the issue-3733/pr1-auto-deploy-embedding-v2 branch February 19, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants