Support using internal network for clients

Openstack mostly defaults to using public endpoints for
internal communication between services. This patch adds
a new option use-internal-endpoints which, if set to True,
will configure services to use internal endpoints where
possible.

Closes-Bug: 1456876
Change-Id: Iadd1e4e8833f637d75d3b5080e49ddabb0f78427
This commit is contained in:
Edward Hope-Morley 2016-03-24 16:22:37 +00:00
parent 65fb3b3688
commit 0c2f80976e
6 changed files with 42 additions and 1 deletions

View File

@ -142,6 +142,13 @@ options:
default: RegionOne
type: string
description: OpenStack Region
use-internal-endpoints:
default: False
type: boolean
description: |
Openstack mostly defaults to using public endpoints for
internal communication between services. If set to True this option will
configure services to use internal endpoints where possible.
glance-api-version:
default: 1
type: int

View File

@ -1479,3 +1479,15 @@ class NetworkServiceContext(OSContextGenerator):
if self.context_complete(ctxt):
return ctxt
return {}
class InternalEndpointContext(OSContextGenerator):
"""Internal endpoint context.
This context provides the endpoint type used for communication between
services e.g. between Nova and Cinder internally. Openstack uses Public
endpoints by default so this allows admins to optionally use internal
endpoints.
"""
def __call__(self):
return {'use_internal_endpoints': config('use-internal-endpoints')}

View File

@ -205,7 +205,8 @@ BASE_RESOURCE_MAP = OrderedDict([
service_user='cinder'),
context.BindHostContext(),
context.WorkerConfigContext(),
cinder_contexts.RegionContext()],
cinder_contexts.RegionContext(),
context.InternalEndpointContext()],
'services': ['cinder-api', 'cinder-volume', 'cinder-scheduler',
'haproxy']
}),

View File

@ -29,6 +29,13 @@ control_exchange = cinder
volume_driver = {{ volume_driver }}
{% endif -%}
{% if use_internal_endpoints -%}
swift_catalog_info = object-store:swift:internalURL
keystone_catalog_info = identity:Identity Service:internalURL
glance_catalog_info = image:glance:internalURL
nova_catalog_info = compute:Compute Service:internalURL
{% endif %}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
host = {{ host }}

View File

@ -26,6 +26,13 @@ control_exchange = cinder
volume_driver = {{ volume_driver }}
{% endif -%}
{% if use_internal_endpoints -%}
swift_catalog_info = object-store:swift:internalURL
keystone_catalog_info = identity:Identity Service:internalURL
glance_catalog_info = image:glance:internalURL
nova_catalog_info = compute:Compute Service:internalURL
{% endif %}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
host = {{ host }}

View File

@ -26,6 +26,13 @@ control_exchange = cinder
volume_driver = {{ volume_driver }}
{% endif -%}
{% if use_internal_endpoints -%}
swift_catalog_info = object-store:swift:internalURL
keystone_catalog_info = identity:Identity Service:internalURL
glance_catalog_info = image:glance:internalURL
nova_catalog_info = compute:Compute Service:internalURL
{% endif %}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
host = {{ host }}