From c570d18f93c26f921fd7dd5260b6ba38dfcc30c4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 23 Oct 2019 11:36:29 +0900 Subject: [PATCH] Autonatically set memcache_servers for keystone cache ... so that operators can enable keystone caching with memcache easilty. Change-Id: Ie1ff8e774e3a2115ca7b19a2183c43d3c15849d6 --- manifests/profile/base/keystone.pp | 6 ++++-- spec/classes/tripleo_profile_base_keystone_spec.rb | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/manifests/profile/base/keystone.pp b/manifests/profile/base/keystone.pp index adc05d000..c4436ffb9 100644 --- a/manifests/profile/base/keystone.pp +++ b/manifests/profile/base/keystone.pp @@ -225,6 +225,8 @@ 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))) + $memcached_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211') + class { 'keystone': sync_db => $sync_db, enable_bootstrap => $sync_db, @@ -246,7 +248,8 @@ class tripleo::profile::base::keystone ( }), notification_topics => union($ceilometer_notification_topics, $barbican_notification_topics, - $extra_notification_topics) + $extra_notification_topics), + cache_memcache_servers => $memcached_servers } if 'amqp' in [$oslomsg_rpc_proto, $oslomsg_notify_proto]{ @@ -279,7 +282,6 @@ class tripleo::profile::base::keystone ( } if $keystone_openidc_enabled { - $memcached_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211') class { 'keystone::federation::openidc': memcached_servers => $memcached_servers, diff --git a/spec/classes/tripleo_profile_base_keystone_spec.rb b/spec/classes/tripleo_profile_base_keystone_spec.rb index 649cddca7..18b0496ef 100644 --- a/spec/classes/tripleo_profile_base_keystone_spec.rb +++ b/spec/classes/tripleo_profile_base_keystone_spec.rb @@ -30,6 +30,7 @@ describe 'tripleo::profile::base::keystone' do :oslomsg_notify_username => 'keystone2', :oslomsg_notify_password => 'baa', :oslomsg_notify_port => '5678', + :memcached_ips => [ '192.168.0.3', '192.168.0.4', '192.168.0.5' ], } end @@ -62,7 +63,8 @@ describe 'tripleo::profile::base::keystone' do it 'should trigger complete configuration' do is_expected.to contain_class('keystone').with( :default_transport_url => 'rabbit://keystone1:foo@192.168.0.1:1234/?ssl=0', - :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0' + :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0', + :cache_memcache_servers => [ '192.168.0.3:11211', '192.168.0.4:11211', '192.168.0.5:11211' ], ) is_expected.to contain_class('keystone::config') is_expected.to contain_class('keystone::logging') @@ -108,7 +110,8 @@ describe 'tripleo::profile::base::keystone' do it 'should trigger keystone configuration' do is_expected.to contain_class('keystone').with( :default_transport_url => 'rabbit://keystone1:foo@192.168.0.1:1234/?ssl=0', - :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0' + :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0', + :cache_memcache_servers => [ '192.168.0.3:11211', '192.168.0.4:11211', '192.168.0.5:11211' ], ) is_expected.to contain_class('keystone::config') is_expected.to contain_class('keystone::logging') @@ -134,7 +137,8 @@ describe 'tripleo::profile::base::keystone' do it 'should trigger keystone configuration' do is_expected.to contain_class('keystone').with( :default_transport_url => 'rabbit://keystone1:foo@192.168.0.1:1234/?ssl=0', - :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0' + :notification_transport_url => 'rabbit://keystone2:baa@192.168.0.2:5678/?ssl=0', + :cache_memcache_servers => [ '192.168.0.3:11211', '192.168.0.4:11211', '192.168.0.5:11211' ], ) is_expected.to contain_class('keystone::config') is_expected.to contain_class('keystone::logging')