VirtualMCPServer: validate OIDC CA bundle ref (CABundleRefValidated condition)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Background
MCPServer and (as of #5630) MCPRemoteProxy both validate the OIDC CA bundle reference and surface a CABundleRefValidated status condition (Valid / NotFound / Invalid). VirtualMCPServer is now the only OIDC-capable workload type without this.
VirtualMCPServer does mount the OIDC CA bundle — cmd/thv-operator/controllers/virtualmcpserver_deployment.go:321 calls the shared ctrlutil.AddOIDCConfigRefCABundleVolumes helper via vmcp.Spec.IncomingAuth.OIDCConfigRef — but it performs no validation of the referenced ConfigMap/key and sets no condition. If the CA bundle ConfigMap is missing or the key is absent, the volume is silently mounted referencing a non-existent ConfigMap (the pod fails to start) with no kubectl-visible signal. This is exactly the silent-acceptance gap the .claude/rules/operator.md "Status Condition Parity" rule warns about.
Scope
Add validateCABundleRef + a CABundleRefValidated condition to VirtualMCPServer, mirroring the MCPRemoteProxy implementation (#5630). Investigation notes on the concrete work:
- Types: add
ConditionTypeVirtualMCPServerCABundleRefValidated+ 3 reason constants incmd/thv-operator/api/v1beta1/virtualmcpserver_types.go(mirror theTelemetryConfigRefValidatedblock). - StatusManager: vMCP routes conditions through
pkg/virtualmcpserverstatus(StatusManager/StatusCollector), not directr.Status().Update. Add aSetCABundleRefValidatedCondition(...)to the interface + collector and regenerate the mock (task gen). - Controller: add
validateCABundleRef(ctx, vmcp, statusManager)readingvmcp.Spec.IncomingAuth.OIDCConfigRef→oidcCfg.Spec.Inline.CABundleRef, reusingvalidation.ValidateCABundleSource+ ConfigMap/key existence checks. Guard withvmcp.Spec.IncomingAuth != nil. Wire intorunValidations(virtualmcpserver_controller.go) following the advisory (non-error-returning) validator pattern. - Tests: unit + envtest in
cmd/thv-operator/test-integration/virtualmcp/.
Estimated effort: comparable to #5630, slightly more plumbing due to the StatusManager/mock indirection. No new CRD spec fields, so no schema change.
Surfaced during review of #5630 (which closed the same gap for MCPRemoteProxy, ref #4113).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MCPRemoteProxy implementation from #5630, then inspect cmd/thv-operator/api/v1beta1/virtualmcpserver_types.go, pkg/virtualmcpserverstatus, and virtualmcpserver_controller.go. Run task gen for the status mock and use the unit and envtest locations under cmd/thv-operator/test-integration/virtualmcp/. Done means VirtualMCPServer reports Valid, NotFound, or Invalid for its OIDC CA bundle reference without changing the CRD schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend, infrastructure, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100