Repository navigation
Closed
Labels
Description
Background
The auth server storage (pkg/authserver/storage) currently requires Redis Sentinel — validateConfig hard-requires SentinelConfig, MasterName, and SentinelAddrs, and NewRedisStorage always creates a redis.NewFailoverClient.
This blocks deployments on managed Redis services such as GCP Memorystore, AWS ElastiCache (non-cluster), and Azure Cache for Redis, all of which present a single host:port endpoint and manage HA internally — they do not expose Sentinel endpoints to clients.
The pattern for supporting both modes already exists in this codebase: pkg/transport/session (RedisConfig with mutually exclusive Addr vs SentinelConfig fields, buildRedisClient branching between redis.NewClient and redis.NewFailoverClient).
What needs to be done
- Add an
Addr stringfield toRedisConfiginpkg/authserver/storage/redis.gofor standalone mode. - Relax
validateConfigto accept eitherAddr(standalone) orSentinelConfig(Sentinel) — mutually exclusive, at least one required. - Branch in
NewRedisStorage: useredis.NewClient(&redis.Options{...})for standalone, existingredis.NewFailoverClientfor Sentinel. - Simplify TLS handling for standalone mode: no per-address dialer is needed, a single
TLSConfigcan be passed directly onredis.Options. - Update the operator's
RedisRunConfigCRD type and converter (cmd/thv-operator/pkg/vmcpconfig/converter.go,cmd/thv-operator/pkg/controllerutil/authserver.go) to expose and propagate the standalone addr field. - Update unit and integration tests to cover the standalone path.
Acceptance criteria
- A ToolHive auth server can connect to a standalone Redis instance (e.g., GCP Memorystore, AWS ElastiCache) using only
Addr. - Existing Sentinel deployments are unaffected.
validateConfigreturns a clear error if neitherAddrnorSentinelConfigis set, or if both are set.- The standalone path has test coverage equivalent to the Sentinel path.
Notes
pkg/transport/sessionalready supports both modes — alignpkg/authserver/storagewith that design.pkg/ratelimit/middleware.goalready uses standalone-only (redis.NewClient) and has a TODO to share a client builder with session storage. This issue could be a stepping stone toward that consolidation.- Managed Redis services handle HA internally (failover, replica promotion) without exposing Sentinel endpoints. Requiring Sentinel actively blocks these deployments.
Reacted by Cody J. Hanson
Activity