Revert "Use consistent credential for Redis and Redis Sentinel"

This reverts commit 3fbd05078f.

Reason for revert:
Some deployment tools such as kolla already rely on the previous
behavior which requires authentication for only redis.

Conflicts:
	taskflow/jobs/backends/impl_redis.py

Closes-Bug: #2056656
Change-Id: I24e0272c269c6fd287234fd2d3b2754983911a7f
This commit is contained in:
Takashi Kajinami 2024-03-11 00:39:03 +09:00
parent b389cb5e93
commit 4adf2790fe
3 changed files with 12 additions and 9 deletions

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Redis job board driver no longer uses ``username`` and ``password`` for
its connections to Redis Sentinel, to restore the previous behavior which
was already used by some deployment tools. Add credential to
``sentinel_kwargs`` to enable authentication for Redis Sentinel.

View File

@ -584,12 +584,8 @@ return cmsgpack.pack(result)
sentinels = [(client_conf.pop('host'), client_conf.pop('port'))]
for fallback in conf.get('sentinel_fallbacks', []):
sentinels.append(cls._parse_sentinel(fallback))
sentinel_kwargs = conf.get('sentinel_kwargs', {})
for key in ('username', 'password', 'socket_timeout'):
if key in conf:
sentinel_kwargs.setdefault(key, conf[key])
s = sentinel.Sentinel(sentinels,
sentinel_kwargs=sentinel_kwargs,
sentinel_kwargs=conf.get('sentinel_kwargs'),
**client_conf)
return s.master_for(conf['sentinel'])
else:

View File

@ -128,7 +128,7 @@ class RedisJobboardTest(test.TestCase, base.BoardTestMixin):
'namespace': 'test',
'sentinel': 'mymaster',
'sentinel_kwargs': {
'username': 'sentineluser',
'username': 'default',
'password': 'senitelsecret'
}}
with mock.patch('redis.sentinel.Sentinel') as mock_sentinel:
@ -140,7 +140,7 @@ class RedisJobboardTest(test.TestCase, base.BoardTestMixin):
mock_sentinel.assert_called_once_with(
[('127.0.0.1', 26379)],
sentinel_kwargs={
'username': 'sentineluser',
'username': 'default',
'password': 'senitelsecret'
},
**test_conf)
@ -179,6 +179,7 @@ class RedisJobboardTest(test.TestCase, base.BoardTestMixin):
'password': 'secret',
'namespace': 'test',
'sentinel': 'mymaster',
'sentinel_kwargs': {'password': 'senitelsecret'},
'ssl': True,
'ssl_ca_certs': '/etc/ssl/certs'}
with mock.patch('redis.sentinel.Sentinel') as mock_sentinel:
@ -191,7 +192,6 @@ class RedisJobboardTest(test.TestCase, base.BoardTestMixin):
}
mock_sentinel.assert_called_once_with(
[('127.0.0.1', 26379)],
sentinel_kwargs={
'username': 'default', 'password': 'secret'},
sentinel_kwargs={'password': 'senitelsecret'},
**test_conf)
mock_sentinel().master_for.assert_called_once_with('mymaster')