Support gitlab_kas['redis_username'] for Redis ACL authentication

What does this MR do?

GitLab KAS cannot connect to an external Redis that uses Redis 6+ ACL authentication (username + password). Omnibus configures the Redis password for KAS but never the username, so KAS authenticates with the password only and fails with WRONGPASS.

This MR makes gitlab_kas['redis_username'] work by rendering it into the KAS config.

Unlike most services, KAS does not consume the shared redis_url: it writes the password via password_file and has no username field. So the username needs its own wiring. KAS reads the username from a dedicated username field (redis.ParseURL is not used), so it is rendered inline, not as a file.

Changes

KAS has its own Redis config plumbing, so the change is in the KAS cookbook:

  • attributes/default.rb – add gitlab_kas['redis_username'] (defaults to nil).
  • gitlab_kas.rb (library) – propagate username from the global Rails Redis settings to KAS.
  • redis_helper/gitlab_kas.rb – carry username through redis_params.
  • enable.rb – pass the username to the config template.
  • gitlab-kas-config.yml.erb – render username: under redis: (per kascfg.proto).

The change is additive: username defaults to nil, so password-only and no-auth setups are unchanged.

Result

With gitlab_kas['redis_username'] set, the generated gitlab-kas-config.yml now contains the username next to the password file:

redis:
  network: tcp
  username: my-acl-user
  password_file: /var/opt/gitlab/gitlab-kas/redis_password_file
  server:
    address: 'my-redis.example.com:6379'

Specs were added for username propagation and config rendering. All affected suites pass locally and rubocop is clean.

⚠️ Dependency / merge order

This is Draft because it builds on top of !9535 (merged), which introduces the shared Redis username plumbing (redis_credentials[:username], encode_redis_credential, etc.) that this MR relies on.

  • The diff currently includes the !9535 (merged) commits because master does not have them yet. They will disappear once this branch is rebased on master after !9535 (merged) merges.
  • This MR must only be merged after !9535 (merged) is merged.

Closes #9950 (closed). Follow-up of #9946 (closed); same pattern as #8559. Depends on !9535 (merged).

Edited by Norman Debald

Merge request reports

Loading
Loading