Skip to content

fix: apply redis TLS config in manager cache and job queue - #4908

Open
Smuger wants to merge 1 commit into
dragonflyoss:mainfrom
Smuger:fix/manager-redis-tls
Open

fix: apply redis TLS config in manager cache and job queue#4908
Smuger wants to merge 1 commit into
dragonflyoss:mainfrom
Smuger:fix/manager-redis-tls

Conversation

@Smuger

@Smuger Smuger commented Jul 29, 2026

Copy link
Copy Markdown

Description

Fixes #4907. The manager cache client and job queue built their redis clients without applying database.redis.tls, so it was silently ignored (see the issue for details/repro).

This PR:

  • Adds pkgredis.NewTLSClientConfig and uses it at every redis client site, replacing the duplicated inline tlsconfig.Client blocks.
  • Threads *tls.Config through internaljob.Config into the ping options and the machinery config (Config.TLSConfig, honored by the redis broker/backend).
  • Adds unit tests (pkg/redis/tls_test.go).

No behavior change when database.redis.tls is unset (TLSConfig stays nil).

Related Issue

Fixes #4907

Motivation and Context

Connecting the manager to AWS ElastiCache for Valkey with TLS (encryption in transit) enabled. See #4907.

Testing

Verified against AWS ElastiCache for Valkey 9.0.0 with encryption in transit enabled (TLS required), using images built from this change (release v2.5.1-redis-tls):

  dragonfly-manager  --TLS :6379-->  ElastiCache Valkey 9.0.0 (in-transit encryption: ON)

  Before: plaintext -> handshake never completes -> "i/o timeout" -> CrashLoopBackOff
  After:  TLS handshake OK -> PING OK -> manager Running, schedulers register

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

The manager cache client (manager/cache/cache.go) and the async job
queue (internal/job/job.go) built their redis clients without applying
database.redis.tls, so the configured TLS settings were silently
ignored. Against a TLS-required redis (e.g. a managed redis with transit
encryption enabled) the client connected in plaintext and the initial
ping hung until timeout: "failed to ping redis: i/o timeout".

Add pkgredis.NewTLSClientConfig to build the *tls.Config once and use it
at every redis client site (manager cache, manager database, scheduler,
and the manager/scheduler job queues), replacing the duplicated inline
tlsconfig.Client blocks. Thread a *tls.Config through internaljob.Config
into both the ping health-check options and the machinery server config
(Config.TLSConfig, which the redis broker and backend honor). Add unit
tests for the helper.

Signed-off-by: smuger <krzysiek.kwietniewski@gmail.com>
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 23.33333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.46%. Comparing base (2acbb8b) to head (b976399).

Files with missing lines Patch % Lines
manager/cache/cache.go 0.00% 7 Missing ⚠️
manager/job/job.go 0.00% 7 Missing ⚠️
scheduler/job/job.go 0.00% 5 Missing ⚠️
internal/job/job.go 0.00% 2 Missing ⚠️
manager/database/database.go 0.00% 1 Missing ⚠️
scheduler/scheduler.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4908      +/-   ##
==========================================
+ Coverage   28.45%   28.46%   +0.01%     
==========================================
  Files         235      236       +1     
  Lines       23228    23242      +14     
==========================================
+ Hits         6609     6616       +7     
- Misses      16169    16176       +7     
  Partials      450      450              
Flag Coverage Δ
unittests 28.46% <23.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/redis/tls.go 100.00% <100.00%> (ø)
manager/database/database.go 0.00% <0.00%> (ø)
scheduler/scheduler.go 0.00% <0.00%> (ø)
internal/job/job.go 13.28% <0.00%> (-0.19%) ⬇️
scheduler/job/job.go 2.07% <0.00%> (-0.02%) ⬇️
manager/cache/cache.go 0.00% <0.00%> (ø)
manager/job/job.go 13.33% <0.00%> (-1.67%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manager cache and job queue ignore database.redis.tls (plaintext connect, i/o timeout)

4 participants