Merge "loadbalancer: Adapt number of process of Haproxy"
This commit is contained in:
@@ -241,6 +241,10 @@
|
||||
# (optional) The HTTP sytle basic credentials (using login:password form)
|
||||
# Defaults to 'admin:changeme'
|
||||
#
|
||||
# [*haproxy_options*]
|
||||
# (optional) The haproxy global options
|
||||
# Defaults to {}
|
||||
#
|
||||
# [*keepalived_state*]
|
||||
# (optional) TODO
|
||||
# Defaults to 'BACKUP'
|
||||
@@ -543,6 +547,7 @@ class cloud::loadbalancer(
|
||||
$sensu_api = true,
|
||||
$redis = true,
|
||||
$haproxy_auth = 'admin:changeme',
|
||||
$haproxy_options = {},
|
||||
$keepalived_state = 'BACKUP',
|
||||
$keepalived_priority = '50',
|
||||
$keepalived_vrrp_interface = false,
|
||||
@@ -642,10 +647,24 @@ class cloud::loadbalancer(
|
||||
fail('galera_ip should be part of keepalived_public_ipvs or keepalived_internal_ipvs.')
|
||||
}
|
||||
|
||||
# TODO : Use global_options in puppetlabs-haproxy as merge in params.pp
|
||||
$haproxy_default_options = {
|
||||
'log' => "${::ipaddress} local0",
|
||||
'chroot' => '/var/lib/haproxy',
|
||||
'pidfile' => '/var/run/haproxy.pid',
|
||||
'maxconn' => '4000',
|
||||
'user' => 'haproxy',
|
||||
'group' => 'haproxy',
|
||||
'daemon' => '',
|
||||
'stats' => 'socket /var/lib/haproxy/stats',
|
||||
'nbproc' => $::processorcount
|
||||
}
|
||||
$haproxy_global_options = merge($haproxy_default_options,$haproxy_options)
|
||||
# Ensure Keepalived is started before HAproxy to avoid binding errors.
|
||||
class { 'keepalived': } ->
|
||||
class { 'haproxy':
|
||||
service_manage => true
|
||||
service_manage => true,
|
||||
global_options => $haproxy_global_options
|
||||
}
|
||||
|
||||
keepalived::vrrp_script { 'haproxy':
|
||||
|
||||
@@ -110,6 +110,31 @@ describe 'cloud::loadbalancer' do
|
||||
is_expected.not_to contain_keepalived__instance('2')
|
||||
end
|
||||
|
||||
context 'with 4 processors' do
|
||||
before :each do
|
||||
facts.merge!(
|
||||
:processorcount => '4',
|
||||
:ipaddress => '10.10.0.1'
|
||||
)
|
||||
end
|
||||
it 'configure haproxy server' do
|
||||
is_expected.to contain_class('haproxy').with(
|
||||
:service_manage => true,
|
||||
:global_options => {
|
||||
'log' => '10.10.0.1 local0',
|
||||
'chroot' => '/var/lib/haproxy',
|
||||
'pidfile' => '/var/run/haproxy.pid',
|
||||
'maxconn' => '4000',
|
||||
'user' => 'haproxy',
|
||||
'group' => 'haproxy',
|
||||
'daemon' => '',
|
||||
'stats' => 'socket /var/lib/haproxy/stats',
|
||||
'nbproc' => '4'
|
||||
}
|
||||
)
|
||||
end
|
||||
end # configure haproxy server
|
||||
|
||||
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'])
|
||||
|
||||
Reference in New Issue
Block a user