Enable health check httpchk options in haproxy.

Adds backend options for 'admin-port' and 'public-port' in
HAProxyContext. HAProxy will now expect 200-300 statuses and the string
"stable".

test_haproxy_context_service_enabled updated to reflect expected ctxt.

Closes-Bug: #1933233
Change-Id: I88cef4539f5d7dc70f6fbaacfb2ff768e958d346
This commit is contained in:
John P Lettman 2021-08-04 13:28:21 -04:00
parent 78e6d2aea2
commit 579daa6820
2 changed files with 24 additions and 0 deletions

View File

@ -163,6 +163,20 @@ class HAProxyContext(context.HAProxyContext):
api_port('keystone-public'), a_public_port],
}
# use httpchk to ensure the keystone backend is healthy
backend_options = {
'admin-port': [
{'option': 'httpchk GET /v3'},
{'http-check': 'expect string stable'}
],
'public-port': [
{'option': 'httpchk GET /v3'},
{'http-check': 'expect string stable'}
]
}
# for haproxy.conf
ctxt['backend_options'] = backend_options
# for haproxy.conf
ctxt['service_ports'] = port_mapping
# for keystone.conf

View File

@ -135,6 +135,16 @@ class TestKeystoneContexts(CharmTestCase):
'admin-port': ['12', '34'],
'public-port': ['12', '34']
},
'backend_options': {
'admin-port': [
{'option': 'httpchk GET /v3'},
{'http-check': 'expect string stable'}
],
'public-port': [
{'option': 'httpchk GET /v3'},
{'http-check': 'expect string stable'}
]
},
'default_backend': '1.2.3.4',
'frontends': {
'1.2.3.4': {