@@ -580,7 +580,7 @@ strict YAML parsing. Writing new fields (`Type`, `CABundlePath`, `Headers`)
580580to the ConfigMap before updating the vMCP binary will cause a startup failure.
581581
582582Implementation order:
583- 1 . Add ` Type ` , ` CABundlePath ` , and ` Headers ` fields to ` StaticBackendConfig `
583+ 1 . Add ` Type ` , ` CABundlePath ` , and ` HeaderEnvVars ` fields to ` StaticBackendConfig `
5845842 . Update the vMCP binary and the roundtrip test in
585585 ` pkg/vmcp/config/crd_cli_roundtrip_test.go `
5865863 . Deploy the updated vMCP image ** before** the operator starts writing these
@@ -589,11 +589,27 @@ Implementation order:
589589Additional touch points:
590590- ` listMCPRemoteEndpointsAsMap() ` — new function for ConfigMap generation
591591- ` getExternalAuthConfigNameFromWorkload() ` — add MCPRemoteEndpoint case
592- - ` headerForward.addHeadersFromSecret ` requires K8s Secret resolution at
593- ConfigMap generation time (static mode has no K8s API access at runtime)
594- - ` vmcp.Backend ` needs a ` Headers ` field for resolved header values
595592- Deployment volume mount logic for ` caBundleRef ` ConfigMaps
596593
594+ ** Header secret handling in static mode:** Secret values MUST NOT be inlined
595+ into the backend ConfigMap. Instead, the operator uses the same ` SecretKeyRef `
596+ pattern that MCPRemoteProxy already uses:
597+
598+ 1 . For each ` type: direct ` endpoint with ` addHeadersFromSecret ` entries, the
599+ operator adds ` SecretKeyRef ` environment variables to the ** vMCP Deployment**
600+ (e.g. ` TOOLHIVE_SECRET_HEADER_FORWARD_X_API_KEY_<ENDPOINT_NAME> ` ).
601+ 2 . The static backend ConfigMap stores only the env var names — never the
602+ secret values themselves.
603+ 3 . At runtime, vMCP resolves header values via the existing
604+ ` secrets.EnvironmentProvider ` , identical to how MCPRemoteProxy pods handle
605+ this today.
606+
607+ This ensures no key material is written to ConfigMaps or stored in etcd in
608+ plaintext. The trade-off is that adding or removing ` addHeadersFromSecret `
609+ entries on a direct endpoint triggers a vMCP Deployment update (and therefore
610+ a pod restart), consistent with how CA bundle changes already behave in static
611+ mode.
612+
597613** CA bundle in static mode:** The operator mounts the ` caBundleRef ` ConfigMap
598614as a volume into the vMCP pod at ` /etc/toolhive/ca-bundles/<endpoint-name>/ca.crt ` .
599615The generated backend ConfigMap includes the mount path so vMCP can construct
@@ -904,11 +920,13 @@ can manage backends) and couples backend lifecycle to vMCP reconciliation.
904920
905921### Phase 2: Static Mode Integration
906922
907- 1 . Add ` Type ` , ` CABundlePath ` , ` Headers ` fields to ` StaticBackendConfig ` ;
923+ 1 . Add ` Type ` , ` CABundlePath ` , ` HeaderEnvVars ` fields to ` StaticBackendConfig ` ;
908924 update vMCP binary and roundtrip test BEFORE operator starts writing them
9099252 . Update VirtualMCPServer controller: ` listMCPRemoteEndpointsAsMap() ` ,
910926 ` getExternalAuthConfigNameFromWorkload() ` , ConfigMap generation
911- 3 . Implement header secret resolution at ConfigMap generation time
927+ 3 . Add ` SecretKeyRef ` env vars to vMCP Deployment for ` addHeadersFromSecret `
928+ entries on ` type: direct ` endpoints; store env var names (not values) in
929+ backend ConfigMap
9129304 . Mount CA bundle ConfigMaps as volumes
9139315 . Implement post-exchange audience validation in token exchange strategy
9149326 . Extend vMCP audit middleware for ` type: direct ` (remote URL, auth outcome,
0 commit comments