From a67a36b18c7fad59f8ffa348e655f0dca8e93fe6 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 1 Sep 2021 00:01:11 +0900 Subject: [PATCH] Redis: Remove unused implementations for clustering This change removes the following configurations currently unused in the cluster managed by Pacemaker - Replication is automatically declared by the redis resource agent. Thus there is no need to declare the "slaveof" parameter in redis.conf. - Sentinel is the software to implement clustering but it is unused in a cluster managed by the redis resource agent currently used. Change-Id: I01c9b26cb39f822b653f0115dcf0660b8c0fd7cb --- manifests/profile/base/database/redis.pp | 27 +-------- ...ripleo_profile_base_database_redis_spec.rb | 57 +------------------ 2 files changed, 5 insertions(+), 79 deletions(-) diff --git a/manifests/profile/base/database/redis.pp b/manifests/profile/base/database/redis.pp index 764136270..542292acd 100644 --- a/manifests/profile/base/database/redis.pp +++ b/manifests/profile/base/database/redis.pp @@ -18,10 +18,6 @@ # # === Parameters # -# [*redis_short_bootstrap_node_name*] -# (Optional) Hostname of Redis master -# Defaults to hiera('redis_short_bootstrap_node_name') -# # [*certificate_specs*] # (Optional) The specifications to give to certmonger for the certificate(s) # it will create. @@ -42,10 +38,6 @@ # This is set by t-h-t. # Defaults to hiera('redis_network', undef) # -# [*redis_node_ips*] -# (Optional) List of Redis node ips -# Defaults to hiera('redis_node_ips') -# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -67,11 +59,9 @@ # defaults to 6379 # class tripleo::profile::base::database::redis ( - $redis_short_bootstrap_node_name = hiera('redis_short_bootstrap_node_name'), - $certificate_specs = hiera('redis_certificate_specs', {}), + $certificate_specs = hiera('redis_certificate_specs', {}), $enable_internal_tls = hiera('enable_internal_tls', false), $redis_network = hiera('redis_network', undef), - $redis_node_ips = hiera('redis_node_ips'), $step = Integer(hiera('step')), $tls_proxy_bind_ip = undef, $tls_proxy_fqdn = undef, @@ -102,19 +92,6 @@ class tripleo::profile::base::database::redis ( notify => Class['redis'], } } - if downcase($redis_short_bootstrap_node_name) == $::hostname { - $slaveof = undef - } else { - $slaveof = "${redis_short_bootstrap_node_name} 6379" - } - class { 'redis' : - slaveof => $slaveof, - } - - if count($redis_node_ips) > 1 { - Class['tripleo::redis_notification'] -> Service['redis-sentinel'] - include redis::sentinel - include tripleo::redis_notification - } + include redis } } diff --git a/spec/classes/tripleo_profile_base_database_redis_spec.rb b/spec/classes/tripleo_profile_base_database_redis_spec.rb index 4624d2867..e634a26ab 100644 --- a/spec/classes/tripleo_profile_base_database_redis_spec.rb +++ b/spec/classes/tripleo_profile_base_database_redis_spec.rb @@ -21,77 +21,26 @@ describe 'tripleo::profile::base::database::redis' do context 'with step less than 2' do let(:params) { { - :step => 1, - :redis_short_bootstrap_node_name => 'node.example.com', - :redis_node_ips => [] + :step => 1, } } it 'should do nothing' do is_expected.to contain_class('tripleo::profile::base::database::redis') is_expected.to_not contain_class('redis') - is_expected.to_not contain_class('redis::sentinel') is_expected.to_not contain_class('tripleo::redis_notification') end end - context 'with step 2 on bootstrap node' do + context 'with step 2' do let(:params) { { - :step => 2, - :redis_short_bootstrap_node_name => 'node.example.com', - :redis_node_ips => ['10.0.0.1'] + :step => 2, } } it 'should configure redis' do is_expected.to contain_class('tripleo::profile::base::database::redis') is_expected.to contain_class('redis') - is_expected.to_not contain_class('redis::sentinel') - is_expected.to_not contain_class('tripleo::redis_notification') end end - - context 'with step 2 on bootstrap node with capital letters' do - let(:params) { { - :step => 2, - :redis_short_bootstrap_node_name => 'NODE.example.com', - :redis_node_ips => ['10.0.0.1'] - } } - - it 'should configure redis' do - is_expected.to contain_class('tripleo::profile::base::database::redis') - is_expected.to contain_class('redis').with(:slaveof => nil) - end - end - - context 'with step 2 not on bootstrap node' do - let(:params) { { - :step => 2, - :redis_short_bootstrap_node_name => 'othernode.example.com', - :redis_node_ips => ['10.0.0.1'] - } } - - it 'should configure redis' do - is_expected.to contain_class('tripleo::profile::base::database::redis') - is_expected.to contain_class('redis').with(:slaveof => "#{params[:redis_short_bootstrap_node_name]} 6379") - is_expected.to_not contain_class('redis::sentinel') - is_expected.to_not contain_class('tripleo::redis_notification') - end - end - - context 'with step 2 with multiple nodes' do - let(:params) { { - :step => 2, - :redis_short_bootstrap_node_name => 'othernode.example.com', - :redis_node_ips => ['10.0.0.1', '10.0.0.2'] - } } - - it 'should configure redis' do - is_expected.to contain_class('tripleo::profile::base::database::redis') - is_expected.to contain_class('redis').with(:slaveof => "#{params[:redis_short_bootstrap_node_name]} 6379") - is_expected.to contain_class('redis::sentinel') - is_expected.to contain_class('tripleo::redis_notification') - end - end - end on_supported_os.each do |os, facts|