loadbalancer: Use binding class but keep listen_https compat

Remove the use of the listen_https class but remain compatible
with previous use of listen_https
This commit is contained in:
Yanis Guenane 2014-06-16 15:03:07 -04:00
parent 4ea212488b
commit 4b74492e1e
4 changed files with 11 additions and 61 deletions

View File

@ -55,22 +55,12 @@ define cloud::loadbalancer::binding (
fail("${ip} is not part of VIP pools.")
}
}
if 'ssl' in $bind_options {
cloud::loadbalancer::listen_https { $name :
ports => $port,
httpchk => $httpchk,
options => $options,
listen_ip => $listen_ip_real,
bind_options => $bind_options;
}
} else {
cloud::loadbalancer::listen_http { $name :
ports => $port,
httpchk => $httpchk,
options => $options,
listen_ip => $listen_ip_real,
bind_options => $bind_options;
}
cloud::loadbalancer::listen_http { $name :
ports => $port,
httpchk => $httpchk,
options => $options,
listen_ip => $listen_ip_real,
bind_options => $bind_options;
}
}

View File

@ -27,7 +27,7 @@ define cloud::loadbalancer::listen_http(
$options_basic = {'mode' => 'http',
'balance' => 'roundrobin',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka', 'tcplog', $httpchk] }
'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] }
$options_custom = merge($options_basic, $options)

View File

@ -1,40 +0,0 @@
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Define::
#
# cloud::loadbalancer::listen_https
#
define cloud::loadbalancer::listen_https(
$ports = 'unset',
$httpchk = 'ssl-hello-chk',
$options = {},
$bind_options = [],
$listen_ip = '0.0.0.0') {
$options_basic = {'mode' => 'http',
'balance' => 'roundrobin',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka', 'forwardfor', 'tcplog', $httpchk] }
$options_custom = merge($options_basic, $options)
haproxy::listen { $name:
ipaddress => $listen_ip,
ports => $ports,
options => $options_custom,
bind_options => $bind_options,
}
}

View File

@ -207,7 +207,7 @@ describe 'cloud::loadbalancer' do
:ports => '6082',
:options => {
'mode' => 'http',
'option' => ['tcpka','tcplog','httpchk GET /'],
'option' => ['tcpka', 'forwardfor', 'tcplog','httpchk GET /'],
'http-check' => 'expect ! rstatus ^5',
'balance' => 'leastconn',
'timeout server' => '120m',
@ -309,7 +309,7 @@ describe 'cloud::loadbalancer' do
:ports => '8774',
:options => {
'mode' => 'http',
'option' => ['tcpka','forwardfor','tcplog','ssl-hello-chk'],
'option' => ['tcpka','forwardfor','tcplog','httpchk'],
'http-check' => 'expect ! rstatus ^5',
'balance' => 'roundrobin',
},
@ -328,7 +328,7 @@ describe 'cloud::loadbalancer' do
:ports => '8776',
:options => {
'mode' => 'http',
'option' => ['tcpka','tcplog','httpchk'],
'option' => ['tcpka','forwardfor','tcplog', 'httpchk'],
'http-check' => 'expect ! rstatus ^5',
'balance' => 'roundrobin',
},
@ -349,7 +349,7 @@ describe 'cloud::loadbalancer' do
:options => {
'mode' => 'tcp',
'http-check' => 'expect ! rstatus ^5',
'option' => ['tcpka','tcplog','ssl-hello-chk'],
'option' => ['tcpka','forwardfor','tcplog', 'ssl-hello-chk'],
'cookie' => 'sessionid prefix',
'balance' => 'leastconn',
},