Skip to content

Expose InsecureAllowHTTP on EmbeddedAuthServerConfig CRD for VirtualMCPServer #5668

Closed

Description

@tgrunnagle

Blocks #5660

PR #5660 (cross-pod session restore E2E test with upstreamInject) will not land until this issue is resolved. It currently uses an interim auto-inference workaround in BuildAuthServerRunConfig — resolving this issue replaces that with an explicit CRD field and admission-time validation.


Summary

The embedded auth server currently requires an https:// issuer URL unless the host is localhost or a loopback IP. For in-cluster Kubernetes deployments the issuer is the vMCP service URL (http://vmcp-<name>.<ns>.svc.cluster.local:<port>), which is HTTP over a trusted pod-to-service network where TLS is not required.

As a short-term unblock, PR #5660 added InsecureAllowHTTP to authserver.RunConfig / Config and auto-sets it in BuildAuthServerRunConfig by inspecting the issuer URL scheme. This inference is opaque to the operator user and provides no admission-time feedback when the flag is needed.

This issue tracks surfacing the flag explicitly on the EmbeddedAuthServerConfig CRD field (spec.authServerConfig) for VirtualMCPServer.

Motivation

E2E tests that wire an in-cluster OIDC provider (e.g. Dex) through the embedded auth server's upstream OAuth2 flow. Without this field, deployers using an in-cluster HTTP issuer have no CRD-level control and receive no actionable error from the operator — the pod crashes at startup with a validateIssuerURL failure instead.

PR #5660 (cross-pod session restore E2E test with upstreamInject) is the first test to hit this. Future tests that exercise the embedded AS against any in-cluster IdP will face the same constraint.

Proposed change

Scope: VirtualMCPServer only (the other two CRDs that embed EmbeddedAuthServerConfig — MCPServer and MCPRemoteProxy — are out of scope for this issue).

cmd/thv-operator/api/v1beta1/mcpexternalauthconfig_types.go

Add to EmbeddedAuthServerConfig:

// InsecureAllowHTTP permits an http:// issuer URL for non-localhost hosts.
// Only set this for in-cluster Kubernetes deployments where traffic between
// pods is on a trusted network. Production deployments reachable outside
// the cluster MUST use https://.
// +kubebuilder:default=false
// +optional
InsecureAllowHTTP bool `json:"insecureAllowHTTP,omitempty"`

Also update the Issuer field's doc comment to reference this flag.

cmd/thv-operator/controllers/virtualmcpserver_controller.go — validateAuthServerConfig

Add admission-time check: if Issuer uses http:// with a non-localhost host and InsecureAllowHTTP is false → set AuthServerConfigValidated=False with a clear remediation message. This moves the rejection from pod startup crash to a visible operator condition.

cmd/thv-operator/pkg/controllerutil/authserver.go — BuildAuthServerRunConfig

Replace the auto-inferred value with the explicit CRD field:

// Before (interim, in #5660)
InsecureAllowHTTP: strings.HasPrefix(authConfig.Issuer, "http://"),

// After
InsecureAllowHTTP: authConfig.InsecureAllowHTTP,

Regenerated artefacts

  • zz_generated.deepcopy.go — task operator-generate
  • CRD YAML in deploy/charts/ — task operator-manifests
  • docs/operator/crd-api.md — task crdref-gen

Test update

test/e2e/thv-operator/virtualmcp/virtualmcp_redis_session_test.go Context 5: add InsecureAllowHTTP: true to the WithVMCPAuthServerConfig call.

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions