Repository navigation
Description
Summary
VirtualMCPServerReconciler.deploymentNeedsUpdate never compares the pod's volumes or volumeMounts. As a result, a change to any input that only affects volumes (without also changing the container env, args, or the rendered config checksum) is silently missed: the operator reports no drift, the live pod keeps its stale mounts, and the change never takes effect until the Deployment is recreated for some unrelated reason.
This is a latent correctness gap, not an active loop. It's the inverse of #5616 (which was a false-positive drift causing a hot update loop); this is a false-negative drift.
Where
deploymentNeedsUpdate (cmd/thv-operator/controllers/virtualmcpserver_controller.go:1588) delegates to:
containerNeedsUpdate(:1636) — compares container args, env, service accountdeploymentMetadataNeedsUpdatepodTemplateMetadataNeedsUpdate— compares therunconfig-checksumannotation (hash of the rendered vMCP ConfigMap content)podTemplateSpecNeedsUpdate(:1743) — compares a hash of the user-providedspec.podTemplateSpeconlyimagePullSecretsNeedsUpdate(:1782)spec.replicas
None of these compare PodSpec.Volumes or the containers' VolumeMounts.
Impact
The build path injects several volume sets the drift check can't see:
- auth-server volumes via
GenerateAuthServerVolumes(virtualmcpserver_deployment.go:179), built fromauthServerConfig.SigningKeySecretRefs,HMACSecretRefs, and the Redis TLS CA cert ref - OIDC CA-bundle volumes via
AddOIDCConfigRefCABundleVolumes(:321) - MCPServerEntry CA-bundle volumes (
:162) and telemetry CA-bundle volumes (:172)
Each volume's SecretName/ConfigMap name comes straight from a ref, but the rendered config the checksum covers references only the mounted file paths (derived from index/name), not the backing secret/configmap name. So repointing one of those refs at a different secret (e.g. rotating SigningKeySecretRefs[0].Name from keys-v1 to keys-v2) changes the desired volume but not the checksum, and the drift check returns false. The pod keeps mounting the old secret indefinitely.
Suggested fix
Mirror the existing imagePullSecretsNeedsUpdate approach (:1782): compute a deterministic hash of the desired volume + volumeMount set, store it in an annotation on the Deployment, and compare that hash in the drift chain. A hash-annotation avoids the K8s-defaulting noise that a naive reflect.DeepEqual on live PodSpec.Volumes would trip over (defaultMode, etc.), which is the same reason imagePullSecrets and podTemplateSpec already use hashes rather than direct comparison.
Related
- VirtualMCPServer with embedded auth server hot-loops Deployment updates (env-var build/diff asymmetry) #5616 — the auth-server env-var loop (opposite failure mode, same drift chain). Fixed in Fix vMCP Deployment update loop with embedded auth server #5617; this issue was called out there as a secondary observation.
- VirtualMCPServer ignores MCPOIDCConfig.caBundleRef — CA is mounted but never read #4918 — adjacent but distinct: the OIDC CA bundle is mounted but the converter never plumbs its path into the rendered vMCP config. That's a build-time config gap; this is a reconcile-time drift gap.
Activity
jstar0 commentedon Jul 17, 2026
Hi, if the previous contributor is not planning to resume #5643, I'd like to work on this.
I reviewed that PR and its maintainer feedback. I would keep the hash-annotation direction, but compute the operator-owned volume set once and reuse the same result for the pod spec and metadata hash, propagate or log builder failures instead of silently discarding them, and add isolated regressions for auth-server and CA-bundle ref changes plus steady-state/annotation-cleanup behavior.
Could a maintainer assign #5619 to me before I proceed?
aponcedeleonch commentedon Jul 22, 2026
hello @jstar0 , yes go for it! Thanks for picking this up 😄