Skip to content

VirtualMCPServer controller hot-loops Update on the vMCP backing Service (resourceVersion conflicts) when the Service is a GKE Gateway/NEG backend #5730

Closed

Description

@onepabz

Summary

A VirtualMCPServer with an embedded auth server causes the operator to issue a full client-side Update on its backing vmcp-<name> Service on every reconcile. When that Service is a GKE Gateway backend, the GKE NEG/Gateway controllers concurrently own annotations on it (cloud.google.com/neg, cloud.google.com/neg-status), so every operator Update loses the resourceVersion race and fails with the object has been modified. controller-runtime then requeues immediately → a tight hot loop (~13 updates/sec observed).

This is the Service-object sibling of #5616 (which fixed the Deployment env-var build/diff asymmetry). #5616's updates were silent no-ops; here a real concurrent writer (the cloud NEG controller) turns the churn into continuous conflict errors and a much tighter requeue loop.

Environment

Symptom

ERROR Failed to update Service controller=virtualmcpserver ... Service.Name=vmcp-mcp
  err="Operation cannot be fulfilled on services \"vmcp-mcp\": the object has been modified;
       please apply your changes to the latest version and try again"
ERROR Reconciler error controller=virtualmcpserver ... (same)

~700–835 such lines/minute, continuous. kubectl get svc vmcp-mcp shows field managers thv-operator, Google GKE Gateway Controller, and glbc all writing the object; the cloud.google.com/neg-status annotation is owned by the GKE side.

Impact

Serving is unaffected — the vMCP stays Ready=True and the Gateway is Programmed/Healthy. The cost is pure control-plane churn: elevated kube-apiserver CPU and heavy log spam (~1M+ lines/day per vMCP). Easy to miss because nothing restarts.

Root cause

The Service reconciler does a full read-modify-Update and treats any diff as actionable, but the Service is co-owned by an external controller (GKE NEG) that continuously mutates annotations the operator doesn't manage. The operator neither confines itself to its own fields nor backs off on conflict.

Suggested fix

  • Reconcile the Service via Server-Side Apply with a stable field manager, so the operator owns only the fields it sets and coexists with the NEG controller's annotations; or
  • Do a proper 3-way diff that ignores externally-managed annotations (cloud.google.com/*), and skip the Update when operator-owned fields are unchanged; and
  • Add backoff on conflict instead of immediate requeue.

Repro

Deploy a VirtualMCPServer (embedded auth server) on GKE, expose its Service through a GKE Gateway (so NEG annotations attach), and watch the operator logs.

Activity

  1. added
    needs-triage
    on Jul 6, 2026
  2. self-assigned this
    on Jul 6, 2026
  3. added
    bug
    kubernetes
    and removed
    needs-triage
    on Jul 6, 2026
  4. blkt commented on Jul 6, 2026

    @blkt
    Contributor

    Thanks for raising this, the same kind of issue impacts two other controllers as well.

  5. added 2 commits that reference this issue on Jul 6, 2026
    c7777c9
    3f6125f
  6. added a commit that references this issue on Jul 7, 2026
    8ba812e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugkubernetes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions