Skip to content

Conversation

@yrobla
Copy link
Contributor

@yrobla yrobla commented Dec 1, 2025

Closes: #2784

@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Dec 1, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 35.63218% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.51%. Comparing base (f57d84a) to head (c034eda).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...perator/controllers/virtualmcpserver_controller.go 22.22% 35 Missing and 7 partials ⚠️
...perator/controllers/virtualmcpserver_deployment.go 53.33% 8 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2817      +/-   ##
==========================================
- Coverage   56.59%   56.51%   -0.08%     
==========================================
  Files         322      322              
  Lines       31247    31333      +86     
==========================================
+ Hits        17685    17709      +24     
- Misses      12042    12096      +54     
- Partials     1520     1528       +8     

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

Copilot finished reviewing on behalf of yrobla December 1, 2025 10:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where VirtualMCPServer CRD resources were not being reconciled when PodTemplateSpec changes were made (#2784). The fix adds detection logic for PodTemplateSpec changes and implements strategic merge patching to apply user-provided pod customizations.

Key Changes:

  • Added PodTemplateSpec validation early in the reconciliation flow to catch invalid specs before deployment creation
  • Implemented podTemplateSpecNeedsUpdate method to detect when user-provided PodTemplateSpec has changed
  • Created VirtualMCPServerPodTemplateSpecBuilder to validate and build PodTemplateSpec customizations
  • Applied strategic merge patch in applyPodTemplateSpecToDeployment to merge user customizations with controller defaults

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
virtualmcpserver_controller.go Added PodTemplateSpec validation function and change detection logic in deployment update checks
virtualmcpserver_deployment.go Implemented strategic merge patch application for PodTemplateSpec and removed obsolete TODO comment
virtualmcpserver_podtemplatespec_builder.go New builder pattern for validating and constructing PodTemplateSpec customizations
virtualmcpserver_podtemplatespec_test.go Unit tests for PodTemplateSpec builder validation and parsing
virtualmcpserver_podtemplatespec_reconcile_test.go Tests for deterministic generation and change detection of PodTemplateSpec updates
virtualmcpserver_controller_test.go Refactored to use test constants (testVmcpName, testGroupName) for consistency
mcpgroup_controller_test.go Added testGroupName constant and updated test cases to use it consistently

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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 1, 2025
@yrobla yrobla requested review from JAORMX and rdimitrov December 1, 2025 11:41
@jhrozek
Copy link
Contributor

jhrozek commented Dec 2, 2025

I think there is quite a lot of code duplication with this PR because the podTemplateSpec in this PR is nearly identical to the one used by MCPServer. I will give claude a shot at unifying those.

@jhrozek
Copy link
Contributor

jhrozek commented Dec 2, 2025

I split out the pod template spec in #2840 - let's see if it gets accepted and if yes, we should rebase this PR atop it.

@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 3, 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 3, 2025
@yrobla yrobla requested review from amirejaz and jhrozek December 3, 2025 15:44
@jhrozek
Copy link
Contributor

jhrozek commented Dec 3, 2025

Follow-up Suggestion: Status Update Pattern Consistency

In validateAndUpdatePodTemplateStatus() (virtualmcpserver_controller.go:268-323), the function updates status directly via r.Status().Update() and meta.SetStatusCondition(), while the rest of the reconciler uses the StatusManager pattern (statusManager.SetCondition(), statusManager.SetPhase(), etc.).

Consider refactoring in a follow-up to use StatusManager consistently for:

  • Avoiding potential status update conflicts
  • Consistent ObservedGeneration tracking
  • Easier maintenance

This is a minor consistency issue and doesn't block the PR.

@yrobla yrobla merged commit 859dde3 into main Dec 4, 2025
37 checks passed
@yrobla yrobla deleted the issue-2784 branch December 4, 2025 08:01
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.

vMCP CRD don't reconcile after podTemplateSpec changes

4 participants