keepalived: create internal VRRP session only if needed
Instead of defining an empty hash by default, let's use false to disable the feature like it was documented in puppet-doc manifest. Also add a new unit test to validate the keepalived_internal_ipvs VRRP session is disabled by default. Also, validate the internal & public VIP are not the same and create a unit test for this case.
This commit is contained in:
@@ -211,7 +211,7 @@ class cloud::loadbalancer(
|
||||
$keepalived_public_interface = 'eth0',
|
||||
$keepalived_public_ipvs = ['127.0.0.1'],
|
||||
$keepalived_internal_interface = 'eth1',
|
||||
$keepalived_internal_ipvs = [],
|
||||
$keepalived_internal_ipvs = false,
|
||||
$keepalived_auth_type = undef,
|
||||
$keepalived_auth_pass = undef,
|
||||
$ceilometer_bind_options = [],
|
||||
@@ -317,7 +317,8 @@ class cloud::loadbalancer(
|
||||
notify_backup => $::cloud::params::stop_haproxy_service,
|
||||
}
|
||||
|
||||
if !empty($keepalived_internal_ipvs) {
|
||||
|
||||
if $keepalived_internal_ipvs and !empty(difference($keepalived_internal_ipvs, $keepalived_public_ipvs)) {
|
||||
if ! $keepalived_vrrp_interface {
|
||||
$keepalived_vrrp_interface_internal = $keepalived_internal_interface
|
||||
} else {
|
||||
|
@@ -62,6 +62,7 @@ describe 'cloud::loadbalancer' do
|
||||
:keepalived_vrrp_interface => false,
|
||||
:keepalived_public_interface => 'eth0',
|
||||
:keepalived_public_ipvs => ['10.0.0.1', '10.0.0.2'],
|
||||
:keepalived_internal_ipvs => false,
|
||||
:keepalived_auth_type => 'PASS',
|
||||
:keepalived_auth_pass => 'secret',
|
||||
:horizon_port => '80',
|
||||
@@ -102,6 +103,19 @@ describe 'cloud::loadbalancer' do
|
||||
)
|
||||
end
|
||||
|
||||
it 'do not configure an internal VRRP instance by default' do
|
||||
is_expected.not_to contain_keepalived__instance('2')
|
||||
end
|
||||
|
||||
context 'configure an internal VIP with the same VIP as public network' do
|
||||
before do
|
||||
params.merge!(:keepalived_internal_ipvs => ['10.0.0.1', '10.0.0.2'])
|
||||
end
|
||||
it 'shoult not configure an internal VRRP instance' do
|
||||
is_expected.not_to contain_keepalived__instance('2')
|
||||
end
|
||||
end
|
||||
|
||||
context 'configure an internal VIP' do
|
||||
before do
|
||||
params.merge!(:keepalived_internal_ipvs => ['192.168.0.1'])
|
||||
|
Reference in New Issue
Block a user