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
This commit is contained in:
Takashi Kajinami 2021-09-01 00:01:11 +09:00
parent 1e57a44c7a
commit a67a36b18c
2 changed files with 5 additions and 79 deletions

View File

@ -18,10 +18,6 @@
# #
# === Parameters # === Parameters
# #
# [*redis_short_bootstrap_node_name*]
# (Optional) Hostname of Redis master
# Defaults to hiera('redis_short_bootstrap_node_name')
#
# [*certificate_specs*] # [*certificate_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s) # (Optional) The specifications to give to certmonger for the certificate(s)
# it will create. # it will create.
@ -42,10 +38,6 @@
# This is set by t-h-t. # This is set by t-h-t.
# Defaults to hiera('redis_network', undef) # Defaults to hiera('redis_network', undef)
# #
# [*redis_node_ips*]
# (Optional) List of Redis node ips
# Defaults to hiera('redis_node_ips')
#
# [*step*] # [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates # (Optional) The current step in deployment. See tripleo-heat-templates
# for more details. # for more details.
@ -67,11 +59,9 @@
# defaults to 6379 # defaults to 6379
# #
class tripleo::profile::base::database::redis ( 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), $enable_internal_tls = hiera('enable_internal_tls', false),
$redis_network = hiera('redis_network', undef), $redis_network = hiera('redis_network', undef),
$redis_node_ips = hiera('redis_node_ips'),
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$tls_proxy_bind_ip = undef, $tls_proxy_bind_ip = undef,
$tls_proxy_fqdn = undef, $tls_proxy_fqdn = undef,
@ -102,19 +92,6 @@ class tripleo::profile::base::database::redis (
notify => Class['redis'], notify => Class['redis'],
} }
} }
if downcase($redis_short_bootstrap_node_name) == $::hostname { include redis
$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
}
} }
} }

View File

@ -21,77 +21,26 @@ describe 'tripleo::profile::base::database::redis' do
context 'with step less than 2' do context 'with step less than 2' do
let(:params) { { let(:params) { {
:step => 1, :step => 1,
:redis_short_bootstrap_node_name => 'node.example.com',
:redis_node_ips => []
} } } }
it 'should do nothing' do it 'should do nothing' do
is_expected.to contain_class('tripleo::profile::base::database::redis') is_expected.to contain_class('tripleo::profile::base::database::redis')
is_expected.to_not contain_class('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') is_expected.to_not contain_class('tripleo::redis_notification')
end end
end end
context 'with step 2 on bootstrap node' do context 'with step 2' do
let(:params) { { let(:params) { {
:step => 2, :step => 2,
:redis_short_bootstrap_node_name => 'node.example.com',
:redis_node_ips => ['10.0.0.1']
} } } }
it 'should configure redis' do it 'should configure redis' do
is_expected.to contain_class('tripleo::profile::base::database::redis') is_expected.to contain_class('tripleo::profile::base::database::redis')
is_expected.to contain_class('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
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 end
on_supported_os.each do |os, facts| on_supported_os.each do |os, facts|