Skip to content

Add default resource limits to MCPRemoteProxy #3131

Closed

Description

@4t8dd

Problem

MCPRemoteProxy currently does not have default resource limits, which creates the same security and operational risks that were addressed for MCPServer and VirtualMCPServer in #2873.

Current Behavior

cmd/thv-operator/controllers/mcpremoteproxy_deployment.go:31

resources := ctrlutil.BuildResourceRequirements(proxy.Spec.Resources)

This only uses user-provided resources with no defaults. If spec.resources is not specified, the container gets unlimited resources.

Expected Behavior

MCPRemoteProxy should:

  1. Use proxy runner defaults (50m/200m CPU, 64Mi/256Mi memory) when spec.resources is not specified
  2. Merge user-provided values with defaults (user values take precedence)
  3. Update deploymentNeedsUpdate to check resources properly

Implementation

Apply the same pattern used for VirtualMCPServer in #2873:

func resourceRequirementsForRemoteProxy(proxy *mcpv1alpha1.MCPRemoteProxy) corev1.ResourceRequirements {
    defaultResources := ctrlutil.BuildDefaultProxyRunnerResourceRequirements()
    userResources := ctrlutil.BuildResourceRequirements(proxy.Spec.Resources)
    return ctrlutil.MergeResourceRequirements(defaultResources, userResources)
}

Then use it in:

  • deploymentForMCPRemoteProxy (line 31)
  • deploymentNeedsUpdate (line 691 in mcpremoteproxy_controller.go)

Files to Update

  • cmd/thv-operator/controllers/mcpremoteproxy_deployment.go
  • cmd/thv-operator/controllers/mcpremoteproxy_controller.go
  • Add tests similar to virtualmcpserver_deployment_test.go

Related

Security/Operational Impact

Without defaults:

  • Remote proxy containers can monopolize cluster resources
  • No protection against runaway processes
  • Inconsistent behavior across MCPServer, VirtualMCPServer, and MCPRemoteProxy

Labels

  • enhancement
  • operator
  • security
  • good first issue (pattern is well-established)

Activity

  1. enesyesil commented on Mar 10, 2026

    @enesyesil

    Hey, is this still open? I’d like to take it. Thanks

  2. reyortiz3 commented on Apr 24, 2026

    @reyortiz3
    Collaborator

    Hey @enesyesil 👋 ! Sorry, it took a while to reply. The issue is still open, if you're still interested I can assign it to you

  3. Baltsat commented on Jul 25, 2026

    @Baltsat

    I’d like to work on this. On current main, MCPRemoteProxy still builds and drift-checks container resources directly from spec.resources, so empty or partial specs omit the intended defaults. I plan to add configurable operator/Helm defaults with per-CR fields taking precedence, plus deployment-generation and drift/idempotency regressions for empty and partial overrides. Please assign me and confirm that configuration direction before I open a PR; repository-native Go and Helm verification is still pending.

  4. ChrisJBurns commented on Jul 30, 2026

    @ChrisJBurns
    Collaborator

    @Baltsat thanks for the clear plan, and apologies to both you and @enesyesil for how slowly this issue has moved. Assigning it to you.

    On the configuration direction you asked about, we would rather you scope it down. Please implement in-code defaults for the MCPRemoteProxy proxy container, with any values set in spec.resources taking precedence, and leave configurable operator or Helm-level defaults out. Introducing a cluster-wide defaulting surface is a larger design question that would apply to every controller, not just this one, and we do not want this fix waiting on it. The drift and idempotency regressions you described for empty and partial overrides are exactly right, please keep those.

    One warning that will save you time. The implementation sketch in the description references BuildDefaultProxyRunnerResourceRequirements and MergeResourceRequirements as though they already exist from #2873. As far as we can tell they do not exist in the tree today, and cmd/thv-operator/pkg/controllerutil/resources.go has only BuildResourceRequirements, which applies user values with no defaults. So you are adding the defaulting and merge logic, not reusing it. Alongside BuildResourceRequirements in that file is the natural home. Please confirm what you find, since the codebase has changed a lot in the seven months since this was filed.

    We are also removing good-first-issue. It was applied on the assumption that this was copying an established pattern, which is no longer accurate, and we would rather label the work honestly.

    @enesyesil, if you had already started on this, say so and we will sort it out between you.

  5. aponcedeleonch commented on Oct 23, 2026

    @aponcedeleonch
    Member

    Hi @Baltsat, checking in on this one. Are you still planning to work on it? Heads up that #5998 from @clxstart already follows the direction agreed above (in-code defaults with spec.resources taking precedence, plus drift checks) and has had a first review. If you've moved on to other things, let us know and we'll unassign you so the two efforts don't overlap.

  6. added a commit that references this issue on Nov 16, 2026
    35b31f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions