Repository navigation
Description
Summary
The auth server Redis storage currently supports two connection modes: standalone (addr) and Sentinel (sentinelConfig). Both use a single go-redis client that does not handle Redis Cluster topology.
This means managed Redis services that use the Redis Cluster protocol are not supported:
- GCP Memorystore for Redis Cluster — exposes a single primary endpoint but uses Cluster protocol internally; clients receive
MOVEDredirects for keys not on the primary node - AWS ElastiCache Serverless — also built on Redis Cluster protocol
What needs to change
1. New connection mode in pkg/authserver/storage/redis.go
Add a third branch in NewRedisStorage that calls redis.NewClusterClient() with a redis.ClusterOptions struct. ClusterOptions takes Addrs []string (seed nodes) instead of a single Addr. TLS handling is simpler here — no per-address dialer is needed since all nodes use the same TLS config.
2. New config types in pkg/authserver/storage/config.go
Add a ClusterConfig struct to RedisConfig (mutually exclusive with Addr and SentinelConfig) and a corresponding ClusterRunConfig for cross-process serialization.
3. Update validateConfig
The current two-way mutual exclusion (addr XOR sentinelConfig) becomes a three-way "exactly one of" check.
4. CRD + operator plumbing (cmd/thv-operator/)
- New
clusterConfigfield onRedisStorageConfiginmcpexternalauthconfig_types.go - Replace the current two-way CEL validation rule with a three-way "exactly one" rule
- New conversion path in
buildStorageRunConfiginauthserver.go - Run
task operator-generate && task operator-manifests && task crdref-genafter CRD changes
5. Authentication note
GCP Memorystore Cluster uses ACL users (RBAC), so the username field will be required in practice for that service. The optional-username work from #4994 already handles the general case correctly.
Out of scope
Redis Cluster mode does not require changes to the key prefix scheme — the existing {namespace:name} hash tag already ensures all keys for a single auth server instance land in the same hash slot, so no cross-slot operations occur.
Pending from previous related PR (#4994):
One small item worth a follow-up: the default timeouts (3s read/write, 5s dial) are likely too short for managed-service failover windows — Memorystore and ElastiCache typically take 15–30s to complete a failover, so in-flight ops will error during that window. Worth either raising the defaults or adding a note in the user guide recommending higher values for managed deployments.
References
- Upstream PR that added standalone + optional-username support: Allow standalone Redis in auth server storage #4994
- go-redis
ClusterOptions: https://pkg.go.dev/github.com/redis/go-redis/v9#ClusterOptions - GCP Memorystore Cluster RBAC: https://cloud.google.com/memorystore/docs/cluster/about-rbac
Activity
Add Redis Cluster mode support to auth server storage (#5153)