Merge "loadbalancer: allow to change HAproxy monitor VIP"

This commit is contained in:
Jenkins 2014-12-01 03:55:03 +00:00 committed by Gerrit Code Review
commit 5f6b9e88d7
2 changed files with 22 additions and 1 deletions

View File

@ -184,6 +184,10 @@
# Should be part of keepalived_internal_ips # Should be part of keepalived_internal_ips
# Defaults to false (backward compatibility) # Defaults to false (backward compatibility)
# #
# [*vip_monitor_ip*]
# (optional) Array or string for monitor VIP
# Defaults to false
#
# [*firewall_settings*] # [*firewall_settings*]
# (optional) Allow to add custom parameters to firewall rules # (optional) Allow to add custom parameters to firewall rules
# Should be an hash. # Should be an hash.
@ -260,6 +264,7 @@ class cloud::loadbalancer(
$spice_port = 6082, $spice_port = 6082,
$vip_public_ip = ['127.0.0.1'], $vip_public_ip = ['127.0.0.1'],
$vip_internal_ip = false, $vip_internal_ip = false,
$vip_monitor_ip = false,
$galera_ip = ['127.0.0.1'], $galera_ip = ['127.0.0.1'],
$galera_slave = false, $galera_slave = false,
$firewall_settings = {}, $firewall_settings = {},
@ -357,8 +362,14 @@ class cloud::loadbalancer(
mode => '0644'; mode => '0644';
} }
if $vip_monitor_ip {
$vip_monitor_ip_real = $vip_monitor_ip
} else {
$vip_monitor_ip_real = $vip_public_ip
}
haproxy::listen { 'monitor': haproxy::listen { 'monitor':
ipaddress => $vip_public_ip, ipaddress => $vip_monitor_ip_real,
ports => '9300', ports => '9300',
options => { options => {
'mode' => 'http', 'mode' => 'http',

View File

@ -236,6 +236,16 @@ describe 'cloud::loadbalancer' do
)} )}
end # configure monitor haproxy listen end # configure monitor haproxy listen
context 'configure monitor haproxy listen with another vip' do
before do
params.merge!( :vip_monitor_ip => ['192.168.0.1'] )
end
it { is_expected.to contain_haproxy__listen('monitor').with(
:ipaddress => ['192.168.0.1'],
:ports => '9300'
)}
end # configure monitor haproxy listen
context 'configure galera haproxy listen' do context 'configure galera haproxy listen' do
it { is_expected.to contain_haproxy__listen('galera_cluster').with( it { is_expected.to contain_haproxy__listen('galera_cluster').with(
:ipaddress => params[:galera_ip], :ipaddress => params[:galera_ip],