Merge "Add config option healthcheck-timeout"

This commit is contained in:
Zuul
2025-08-08 14:43:16 +00:00
committed by Gerrit Code Review
3 changed files with 16 additions and 1 deletions

View File

@@ -494,3 +494,10 @@ options:
When set to `True`, Keystone will be configured to send notifications
using the `messagingv2` driver. The default value is `False`,
meaning notifications are disabled unless explicitly enabled.
healthcheck-timeout:
type: int
default: 5000
description: |
Set additional check timeout (in milisecond), but only after a connection
has been already established. This allows to give a better chance to the
backend to reply when the query is slow.

View File

@@ -43,6 +43,9 @@ from charmhelpers.contrib.openstack.utils import (
)
MIN_HEALTHCHECK_TIMEOUT = 1 # msecs
class MiddlewareContext(context.OSContextGenerator):
interfaces = ['keystone-middleware']
@@ -166,6 +169,8 @@ class HAProxyContext(context.HAProxyContext):
healthcheck = [{
'option': 'httpchk GET /healthcheck',
'http-check': 'expect status 200',
'timeout check': str(max(MIN_HEALTHCHECK_TIMEOUT,
config('healthcheck-timeout'))),
}]
backend_options = {

View File

@@ -108,11 +108,13 @@ class TestKeystoneContexts(CharmTestCase):
is_ipv6_disabled, mock_https):
os.environ['JUJU_UNIT_NAME'] = 'keystone'
self.test_config.set('healthcheck-timeout', 3000)
mock_relation_ids.return_value = ['identity-service:0', ]
mock_get_relation_ip.return_value = '1.2.3.4'
mock_relation_get.return_value = '10.0.0.0'
mock_related_units.return_value = ['unit/0', ]
mock_config.return_value = None
mock_config.side_effect = self.test_config.get
mock_get_address_in_network.return_value = None
mock_get_netmask_for_address.return_value = '255.255.255.0'
self.determine_apache_port.return_value = '34'
@@ -125,6 +127,7 @@ class TestKeystoneContexts(CharmTestCase):
healthcheck = [{
'option': 'httpchk GET /healthcheck',
'http-check': 'expect status 200',
'timeout check': '3000',
}]
self.maxDiff = None