Skip to content

Support standalone Redis in auth server storage (no Sentinel required) #4990

Closed

Description

@reyortiz3

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 string field to RedisConfig in pkg/authserver/storage/redis.go for standalone mode.
  • Relax validateConfig to accept either Addr (standalone) or SentinelConfig (Sentinel) — mutually exclusive, at least one required.
  • Branch in NewRedisStorage: use redis.NewClient(&redis.Options{...}) for standalone, existing redis.NewFailoverClient for Sentinel.
  • Simplify TLS handling for standalone mode: no per-address dialer is needed, a single TLSConfig can be passed directly on redis.Options.
  • Update the operator's RedisRunConfig CRD 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.
  • validateConfig returns a clear error if neither Addr nor SentinelConfig is set, or if both are set.
  • The standalone path has test coverage equivalent to the Sentinel path.

Notes

  • pkg/transport/session already supports both modes — align pkg/authserver/storage with that design.
  • pkg/ratelimit/middleware.go already 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.

Activity

  1. added
    enhancement
    go
    on Apr 21, 2026
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