diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 3c6768d6..64d62c4d 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -372,12 +372,13 @@ class cloud::loadbalancer( ip => $spice, port => $spice_port, options => { - 'balance' => 'leastconn', + 'mode' => 'tcp', + 'option' => ['tcpka', 'tcplog', 'forwardfor'], + 'balance' => 'source', 'timeout server' => '120m', 'timeout client' => '120m', }, bind_options => $spice_bind_options, - httpchk => 'httpchk GET /'; } cloud::loadbalancer::binding { 'trove_api_cluster': ip => $trove_api, @@ -387,7 +388,9 @@ class cloud::loadbalancer( cloud::loadbalancer::binding { 'glance_api_cluster': ip => $glance_api, options => { - 'balance' => 'leastconn', + 'mode' => 'tcp', + 'balance' => 'source', + 'option' => ['tcpka', 'tcplog', 'forwardfor'], 'timeout server' => '120m', 'timeout client' => '120m', }, diff --git a/manifests/loadbalancer/listen_http.pp b/manifests/loadbalancer/listen_http.pp index b94ee7b2..e03980ba 100644 --- a/manifests/loadbalancer/listen_http.pp +++ b/manifests/loadbalancer/listen_http.pp @@ -26,15 +26,20 @@ define cloud::loadbalancer::listen_http( $options_basic = {'mode' => 'http', 'balance' => 'roundrobin', - 'http-check' => 'expect ! rstatus ^5', 'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] } $options_custom = merge($options_basic, $options) + if $options_custom['mode'] == 'http' { + $final_options = merge($options_custom, { 'http-check' => 'expect ! rstatus ^5' }) + } else { + $final_options = $options_custom + } + haproxy::listen { $name: ipaddress => $listen_ip, ports => $ports, - options => $options_custom, + options => $final_options, bind_options => $bind_options, } } diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index d2b48161..92247507 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -209,10 +209,9 @@ describe 'cloud::loadbalancer' do :ipaddress => [params[:vip_public_ip]], :ports => '6082', :options => { - 'mode' => 'http', - 'option' => ['tcpka', 'forwardfor', 'tcplog','httpchk GET /'], - 'http-check' => 'expect ! rstatus ^5', - 'balance' => 'leastconn', + 'mode' => 'tcp', + 'balance' => 'source', + 'option' => ['tcpka', 'tcplog', 'forwardfor'], 'timeout server' => '120m', 'timeout client' => '120m' } @@ -370,7 +369,6 @@ describe 'cloud::loadbalancer' do :ports => '443', :options => { 'mode' => 'tcp', - 'http-check' => 'expect ! rstatus ^5', 'option' => ['tcpka','forwardfor','tcplog', 'ssl-hello-chk'], 'cookie' => 'sessionid prefix', 'balance' => 'leastconn',