Drop placement endpoints from relation in train+

When a cloud is deployed earlier than the Train release, the placement
service is provided by nova-cloud-controller. As part of an upgrade to
Train, the new placement service is added and updates the placement
endpoint in the service catalog. The nova-cloud-controller charm no
longer advertises the placement service URL, but because the data
exists on the relation until removed, the service catalog changes the
placement URL to the placement endpoints advertised from
nova-cloud-controller.

Fix this by explicitly removing the placement service URLs when the
placement service is not provided by nova-cloud-controller.

Change-Id: Ibb3b1429820a4188fe3d2c1142c295c0de4ee24e
Closes-Bug: #1928992
This commit is contained in:
Billy Olsen 2021-06-17 13:42:48 -07:00
parent 27df75e61a
commit 231a0f1459
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):