Add a Redis Sentinel auth username

What does this MR do?

Adds global.redis.sentinelAuth.username so clients can authenticate to a Sentinel that uses an ACL user instead of the default user. The official Valkey chart, which the bundled chart migration guide recommends, configures Sentinel this way: a single ACL user sentinel, with default disabled. Until now the chart could only send a Sentinel password, so these Sentinels rejected every client.

global:
  redis:
    sentinelAuth:
      enabled: true
      secret: gitlab-redis-sentinel
      key: sentinel-password
      username: sentinel   # new

Connection flow

sequenceDiagram
    participant C as Client (e.g. GitLab Rails)
    participant S as Sentinel
    participant R as Redis / Valkey primary

    Note over C,S: sentinelAuth.username + sentinelAuth.secret
    C->>S: AUTH sentinel SENTINEL_PASSWORD
    S-->>C: OK
    Note right of S: Before this MR: AUTH SENTINEL_PASSWORD<br/>is rejected with WRONGPASS (default user is off)
    C->>S: SENTINEL get-master-addr-by-name MASTER_NAME
    S-->>C: primary host:port

    Note over C,R: global.redis.auth (unchanged)
    C->>R: AUTH [USER] REDIS_PASSWORD
    R-->>C: OK
    C->>R: commands

The username is only rendered when sentinelAuth.enabled is true and Sentinels are configured, so it is never rendered without a password. The Redis → Valkey migration guide gets a short note on setting it.

Clients

Every client already supports a Sentinel username in the versions the chart ships. This MR only renders it:

Client Rendered key
Rails (webservice, sidekiq, toolbox, migrations, geo-logcursor) sentinel_username
Workhorse SentinelUsername
Mailroom (delivery + arbitration) :sentinel_username
GitLab Exporter redis_sentinel_username
KAS redis.sentinel.username
Registry (cache, rate limiter) sentinelusername

The registry's local registry.redis.*.sentinelpassword overrides and its loadBalancing block are unchanged.

Tested end to end

On a fresh kind cluster with CNPG, Garage and Valkey from scripts/dev_dependencies.sh, plus a Valkey 9.1 Sentinel configured like the official chart's (user default off, user sentinel on …):

  • With username: sentinel:
    • All pods became ready, and the Rails and registry migrations completed.
    • All 14 Rails Redis stores returned PONG.
    • Sentinel's CLIENT LIST showed user=sentinel connections from Workhorse, the registry and KAS.
    • GitLab Exporter reported Sidekiq metrics.
    • An email sent to the IMAP server went through Mailroom's Redis arbitration and Sidekiq delivery (message pushed).
    • Sentinel's ACL LOG recorded no auth failures from GitLab pods.
  • Without username (negative control):
    • Sentinel logged repeated default-user auth failures from the new pods.
    • The new KAS pod crash-looped, the migrations job failed, and webservice and Sidekiq got stuck in init.
    • Restoring the username recovered everything.

Closes Support configuring a Redis Sentinel auth usern... (#6701 - closed) • Clemens Beck • 19.6

Related: Workhorse: propagate Redis ACL username in Sent... (#6554) • Norman Debald

Omnibus counterpart: Support gitlab_rails Redis sentinels_username f... (gitlab-org/omnibus-gitlab#9996) • Norman Debald

Omnibus already supports the Workhorse Sentinel username (gitlab-org/omnibus-gitlab!9579 (merged))

Umbrella: gitlab-org/omnibus-gitlab#8559.

Author checklist

For general guidance, please follow our Contributing guide.

Required

For anything in this list which will not be completed, please provide a reason in the MR discussion.

  • Merge Request Title and Description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline.
  • Documentation created/updated.
  • Tests added/updated.
  • Have you validated that your change works end-to-end on a real cluster deployment?
    • See Tested end to end above.
  • Equivalent MR/issue for omnibus-gitlab opened.
  • When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.

Reviewers checklist

🤖 Generated with Claude Code

Edited by Clemens Beck

Merge request reports

Loading
Loading