Merge "Split out cache configuration to keystone::cache"

This commit is contained in:
Zuul 2020-04-01 15:41:53 +00:00 committed by Gerrit Code Review
commit 07b88f22dd
5 changed files with 382 additions and 254 deletions

165
manifests/cache.pp Normal file
View File

@ -0,0 +1,165 @@
#
# Module for managing keystone cache.
#
# == Parameters
#
# [*config_prefix*]
# (Optional) Prefix for building the configuration dictionary for
# the cache region. This should not need to be changed unless there
# is another dogpile.cache region with the same configuration name.
# (string value)
# Defaults to $::os_service_default
#
# [*expiration_time*]
# (Optional) Default TTL, in seconds, for any cached item in the
# dogpile.cache region. This applies to any cached method that
# doesn't have an explicit cache expiration time defined for it.
# (integer value)
# Defaults to $::os_service_default
#
# [*backend*]
# (Optional) Dogpile.cache backend module. It is recommended that
# Memcache with pooling (oslo_cache.memcache_pool) or Redis
# (dogpile.cache.redis) be used in production deployments. (string value)
# Defaults to $::os_service_default
#
# [*backend_argument*]
# (Optional) Arguments supplied to the backend module. Specify this option
# once per argument to be passed to the dogpile.cache backend.
# Example format: "<argname>:<value>". (list value)
# Defaults to $::os_service_default
#
# [*proxies*]
# (Optional) Proxy classes to import that will affect the way the
# dogpile.cache backend functions. See the dogpile.cache documentation on
# changing-backend-behavior. (list value)
# Defaults to $::os_service_default
#
# [*enabled*]
# (Optional) Global toggle for caching. (boolean value)
# Defaults to $::os_service_default
#
# [*debug_cache_backend*]
# (Optional) Extra debugging from the cache backend (cache keys,
# get/set/delete/etc calls). This is only really useful if you need
# to see the specific cache-backend get/set/delete calls with the keys/values.
# Typically this should be left set to false. (boolean value)
# Defaults to $::os_service_default
#
# [*memcache_servers*]
# (Optional) Memcache servers in the format of "host:port".
# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
# (list value)
# Defaults to $::os_service_default
#
# [*memcache_dead_retry*]
# (Optional) Number of seconds memcached server is considered dead before
# it is tried again. (dogpile.cache.memcache and oslo_cache.memcache_pool
# backends only). (integer value)
# Defaults to $::os_service_default
#
# [*memcache_socket_timeout*]
# (Optional) Timeout in seconds for every call to a server.
# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only).
# (floating point value)
# Defaults to $::os_service_default
#
# [*memcache_pool_maxsize*]
# (Optional) Max total number of open connections to every memcached server.
# (oslo_cache.memcache_pool backend only). (integer value)
# Defaults to $::os_service_default
#
# [*memcache_pool_unused_timeout*]
# (Optional) Number of seconds a connection to memcached is held unused
# in the pool before it is closed. (oslo_cache.memcache_pool backend only)
# (integer value)
# Defaults to $::os_service_default
#
# [*memcache_pool_connection_get_timeout*]
# (Optional) Number of seconds that an operation will wait to get a memcache
# client connection. (integer value)
# Defaults to $::os_service_default
#
# [*manage_backend_package*]
# (Optional) Whether to install the backend package for the cache.
# Defaults to true
#
# [*token_caching*]
# (Optional) Toggle for token system caching. This has no effect unless
# cache_backend, cache_enabled and cache_memcache_servers is set.
# Default to $::os_service_default
#
class keystone::cache(
$config_prefix = $::os_service_default,
$expiration_time = $::os_service_default,
$backend = $::os_service_default,
$backend_argument = $::os_service_default,
$proxies = $::os_service_default,
$enabled = $::os_service_default,
$debug_cache_backend = $::os_service_default,
$memcache_servers = $::os_service_default,
$memcache_dead_retry = $::os_service_default,
$memcache_socket_timeout = $::os_service_default,
$memcache_pool_maxsize = $::os_service_default,
$memcache_pool_unused_timeout = $::os_service_default,
$memcache_pool_connection_get_timeout = $::os_service_default,
$manage_backend_package = true,
$token_caching = $::os_service_default,
){
include keystone::deps
# Pick old stry hierdata to keep backword compatibility
$config_prefix_real = pick($::keystone::cache_config_prefix, $config_prefix)
$expiration_time_real = pick($::keystone::cache_expiration_time, $expiration_time)
$backend_real = pick($::keystone::cache_backend, $backend)
$backend_argument_real = pick($::keystone::cache_backend_argument, $backend_argument)
$proxies_real = pick($::keystone::cache_proxies, $proxies)
$enabled_real = pick($::keystone::cache_enabled, $enabled)
$debug_cache_backend_real = pick($::keystone::debug_cache_backend, $debug_cache_backend)
$memcache_servers_real = pick($::keystone::cache_memcache_servers, $memcache_servers)
$memcache_dead_retry_real = pick($::keystone::memcache_dead_retry_real, $memcache_dead_retry)
$memcache_socket_timeout_real = pick($::keytstone::memcache_socket_timeout_real, $memcache_socket_timeout)
$memcache_pool_maxsize_real = pick($::keystone::memcache_pool_maxsize, $memcache_pool_maxsize)
$memcache_pool_unused_timeout_real = pick($::keystone::memcache_pool_unused_timeout, $memcache_pool_unused_timeout)
$memcache_pool_connection_get_timeout_real =
pick($::keystone::memcache_pool_connection_get_timeout, $memcache_pool_connection_get_timeout)
$manage_backend_package_real = pick($::keystone::manage_backend_package_real, $manage_backend_package)
$token_caching_real = pick($::keystone::token_caching, $token_caching)
if is_string($memcache_servers_real) {
$memcache_servers_array = split($memcache_servers_real, ',')
} else {
$memcache_servers_array = $memcache_servers_real
}
if !is_service_default($memcache_servers_real) {
Service<| title == 'memcached' |> -> Anchor['keystone::service::begin']
}
keystone_config {
'memcache/dead_retry': value => $memcache_dead_retry_real;
'memcache/pool_maxsize': value => $memcache_pool_maxsize_real;
'memcache/pool_unused_timeout': value => $memcache_pool_unused_timeout_real;
'memcache/socket_timeout': value => $memcache_socket_timeout_real;
'token/caching': value => $token_caching_real;
}
oslo::cache { 'keystone_config':
config_prefix => $config_prefix_real,
expiration_time => $expiration_time_real,
backend => $backend_real,
backend_argument => $backend_argument_real,
proxies => $proxies_real,
enabled => $enabled_real,
debug_cache_backend => $debug_cache_backend_real,
memcache_servers => $memcache_servers_array,
memcache_dead_retry => $memcache_dead_retry_real,
memcache_socket_timeout => $memcache_socket_timeout_real,
memcache_pool_maxsize => $memcache_pool_maxsize_real,
memcache_pool_unused_timeout => $memcache_pool_unused_timeout_real,
memcache_pool_connection_get_timeout => $memcache_pool_connection_get_timeout_real,
manage_backend_package => $manage_backend_package_real,
}
}

