From 468d648655f420230f3018123ac0ec29bdb0ca87 Mon Sep 17 00:00:00 2001 From: Gabriel Cocenza Date: Thu, 23 Feb 2023 21:17:56 -0300 Subject: [PATCH] Add support for HAProxy L7 checks This change add several configuration options to enable HTTP checks to the HAProxy configuration, instead of the default TCP connection checks. Closes-Bug: #1880610 Change-Id: I4a947c5b52eb3283c08a0d39cc9bf14695a63eab --- hooks/nova_cc_context.py | 12 ++++++++++++ tox.ini | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index c4b70bc1..4f072b1d 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -239,10 +239,22 @@ class HAProxyContext(ch_context.HAProxyContext): del listen_ports['placement_listen_port'] del port_mapping['nova-placement-api'] + healthcheck = [{ + 'option': 'httpchk GET /', + 'http-check': 'expect status 200', + }] + + backend_options = { + 'nova-api-os-compute': healthcheck, + 'nova-api-metadata': healthcheck, + } + # for haproxy.conf ctxt['service_ports'] = port_mapping # for nova.conf ctxt['listen_ports'] = listen_ports + ctxt['backend_options'] = backend_options + ctxt['https'] = ch_cluster.https() return ctxt diff --git a/tox.ini b/tox.ini index ae4d124c..2cb6ca16 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ setenv = VIRTUAL_ENV={envdir} commands = stestr run --slowest {posargs} allowlist_externals = charmcraft - rename.sh + {toxinidir}/rename.sh passenv = HOME TERM