cache: Support new redis options
The oslo.cache 3.7.0 release introduced some options for redis backend and redis sentinel backend. This introduces for these parameters. Change-Id: I0386f2cc97346242549713e9663c48ca2b9444ac
This commit is contained in:
parent
dfbc0c1283
commit
e21a6c603c
@ -152,6 +152,30 @@
|
||||
# (Optional) The password for the memcached with SASL enabled
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_server*]
|
||||
# (Optional) Redis server in the format of "host:port".
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_username*]
|
||||
# (Optional) The user name for redis
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_password*]
|
||||
# (Optional) The password for redis
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_sentinels*]
|
||||
# (Optional) Redis sentinel servers in the format of host:port
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_socket_timeout*]
|
||||
# (Optional) Timeout in seconds for every call to a server
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*redis_sentinel_service_name*]
|
||||
# (Optional) Service name of the redis sentinel cluster.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*tls_enabled*]
|
||||
# (Optional) Global toggle for TLS usage when communicating with
|
||||
# the caching servers.
|
||||
@ -246,6 +270,12 @@ define oslo::cache(
|
||||
$memcache_sasl_enabled = $facts['os_service_default'],
|
||||
$memcache_username = $facts['os_service_default'],
|
||||
$memcache_password = $facts['os_service_default'],
|
||||
$redis_server = $facts['os_service_default'],
|
||||
$redis_username = $facts['os_service_default'],
|
||||
$redis_password = $facts['os_service_default'],
|
||||
$redis_sentinels = $facts['os_service_default'],
|
||||
$redis_socket_timeout = $facts['os_service_default'],
|
||||
$redis_sentinel_service_name = $facts['os_service_default'],
|
||||
$tls_enabled = $facts['os_service_default'],
|
||||
$tls_cafile = $facts['os_service_default'],
|
||||
$tls_certfile = $facts['os_service_default'],
|
||||
@ -307,7 +337,7 @@ define oslo::cache(
|
||||
tag => ['openstack'],
|
||||
})
|
||||
}
|
||||
'dogpile.cache.redis': {
|
||||
'dogpile.cache.redis', 'dogpile.cache.redis_sentinel': {
|
||||
ensure_packages('python-redis', {
|
||||
name => $::oslo::params::python_redis_package_name,
|
||||
ensure => $package_ensure,
|
||||
@ -349,6 +379,12 @@ define oslo::cache(
|
||||
'cache/memcache_sasl_enabled' => { value => $memcache_sasl_enabled },
|
||||
'cache/memcache_username' => { value => $memcache_username },
|
||||
'cache/memcache_password' => { value => $memcache_password, secret => true },
|
||||
'cache/redis_server' => { value => $redis_server },
|
||||
'cache/redis_username' => { value => $redis_username },
|
||||
'cache/redis_password' => { value => $redis_password, secret => true },
|
||||
'cache/redis_sentinels' => { value => join(any2array($redis_sentinels), ',') },
|
||||
'cache/redis_socket_timeout' => { value => $redis_socket_timeout },
|
||||
'cache/redis_sentinel_service_name' => { value => $redis_sentinel_service_name },
|
||||
'cache/tls_enabled' => { value => $tls_enabled },
|
||||
'cache/tls_cafile' => { value => $tls_cafile },
|
||||
'cache/tls_certfile' => { value => $tls_certfile },
|
||||
|
12
releasenotes/notes/cache-redis-opts-48e5d9aed33f3318.yaml
Normal file
12
releasenotes/notes/cache-redis-opts-48e5d9aed33f3318.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The ``oslo::cache`` defined resource type now supports the following new
|
||||
options for Redis backend and Redis Sentinel backend.
|
||||
|
||||
- ``redis_server``
|
||||
- ``redis_username``
|
||||
- ``redis_password``
|
||||
- ``redis_sentinels``
|
||||
- ``redis_socket_timeout``
|
||||
- ``redis_sentinel_service_name``
|
@ -29,6 +29,12 @@ describe 'oslo::cache' do
|
||||
is_expected.to contain_keystone_config('cache/memcache_sasl_enabled').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/memcache_username').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/memcache_password').with_value('<SERVICE DEFAULT>').with_secret(true)
|
||||
is_expected.to contain_keystone_config('cache/redis_server').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/redis_username').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/redis_password').with_value('<SERVICE DEFAULT>').with_secret(true)
|
||||
is_expected.to contain_keystone_config('cache/redis_sentinels').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/redis_socket_timeout').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/redis_sentinel_service_name').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/tls_enabled').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/tls_cafile').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('cache/tls_certfile').with_value('<SERVICE DEFAULT>')
|
||||
@ -67,6 +73,12 @@ describe 'oslo::cache' do
|
||||
:memcache_sasl_enabled => false,
|
||||
:memcache_username => 'sasluser',
|
||||
:memcache_password => 'saslpass',
|
||||
:redis_server => 'localhost:6379',
|
||||
:redis_username => 'redisuser',
|
||||
:redis_password => 'redispass',
|
||||
:redis_sentinels => ['host1:26379', 'host2:26379'],
|
||||
:redis_socket_timeout => 1.0,
|
||||
:redis_sentinel_service_name => 'mymaster',
|
||||
:tls_enabled => false,
|
||||
:tls_cafile => '/path/to/ssl/cafile',
|
||||
:tls_certfile => '/path/to/ssl/certfile',
|
||||
@ -103,6 +115,12 @@ describe 'oslo::cache' do
|
||||
is_expected.to contain_keystone_config('cache/memcache_sasl_enabled').with_value(false)
|
||||
is_expected.to contain_keystone_config('cache/memcache_username').with_value('sasluser')
|
||||
is_expected.to contain_keystone_config('cache/memcache_password').with_value('saslpass').with_secret(true)
|
||||
is_expected.to contain_keystone_config('cache/redis_server').with_value('localhost:6379')
|
||||
is_expected.to contain_keystone_config('cache/redis_username').with_value('redisuser')
|
||||
is_expected.to contain_keystone_config('cache/redis_password').with_value('redispass').with_secret(true)
|
||||
is_expected.to contain_keystone_config('cache/redis_sentinels').with_value('host1:26379,host2:26379')
|
||||
is_expected.to contain_keystone_config('cache/redis_socket_timeout').with_value(1.0)
|
||||
is_expected.to contain_keystone_config('cache/redis_sentinel_service_name').with_value('mymaster')
|
||||
is_expected.to contain_keystone_config('cache/tls_enabled').with_value('false')
|
||||
is_expected.to contain_keystone_config('cache/tls_cafile').with_value('/path/to/ssl/cafile')
|
||||
is_expected.to contain_keystone_config('cache/tls_certfile').with_value('/path/to/ssl/certfile')
|
||||
@ -306,14 +324,57 @@ describe 'oslo::cache' do
|
||||
context 'with redis backend' do
|
||||
let :params do
|
||||
{
|
||||
:backend => 'dogpile.cache.redis',
|
||||
:memcache_servers => ['host1:11211', 'host2:11211','[fd12:3456:789a:1::1]:11211'],
|
||||
:backend => 'dogpile.cache.redis',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures cache backend' do
|
||||
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.redis')
|
||||
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('host1:11211,host2:11211,[fd12:3456:789a:1::1]:11211')
|
||||
is_expected.to contain_package('python-redis').with(
|
||||
:ensure => 'installed',
|
||||
:name => platform_params[:python_redis_package_name],
|
||||
:tag => ['openstack'],
|
||||
)
|
||||
end
|
||||
|
||||
context 'with package_ensure set' do
|
||||
before do
|
||||
params.merge!({
|
||||
:package_ensure => 'latest'
|
||||
})
|
||||
end
|
||||
|
||||
it 'ensures status of the package' do
|
||||
is_expected.to contain_package('python-redis').with(
|
||||
:ensure => 'latest',
|
||||
:name => platform_params[:python_redis_package_name],
|
||||
:tag => ['openstack'],
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with backend package management disabled' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_backend_package => false,
|
||||
})
|
||||
end
|
||||
|
||||
it 'does not install backend package' do
|
||||
is_expected.not_to contain_package('python-redis')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with redis sentinel backend' do
|
||||
let :params do
|
||||
{
|
||||
:backend => 'dogpile.cache.redis_sentinel',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures cache backend' do
|
||||
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.redis_sentinel')
|
||||
is_expected.to contain_package('python-redis').with(
|
||||
:ensure => 'installed',
|
||||
:name => platform_params[:python_redis_package_name],
|
||||
|
Loading…
Reference in New Issue
Block a user