fix(operator): forward default Redis password to MCPServer and MCPRemoteProxy - #6679
Conversation
…oteProxy VirtualMCPServer already fell back to TOOLHIVE_DEFAULT_REDIS_SECRET_NAME/KEY when spec.sessionStorage is unset, but MCPServer and MCPRemoteProxy only injected THV_SESSION_REDIS_PASSWORD when an explicit passwordRef was set. Both still picked up the default Redis address, so pods deployed against an authenticated global default Redis/Valkey instance connected without a password and crash-looped with "NOAUTH Authentication required". Mirror VirtualMCPServer's buildRedisPasswordEnvVar fallback in MCPServerReconciler.buildRedisPasswordEnvVar and buildRedisPasswordEnvVarForRemoteProxy so the default address and default password always travel together, while an explicit spec.sessionStorage remains authoritative and never falls through to the global default. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6679 +/- ##
==========================================
- Coverage 79.20% 79.16% -0.04%
==========================================
Files 789 789
Lines 79028 79054 +26
==========================================
- Hits 62597 62586 -11
- Misses 16426 16463 +37
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jhrozek
left a comment
There was a problem hiding this comment.
Reviewed via Claude Code — small, well-scoped fix that mirrors VirtualMCPServer's existing buildRedisPasswordEnvVar fallback logic exactly for MCPServer and MCPRemoteProxy. Explicit sessionStorage correctly short-circuits and never falls through to the global default; secret is injected via SecretKeyRef, never plaintext. Test coverage mirrors the sibling VirtualMCPServer suite (global-default injection, non-redis-provider not overridden, passwordless-default no-op). No architecture doc updates needed — this brings two controllers in line with a third's already-documented behavior.
Summary
operator.defaultRedis/global.redis) is used becausespec.sessionStorageis unset,MCPServerandMCPRemoteProxypods received the default Redis address but never the default password, so they crash-looped against an authenticated Redis/Valkey instance withNOAUTH Authentication required.VirtualMCPServeralready handled this correctly by falling back toTOOLHIVE_DEFAULT_REDIS_SECRET_NAME/TOOLHIVE_DEFAULT_REDIS_SECRET_KEYinbuildRedisPasswordEnvVarwhenspec.sessionStorageis nil.MCPServerReconciler.buildRedisPasswordEnvVarandbuildRedisPasswordEnvVarForRemoteProxy, so address and credential always travel together for the global-default path, while an explicitspec.sessionStorageon any of the three kinds remains authoritative and never falls through to the global default.secretKeyRef— never copied into the pod spec as plaintext.Fixes stacklok/stacklok-enterprise-platform#4310
Test plan
TestMCPServerBuildRedisPasswordEnvVar_GlobalDefault,_NonRedisProviderNotOverriddenByGlobal, and_PasswordlessGlobalDefault(mirrors the existingVirtualMCPServercoverage).MCPRemoteProxyasTestBuildRedisPasswordEnvVarForRemoteProxy_GlobalDefault,_NonRedisProviderNotOverriddenByGlobal,_PasswordlessGlobalDefault.go test ./cmd/thv-operator/controllers/...passes.go build ./cmd/thv-operator/...passes.🤖 Generated with Claude Code