Merge "Drop placement endpoints from relation in train+"

This commit is contained in:
Zuul 2021-08-26 13:06:58 +00:00 committed by Gerrit Code Review
commit b2fe2601c9
2 changed files with 49 additions and 1 deletions

View File

@ -1575,6 +1575,17 @@ def determine_endpoints(public_url, internal_url, admin_url):
'placement_admin_url': placement_admin_url,
'placement_internal_url': placement_internal_url,
})
else:
# NOTE(wolsen) drop placement endpoints when placement api is not
# enabled. This prevents the ncc charm from overriding services
# from placement in Train and newer. See LP#1928992
endpoints.update({
'placement_service': None,
'placement_region': None,
'placement_public_url': None,
'placement_admin_url': None,
'placement_internal_url': None,
})
return endpoints

View File

@ -96,7 +96,12 @@ BASE_ENDPOINTS = {
's3_internal_url': 'http://foohost.com:3333',
's3_public_url': 'http://foohost.com:3333',
's3_region': 'RegionOne',
's3_service': 's3'
's3_service': 's3',
'placement_region': None,
'placement_service': None,
'placement_admin_url': None,
'placement_internal_url': None,
'placement_public_url': None,
}
QUEENS_ENDPOINTS = {
@ -122,6 +127,29 @@ QUEENS_ENDPOINTS = {
'placement_public_url': 'http://foohost.com:8778',
}
TRAIN_ENDPOINTS = {
'ec2_admin_url': None,
'ec2_internal_url': None,
'ec2_public_url': None,
'ec2_region': None,
'ec2_service': None,
'nova_admin_url': 'http://foohost.com:8774/v2.1',
'nova_internal_url': 'http://foohost.com:8774/v2.1',
'nova_public_url': 'http://foohost.com:8774/v2.1',
'nova_region': 'RegionOne',
'nova_service': 'nova',
's3_admin_url': None,
's3_internal_url': None,
's3_public_url': None,
's3_region': None,
's3_service': None,
'placement_region': None,
'placement_service': None,
'placement_admin_url': None,
'placement_internal_url': None,
'placement_public_url': None,
}
# Restart map should be constructed such that API services restart
# before frontends (haproxy/apache) to avoid port conflicts.
RESTART_MAP_ICEHOUSE = OrderedDict([
@ -840,6 +868,15 @@ class NovaCCUtilsTests(CharmTestCase):
'http://foohost.com',
'http://foohost.com'))
def test_determine_endpoints_train(self):
# Having placement related w/ train disables placement_api
self.relation_ids.return_value = ['placement:1']
self.os_release.return_value = 'train'
self.assertEqual(
TRAIN_ENDPOINTS, utils.determine_endpoints('http://foohost.com',
'http://foohost.com',
'http://foohost.com'))
@patch.object(utils, 'known_hosts')
@patch('subprocess.check_output')
def test_ssh_known_host_key(self, _check_output, _known_hosts):