Add ability to specify memcached port

The port defaults to hiera('memcached_authtoken_port', 11211)
for authtoken middleware and hiera('memcached_port', 11211)
for other uses. Different ports might be set for security
and performance tuning.

Change-Id: I567d6b2cd66d5eb98971cd54987c1fbea3c1da78
(cherry picked from commit f460e659ba)
This commit is contained in:
Grzegorz Grasza 2021-01-05 11:45:57 +01:00
parent cecdba0997
commit 8d5bb4b894
19 changed files with 54 additions and 37 deletions

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::aodh::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::barbican::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::cinder::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::designate::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::glance::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::gnocchi::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::heat::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::ironic::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::ironic_inspector::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -158,6 +158,10 @@
# (Optional) Array of ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('memcached_node_ips')
#
# [*memcached_port*]
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211)
#
# [*keystone_resources_managed*]
# (Optional) Enable the management of Keystone resources with Puppet.
# Can be disabled if Ansible manages these resources instead of Puppet.
@ -198,6 +202,7 @@ class tripleo::profile::base::keystone (
$keystone_federation_enabled = hiera('keystone_federation_enabled', false),
$keystone_openidc_enabled = hiera('keystone_openidc_enabled', false),
$memcached_ips = hiera('memcached_node_ips', []),
$memcached_port = hiera('memcached_port', 11211),
$keystone_resources_managed = hiera('keystone_resources_managed', true),
) {
if $::hostname == downcase($bootstrap_node) and $keystone_resources_managed {
@ -230,6 +235,7 @@ class tripleo::profile::base::keystone (
if $step >= 4 or ( $step >= 3 and $sync_db ) {
$oslomsg_rpc_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_rpc_use_ssl)))
$oslomsg_notify_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_notify_use_ssl)))
class { '::keystone':
sync_db => $sync_db,
enable_bootstrap => $sync_db,

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::manila::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::neutron::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -78,6 +78,10 @@
# (Optional) Array of ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('memcached_node_ips')
#
# [*memcached_port*]
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211)
#
# [*enable_cache*]
# (Optional) Enable the use of cache. Note that it is unsupported
# to disable this key. It is only useful for debugging purposes.
@ -98,7 +102,8 @@ class tripleo::profile::base::nova (
$oslomsg_notify_username = hiera('oslo_messaging_notify_user_name', 'guest'),
$oslomsg_notify_use_ssl = hiera('oslo_messaging_notify_use_ssl', '0'),
$step = Integer(hiera('step')),
$memcached_ips = hiera('memcached_node_ips'),
$memcached_ips = hiera('memcached_node_ips', []),
$memcached_port = hiera('memcached_port', 11211),
$enable_cache = true,
) {
@ -109,9 +114,9 @@ class tripleo::profile::base::nova (
}
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $step >= 4 or ($step >= 3 and $sync_db) {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::nova::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::octavia::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::panko::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -48,9 +48,9 @@ class tripleo::profile::base::placement::authtoken (
if $step >= 3 {
if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
$memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}"), 'inet6:')
} else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ":${memcached_port}")
}
if $secret_key {

View File

@ -67,8 +67,8 @@
# Defaults to hiera('enable_internal_tls', false)
#
# [*memcache_port*]
# (Optional) memcache port
# Defaults to 11211
# (Optional) Memcached port to use.
# Defaults to hiera('memcached_port', 11211)
#
# [*memcache_servers*]
# (Optional) List of memcache servers
@ -110,8 +110,8 @@ class tripleo::profile::base::swift::proxy (
$oslomsg_rpc_use_ssl = hiera('oslo_messaging_rpc_use_ssl', '0'),
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$memcache_port = 11211,
$memcache_servers = hiera('memcached_node_ips'),
$memcache_port = hiera('memcached_port', 11211),
$memcache_servers = hiera('memcached_node_ips', []),
$step = Integer(hiera('step')),
$swift_proxy_network = hiera('swift_proxy_network', undef),
$tls_proxy_bind_ip = undef,

View File

@ -0,0 +1,6 @@
---
features:
- |
Add ability to specify memcached port for all services. The port defaults
to hiera('memcached_authtoken_port', 11211) for authtoken middleware and
hiera('memcached_port', 11211) for other uses.