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: Ie1f53d38c1c45ce3b2ddf5041eaa04a7f3139066
This commit is contained in:
Gabriel Cocenza 2023-02-23 21:06:33 -03:00
parent 843fab27bd
commit c29a1c7b8e
3 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,7 @@ from charmhelpers.contrib.openstack.context import (
from charmhelpers.contrib.hahelpers.cluster import ( from charmhelpers.contrib.hahelpers.cluster import (
determine_api_port, determine_api_port,
determine_apache_port, determine_apache_port,
https,
) )
from charmhelpers.contrib.network.ip import ( from charmhelpers.contrib.network.ip import (
format_ipv6_addr, format_ipv6_addr,
@ -54,8 +55,17 @@ class HAProxyContext(OSContextGenerator):
api_port = determine_apache_port(config('bind-port'), api_port = determine_apache_port(config('bind-port'),
singlenode_mode=True) singlenode_mode=True)
healthcheck = [{
'option': 'httpchk GET /healthcheck',
'http-check': 'expect status 200',
}]
backend_options = {'swift_api': healthcheck}
ctxt = { ctxt = {
'service_ports': {'swift_api': [haproxy_port, api_port]}, 'service_ports': {'swift_api': [haproxy_port, api_port]},
'backend_options': backend_options,
'https': https()
} }
return ctxt return ctxt

View File

@ -10,7 +10,7 @@ dev_bundles:
smoke_bundles: smoke_bundles:
# Use no s3api test for smoke # Use no s3api test for smoke
- focal-yoga - jammy-yoga
configure: configure:
- swift_gr_region1: - swift_gr_region1:

View File

@ -25,7 +25,7 @@ setenv = VIRTUAL_ENV={envdir}
commands = stestr run --slowest {posargs} commands = stestr run --slowest {posargs}
allowlist_externals = allowlist_externals =
charmcraft charmcraft
rename.sh {toxinidir}/rename.sh
passenv = passenv =
HOME HOME
TERM TERM