View File

@ -55,59 +55,6 @@
# other than KVS, which stores events in memory.
# Defaults to true.
#
# [*cache_backend*]
# (Optional) Dogpile.cache backend module. It is recommended that Memcache with pooling
# (keystone.cache.memcache_pool) or Redis (dogpile.cache.redis) be used in production.
# This has no effect unless cache_enabled is true and cache_memcache_servers is set.
# Defaults to $::os_service_default
#
# [*cache_backend_argument*]
# (Optional) List of arguments in format of argname:value supplied to the backend module.
# Specify this option once per argument to be passed to the dogpile.cache backend.
# This has no effect unless cache_backend and cache_enabled is set.
# Default to $::os_service_default
#
# [*cache_enabled*]
# (Optional) Setting this boolean will enable the caching backend for Keystone.
# Defaults to $::os_service_default
#
# [*cache_memcache_servers*]
# (Optional) List of memcache servers to be used with the caching backend to
# configure cache/memcache_servers. This has no effect unless cache_backend
# is set and cache_enabled is true.
# Specified as a comma separated string of 'server:port,server:port' or an
# array of servers ['server:port', 'server:port'].
# Default to $::os_service_default
#
# [*debug_cache_backend*]
# (Optional) Extra debugging from the cache backend (cache keys, get/set/delete calls).
# Default to $::os_service_default
#
# [*cache_config_prefix*]
# (Optional) Prefix for building the configuration dictionary for
# the cache region. This should not need to be changed unless there
# is another dogpile.cache region with the same configuration name.
# (string value)
# Defaults to $::os_service_default
#
# [*cache_expiration_time*]
# (Optional) Default TTL, in seconds, for any cached item in the
# dogpile.cache region. This applies to any cached method that
# doesn't have an explicit cache expiration time defined for it.
# (integer value)
# Defaults to $::os_service_default
#
# [*cache_proxies*]
# (Optional) Proxy classes to import that will affect the way the
# dogpile.cache backend functions. See the dogpile.cache documentation on
# changing-backend-behavior. (list value)
# Defaults to $::os_service_default
#
# [*token_caching*]
# (Optional) Toggle for token system caching. This has no effect unless
# cache_backend, cache_enabled and cache_memcache_servers is set.
# Default to $::os_service_default
#
# [*manage_service*]
# (Optional) If Puppet should manage service startup / shutdown.
# Defaults to true.
@ -409,35 +356,6 @@
# member_role_id option; see that option for more detail.
# Defaults to $::os_service_default
#
# [*memcache_dead_retry*]
# (Optional) Number of seconds memcached server is considered dead before it
# is tried again. This is used for the cache memcache_dead_retry and the
# memcache dead_retry values.
# Defaults to $::os_service_default
#
# [*memcache_socket_timeout*]
# (Optional) Timeout in seconds for every call to a server.
# (floating point value)
# Defaults to $::os_service_default
#
# [*memcache_pool_maxsize*]
# (Optional) Max total number of open connections to every memcached server.
# Defaults to $::os_service_default
#
# [*memcache_pool_unused_timeout*]
# (Optional) Number of seconds a connection to memcached is held unused in
# the pool before it is closed.
# Defaults to $::os_service_default
#
# [*memcache_pool_connection_get_timeout*]
# (Optional) Number of seconds that an operation will wait to get a memcache
# client connection. (integer value)
# Defaults to $::os_service_default
#
# [*manage_backend_package*]
# (Optional) (Optional) Whether to install the backend package for the cache.
# Defaults to true
#
# [*policy_driver*]
# Policy backend driver. (string value)
# Defaults to $::os_service_default.
@ -564,6 +482,88 @@
# (Optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to: undef
#
# [*cache_backend*]
# (Optional) Dogpile.cache backend module. It is recommended that Memcache with pooling
# (keystone.cache.memcache_pool) or Redis (dogpile.cache.redis) be used in production.
# This has no effect unless cache_enabled is true and cache_memcache_servers is set.
# Defaults to undef
#
# [*cache_backend_argument*]
# (Optional) List of arguments in format of argname:value supplied to the backend module.
# Specify this option once per argument to be passed to the dogpile.cache backend.
# This has no effect unless cache_backend and cache_enabled is set.
# Default to undef
#
# [*cache_enabled*]
# (Optional) Setting this boolean will enable the caching backend for Keystone.
# Defaults to undef
#
# [*cache_memcache_servers*]
# (Optional) List of memcache servers to be used with the caching backend to
# configure cache/memcache_servers. This has no effect unless cache_backend
# is set and cache_enabled is true.
# Specified as a comma separated string of 'server:port,server:port' or an
# array of servers ['server:port', 'server:port'].
# Default to undef
#
# [*debug_cache_backend*]
# (Optional) Extra debugging from the cache backend (cache keys, get/set/delete calls).
# Default to undef
#
# [*cache_config_prefix*]
# (Optional) Prefix for building the configuration dictionary for
# the cache region. This should not need to be changed unless there
# is another dogpile.cache region with the same configuration name.
# (string value)
# Defaults to undef
#
# [*cache_expiration_time*]
# (Optional) Default TTL, in seconds, for any cached item in the
# dogpile.cache region. This applies to any cached method that
# doesn't have an explicit cache expiration time defined for it.
# (integer value)
# Defaults to undef
#
# [*cache_proxies*]
# (Optional) Proxy classes to import that will affect the way the
# dogpile.cache backend functions. See the dogpile.cache documentation on
# changing-backend-behavior. (list value)
# Defaults to undef
#
# [*token_caching*]
# (Optional) Toggle for token system caching. This has no effect unless
# cache_backend, cache_enabled and cache_memcache_servers is set.
# Default to undef
#
# [*memcache_dead_retry*]
# (Optional) Number of seconds memcached server is considered dead before it
# is tried again. This is used for the cache memcache_dead_retry and the
# memcache dead_retry values.
# Defaults to undef
#
# [*memcache_socket_timeout*]
# (Optional) Timeout in seconds for every call to a server.
# (floating point value)
# Defaults to undef
#
# [*memcache_pool_maxsize*]
# (Optional) Max total number of open connections to every memcached server.
# Defaults to undef
#
# [*memcache_pool_unused_timeout*]
# (Optional) Number of seconds a connection to memcached is held unused in
# the pool before it is closed.
# Defaults to undef
#
# [*memcache_pool_connection_get_timeout*]
# (Optional) Number of seconds that an operation will wait to get a memcache
# client connection. (integer value)
# Defaults to undef
#
# [*manage_backend_package*]
# (Optional) (Optional) Whether to install the backend package for the cache.
# Defaults to undef
#
# == Authors
#
# Dan Bode dan@puppetlabs.com
@ -595,15 +595,6 @@ class keystone(
$ssl_ca_key = '/etc/keystone/ssl/private/cakey.pem',
$ssl_cert_subject = '/C=US/ST=Unset/L=Unset/O=Unset/CN=localhost',
$manage_service = true,
$cache_backend = $::os_service_default,
$cache_backend_argument = $::os_service_default,
$cache_enabled = $::os_service_default,
$cache_memcache_servers = $::os_service_default,
$debug_cache_backend = $::os_service_default,
$cache_config_prefix = $::os_service_default,
$cache_expiration_time = $::os_service_default,
$cache_proxies = $::os_service_default,
$token_caching = $::os_service_default,
$enabled = true,
$database_connection = undef,
$database_idle_timeout = undef,
@ -644,12 +635,6 @@ class keystone(
$default_domain = undef,
$member_role_id = $::os_service_default,
$member_role_name = $::os_service_default,
$memcache_dead_retry = $::os_service_default,
$memcache_socket_timeout = $::os_service_default,
$memcache_pool_maxsize = $::os_service_default,
$memcache_pool_unused_timeout = $::os_service_default,
$memcache_pool_connection_get_timeout = $::os_service_default,
$manage_backend_package = true,
$policy_driver = $::os_service_default,
$using_domain_config = false,
$domain_config_directory = '/etc/keystone/domains',
@ -677,11 +662,27 @@ class keystone(
$admin_password = undef,
$enable_bootstrap = undef,
$database_min_pool_size = undef,
$cache_backend = undef,
$cache_backend_argument = undef,
$cache_enabled = undef,
$cache_memcache_servers = undef,
$debug_cache_backend = undef,
$cache_config_prefix = undef,
$cache_expiration_time = undef,
$cache_proxies = undef,
$token_caching = undef,
$memcache_dead_retry = undef,
$memcache_socket_timeout = undef,
$memcache_pool_maxsize = undef,
$memcache_pool_unused_timeout = undef,
$memcache_pool_connection_get_timeout = undef,
$manage_backend_package = undef,
) inherits keystone::params {
include keystone::deps
include keystone::logging
include keystone::policy
include keystone::cache
if $cache_dir {
warning('keystone::cache_dir is deprecated, has no effect and will be removed in a later release')
@ -832,41 +833,6 @@ class keystone(
}
}
if !is_service_default($cache_memcache_servers) {
Service<| title == 'memcached' |> -> Anchor['keystone::service::begin']
}
keystone_config {
'memcache/dead_retry': value => $memcache_dead_retry;
'memcache/pool_maxsize': value => $memcache_pool_maxsize;
'memcache/pool_unused_timeout': value => $memcache_pool_unused_timeout;
'memcache/socket_timeout': value => $memcache_socket_timeout;
'token/caching': value => $token_caching;
}
if is_string($cache_memcache_servers) {
$cache_memcache_servers_real = split($cache_memcache_servers, ',')
} else {
$cache_memcache_servers_real = $cache_memcache_servers
}
oslo::cache { 'keystone_config':
config_prefix => $cache_config_prefix,
expiration_time => $cache_expiration_time,
backend => $cache_backend,
backend_argument => $cache_backend_argument,
proxies => $cache_proxies,
enabled => $cache_enabled,
debug_cache_backend => $debug_cache_backend,
memcache_servers => $cache_memcache_servers_real,
memcache_dead_retry => $memcache_dead_retry,
memcache_socket_timeout => $memcache_socket_timeout,
memcache_pool_maxsize => $memcache_pool_maxsize,
memcache_pool_unused_timeout => $memcache_pool_unused_timeout,
memcache_pool_connection_get_timeout => $memcache_pool_connection_get_timeout,
manage_backend_package => $manage_backend_package,
}
oslo::middleware { 'keystone_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,

View File

@ -0,0 +1,26 @@
---
features:
- |
The new ``keystone::cache`` class was introduced to manage configurations
for caching in keystone.
deprecations:
- |
The following parameters for managing cache are now deprecated because of
the introduction of ``keystone::cache`` to manage cache configuration.
The parameters in ``keystone::cache`` class instead.
- ``keystone::cache_backend``
- ``keystone::cache_backend_argument``
- ``keystone::enabled``
- ``keystone::memcache_servers``
- ``keystone::debug_cache_backend``
- ``keystone::cache_config_prefix``
- ``keystone::cache_expiration_time``
- ``keystone::cache_proxies``
- ``keystone::token_caching``
- ``keystone::memcache_dead_retry``
- ``keystone::memcache_socket_timeout``
- ``keystone::memcache_pool_maxsize``
- ``keystone::memcache_pool_unused_timeout``
- ``keystone::memcache_pool_connection_get_timeout``
- ``keystone::manage_backend_package``

View File

@ -0,0 +1,93 @@
require 'spec_helper'
describe 'keystone::cache' do
shared_examples 'keystone::cache' do
context 'with default parameters' do
let :params do
{}
end
it 'configure cache default params' do
is_expected.to contain_keystone_config('memcache/dead_retry').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('token/caching').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/config_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/expiration_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/backend').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/backend_argument').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/proxies').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/debug_cache_backend').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__cache('keystone_config').with_manage_backend_package(true)
end
end
context 'with specific values' do
let :params do
{
:config_prefix => 'prefix',
:expiration_time => '3600',
:backend => 'dogpile.cache.memcached',
:backend_argument => ['url:SERVER1:12211'],
:proxies => ['proxy01:8888', 'proxy02:8888'],
:enabled => true,
:debug_cache_backend => false,
:memcache_servers => ['memcached01:11211', 'memcached02:11211'],
:memcache_dead_retry => '60',
:memcache_socket_timeout => '300.0',
:memcache_pool_maxsize => '10',
:memcache_pool_unused_timeout => '120',
:memcache_pool_connection_get_timeout => '360',
:manage_backend_package => false,
:token_caching => 'true',
}
end
it 'configure cache params' do
is_expected.to contain_keystone_config('memcache/dead_retry').with_value('60')
is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('10')
is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('120')
is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('300.0')
is_expected.to contain_keystone_config('token/caching').with_value('true')
is_expected.to contain_keystone_config('cache/config_prefix').with_value('prefix')
is_expected.to contain_keystone_config('cache/expiration_time').with_value('3600')
is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcached')
is_expected.to contain_keystone_config('cache/backend_argument').with_value('url:SERVER1:12211')
is_expected.to contain_keystone_config('cache/proxies').with_value('proxy01:8888,proxy02:8888')
is_expected.to contain_keystone_config('cache/enabled').with_value('true')
is_expected.to contain_keystone_config('cache/debug_cache_backend').with_value('false')
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('memcached01:11211,memcached02:11211')
is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('60')
is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('300.0')
is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('10')
is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('120')
is_expected.to contain_oslo__cache('keystone_config').with_manage_backend_package(false)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'keystone::cache'
end
end
end

View File

@ -380,128 +380,6 @@ describe 'keystone' do
it { is_expected.not_to contain_exec('keystone-manage db_sync') }
end
describe 'configure memcache servers if set' do
let :params do
{
'cache_backend' => 'dogpile.cache.memcached',
'cache_backend_argument' => ['url:SERVER1:12211'],
'cache_memcache_servers' => 'SERVER1:11211,SERVER2:11211,[fd12:3456:789a:1::1]:11211',
'memcache_dead_retry' => '60',
'memcache_socket_timeout' => '2.0',
'memcache_pool_maxsize' => '1000',
'memcache_pool_unused_timeout' => '60',
}
end
it { is_expected.to contain_keystone_config('cache/enabled').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('token/caching').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcached') }
it { is_expected.to contain_keystone_config('cache/backend_argument').with_value('url:SERVER1:12211') }
it { is_expected.to contain_keystone_config('memcache/dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_servers').with_value('SERVER1:11211,SERVER2:11211,inet6:[fd12:3456:789a:1::1]:11211') }
end
describe 'configure cache memcache servers if set' do
let :params do
{
'cache_backend' => 'dogpile.cache.memcached',
'cache_backend_argument' => ['url:SERVER3:12211'],
'cache_memcache_servers' => [ 'SERVER1:11211', 'SERVER2:11211', '[fd12:3456:789a:1::1]:11211' ],
'memcache_dead_retry' => '60',
'memcache_socket_timeout' => '2.0',
'memcache_pool_maxsize' => '1000',
'memcache_pool_unused_timeout' => '60',
'memcache_pool_connection_get_timeout' => '30',
'manage_backend_package' => false,
}
end
it { is_expected.to contain_keystone_config('cache/enabled').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('token/caching').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcached') }
it { is_expected.to contain_keystone_config('cache/backend_argument').with_value('url:SERVER3:12211') }
it { is_expected.to contain_keystone_config('memcache/dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('30') }
it { is_expected.to contain_keystone_config('cache/memcache_servers').with_value('SERVER1:11211,SERVER2:11211,inet6:[fd12:3456:789a:1::1]:11211') }
it { is_expected.to contain_oslo__cache('keystone_config').with_manage_backend_package(false) }
end
describe 'configure cache enabled if set' do
let :params do
{
'cache_backend' => 'dogpile.cache.memcached',
'cache_backend_argument' => ['url:SERVER3:12211'],
'cache_enabled' => true,
'cache_memcache_servers' => [ 'SERVER1:11211', 'SERVER2:11211', '[fd12:3456:789a:1::1]:11211' ],
'memcache_dead_retry' => '60',
'memcache_socket_timeout' => '2.0',
'memcache_pool_maxsize' => '1000',
'memcache_pool_unused_timeout' => '60',
'memcache_pool_connection_get_timeout' => '30',
}
end
it { is_expected.to contain_keystone_config('cache/enabled').with_value(true) }
it { is_expected.to contain_keystone_config('token/caching').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcached') }
it { is_expected.to contain_keystone_config('cache/backend_argument').with_value('url:SERVER3:12211') }
it { is_expected.to contain_keystone_config('memcache/dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('2.0') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('1000') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('30') }
it { is_expected.to contain_keystone_config('cache/memcache_servers').with_value('SERVER1:11211,SERVER2:11211,inet6:[fd12:3456:789a:1::1]:11211') }
end
describe 'configure memcache servers with a string' do
let :params do
default_params.merge({
'cache_memcache_servers' => 'SERVER1:11211,SERVER2:11211,[fd12:3456:789a:1::1]:11211'
})
end
it { is_expected.to contain_keystone_config('cache/memcache_servers').with_value('SERVER1:11211,SERVER2:11211,inet6:[fd12:3456:789a:1::1]:11211') }
end
describe 'do not configure memcache servers when not set' do
let :params do
default_params
end
it { is_expected.to contain_keystone_config("cache/enabled").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config("token/caching").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config("cache/backend").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config("cache/backend_argument").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config("cache/debug_cache_backend").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('memcache/dead_retry').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_keystone_config('cache/memcache_servers').with_value('<SERVICE DEFAULT>') }
end
describe 'when enabling SSL' do
let :params do
{