Skip to content

Add Redis Cluster mode support to auth server storage #5010

Closed

Description

@reyortiz3

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 MOVED redirects 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 clusterConfig field on RedisStorageConfig in mcpexternalauthconfig_types.go
  • Replace the current two-way CEL validation rule with a three-way "exactly one" rule
  • New conversion path in buildStorageRunConfig in authserver.go
  • Run task operator-generate && task operator-manifests && task crdref-gen after 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

Activity

  1. added
    enhancement
    on Apr 22, 2026
  2. added
    go
    on Apr 22, 2026
  3. added a commit that references this issue on May 6, 2026
    20ced20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authenhancementgo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions