Skip to content

Add default resource limits for MCPRemoteProxy - #5998

Open
clxstart wants to merge 2 commits into
stacklok:mainfrom
clxstart:openmeta/3131-add-default-resource-limits-to-mcpremoteproxy-1785037451518
Open

Add default resource limits for MCPRemoteProxy#5998
clxstart wants to merge 2 commits into
stacklok:mainfrom
clxstart:openmeta/3131-add-default-resource-limits-to-mcpremoteproxy-1785037451518

Conversation

@clxstart

Copy link
Copy Markdown

Summary

  • Apply proxy-runner default CPU/memory requests and limits when MCPRemoteProxy omits spec.resources
  • Merge user-provided resource values over defaults so partial overrides keep missing default fields
  • Use the same effective resource calculation in deployment drift detection

Context

Fixes #3131

Without defaults, remote proxy containers can run unbounded when spec.resources is empty. This mirrors the existing VirtualMCPServer/MCPServer defaulting intent and keeps create/update paths consistent.

Default values

  • CPU request/limit: 50m / 200m
  • Memory request/limit: 64Mi / 256Mi

Test plan

  • go test ./cmd/thv-operator/pkg/controllerutil -run 'TestBuildDefaultProxyRunnerResourceRequirements|TestMergeResourceRequirements|TestEnsureRequiredEnvVars'
  • go test ./cmd/thv-operator/controllers -run 'TestDeploymentForMCPRemoteProxy|TestBuildResourceRequirements|TestResourceRequirementsForRemoteProxy|TestMCPRemoteProxyDeploymentNeedsUpdate_Resources'
  • Reviewer: verify empty spec.resources gets defaults
  • Reviewer: verify partial overrides merge correctly
  • Reviewer: verify deployments without resources are marked for update

Apply proxy-runner defaults when MCPRemoteProxy omits resource requests/limits,
merge user overrides on top of those defaults, and keep deployment drift detection
aligned with the same effective resource calculation.

Closes stacklok#3131
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Jul 27, 2026
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Jul 27, 2026
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.87879% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.19%. Comparing base (e837d69) to head (42da122).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
cmd/thv-operator/pkg/controllerutil/resources.go 85.18% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5998      +/-   ##
==========================================
+ Coverage   72.16%   72.19%   +0.03%     
==========================================
  Files         721      721              
  Lines       75069    75100      +31     
==========================================
+ Hits        54174    54222      +48     
+ Misses      17033    17018      -15     
+ Partials     3862     3860       -2     

☔ View full report in Codecov by Harness.
📢 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.

@ChrisJBurns

ChrisJBurns commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

@clxstart Thanks for the PR!

You'll need to resolve the lint failures first before we can merge

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

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add default resource limits to MCPRemoteProxy

2 participants