Merge "Redis: Remove unused implementations for clustering"

This commit is contained in:
Zuul 2021-09-10 02:40:03 +00:00 committed by Gerrit Code Review
commit d4dbac8a2a
2 changed files with 5 additions and 79 deletions

View File

@ -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
}
}

View File

@ -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|