From c29a1c7b8e953b2055763c16d04786b800300f9d Mon Sep 17 00:00:00 2001 From: Gabriel Cocenza Date: Thu, 23 Feb 2023 21:06:33 -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: Ie1f53d38c1c45ce3b2ddf5041eaa04a7f3139066 --- lib/swift_context.py | 10 ++++++++++ tests/tests.yaml | 2 +- tox.ini | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/swift_context.py b/lib/swift_context.py index f2f9642..3afe23e 100644 --- a/lib/swift_context.py +++ b/lib/swift_context.py @@ -22,6 +22,7 @@ from charmhelpers.contrib.openstack.context import ( from charmhelpers.contrib.hahelpers.cluster import ( determine_api_port, determine_apache_port, + https, ) from charmhelpers.contrib.network.ip import ( format_ipv6_addr, @@ -54,8 +55,17 @@ class HAProxyContext(OSContextGenerator): api_port = determine_apache_port(config('bind-port'), singlenode_mode=True) + healthcheck = [{ + 'option': 'httpchk GET /healthcheck', + 'http-check': 'expect status 200', + }] + + backend_options = {'swift_api': healthcheck} + ctxt = { 'service_ports': {'swift_api': [haproxy_port, api_port]}, + 'backend_options': backend_options, + 'https': https() } return ctxt diff --git a/tests/tests.yaml b/tests/tests.yaml index 5d8cd9c..71c6685 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -10,7 +10,7 @@ dev_bundles: smoke_bundles: # Use no s3api test for smoke - - focal-yoga + - jammy-yoga configure: - swift_gr_region1: diff --git a/tox.ini b/tox.ini index ae4d124..2cb6ca1 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