Merge "Fix PING health monitor for old amphora"
This commit is contained in:
commit
7947a43b5c
|
@ -24,7 +24,15 @@ global
|
|||
{% if loadbalancer.global_connection_limit is defined %}
|
||||
maxconn {{ loadbalancer.global_connection_limit }}
|
||||
{% endif %}
|
||||
{% set found_ns = namespace(found=false) %}
|
||||
{% for pool in loadbalancer.listener.pools if pool.enabled %}
|
||||
{% if pool.health_monitor and pool.health_monitor.enabled and
|
||||
pool.health_monitor.type == constants.HEALTH_MONITOR_PING and
|
||||
found_ns.found == false %}
|
||||
{% set found_ns.found = true %}
|
||||
external-check
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
defaults
|
||||
log global
|
||||
|
|
|
@ -220,6 +220,29 @@ class TestHaproxyCfg(base.TestCase):
|
|||
self.assertEqual(sample_configs.sample_base_expected_config(
|
||||
backend=be), rendered_obj)
|
||||
|
||||
def test_render_template_ping_monitor_http(self):
|
||||
be = ("backend sample_pool_id_1\n"
|
||||
" mode http\n"
|
||||
" balance roundrobin\n"
|
||||
" cookie SRV insert indirect nocache\n"
|
||||
" timeout check 31s\n"
|
||||
" option external-check\n"
|
||||
" external-check command /var/lib/octavia/ping-wrapper.sh\n"
|
||||
" fullconn 98\n"
|
||||
" server sample_member_id_1 10.0.0.99:82 "
|
||||
"weight 13 check inter 30s fall 3 rise 2 "
|
||||
"cookie sample_member_id_1\n"
|
||||
" server sample_member_id_2 10.0.0.98:82 "
|
||||
"weight 13 check inter 30s fall 3 rise 2 "
|
||||
"cookie sample_member_id_2\n\n")
|
||||
go = " maxconn 98\n external-check\n\n"
|
||||
rendered_obj = self.jinja_cfg.render_loadbalancer_obj(
|
||||
sample_configs.sample_amphora_tuple(),
|
||||
sample_configs.sample_listener_tuple(proto='HTTP',
|
||||
monitor_proto='PING'))
|
||||
self.assertEqual(sample_configs.sample_base_expected_config(
|
||||
backend=be, global_opts=go), rendered_obj)
|
||||
|
||||
def test_render_template_no_monitor_https(self):
|
||||
fe = ("frontend sample_listener_id_1\n"
|
||||
" option tcplog\n"
|
||||
|
|
|
@ -695,7 +695,8 @@ def sample_l7rule_tuple(id,
|
|||
enabled=enabled)
|
||||
|
||||
|
||||
def sample_base_expected_config(frontend=None, backend=None, peers=None):
|
||||
def sample_base_expected_config(frontend=None, backend=None,
|
||||
peers=None, global_opts=None):
|
||||
if frontend is None:
|
||||
frontend = ("frontend sample_listener_id_1\n"
|
||||
" option httplog\n"
|
||||
|
@ -717,7 +718,9 @@ def sample_base_expected_config(frontend=None, backend=None, peers=None):
|
|||
" server sample_member_id_2 10.0.0.98:82 weight 13 "
|
||||
"check inter 30s fall 3 rise 2 cookie sample_member_id_2\n")
|
||||
if peers is None:
|
||||
peers = ("\n\n")
|
||||
peers = "\n\n"
|
||||
if global_opts is None:
|
||||
global_opts = " maxconn 98\n\n"
|
||||
return ("# Configuration for test-lb\n"
|
||||
"global\n"
|
||||
" daemon\n"
|
||||
|
@ -726,9 +729,8 @@ def sample_base_expected_config(frontend=None, backend=None, peers=None):
|
|||
" log /dev/log local0\n"
|
||||
" log /dev/log local1 notice\n"
|
||||
" stats socket /var/lib/octavia/sample_listener_id_1.sock"
|
||||
" mode 0666 level user\n"
|
||||
" maxconn 98\n"
|
||||
" external-check\n\n"
|
||||
" mode 0666 level user\n" +
|
||||
global_opts +
|
||||
"defaults\n"
|
||||
" log global\n"
|
||||
" retries 3\n"
|
||||
|
|
Loading…
Reference in New Issue