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: I76129d4def671c5a5001cf15d9ff629a94a450e0
This commit is contained in:
Edward Hope-Morley 2016-03-24 16:27:22 +00:00
parent 7f9597dc8e
commit 063f3a44f0
6 changed files with 33 additions and 1 deletions

View File

@ -1479,3 +1479,15 @@ class NetworkServiceContext(OSContextGenerator):
if self.context_complete(ctxt): if self.context_complete(ctxt):
return ctxt return ctxt
return {} 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

@ -79,6 +79,13 @@ options:
default: RegionOne default: RegionOne
type: string type: string
description: OpenStack Region 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.
ceph-osd-replication-count: ceph-osd-replication-count:
default: 3 default: 3
type: int type: int

View File

@ -174,7 +174,8 @@ CONFIG_FILES = OrderedDict([
glance_contexts.MultiStoreContext(), glance_contexts.MultiStoreContext(),
context.OSConfigFlagContext( context.OSConfigFlagContext(
charm_flag='api-config-flags', charm_flag='api-config-flags',
template_flag='api_config_flags')], template_flag='api_config_flags'),
context.InternalEndpointContext()],
'services': ['glance-api'] 'services': ['glance-api']
}), }),
(ceph_config_file(), { (ceph_config_file(), {

View File

@ -14,6 +14,10 @@ default_store = file
bind_host = {{ bind_host }} bind_host = {{ bind_host }}
{% if use_internal_endpoints -%}
cinder_catalog_info = volumev2::internalURL
{% endif %}
{% if ext -%} {% if ext -%}
bind_port = {{ ext }} bind_port = {{ ext }}
{% elif bind_port -%} {% elif bind_port -%}

View File

@ -17,6 +17,10 @@ default_store = file
bind_host = {{ bind_host }} bind_host = {{ bind_host }}
{% if use_internal_endpoints -%}
cinder_catalog_info = volumev2::internalURL
{% endif %}
{% if ext -%} {% if ext -%}
bind_port = {{ ext }} bind_port = {{ ext }}
{% elif bind_port -%} {% elif bind_port -%}

View File

@ -5,6 +5,10 @@ debug = {{ debug }}
workers = {{ workers }} workers = {{ workers }}
bind_host = {{ bind_host }} bind_host = {{ bind_host }}
{% if use_internal_endpoints -%}
cinder_catalog_info = volumev2::internalURL
{% endif %}
{% if ext -%} {% if ext -%}
bind_port = {{ ext }} bind_port = {{ ext }}
{% elif bind_port -%} {% elif bind_port -%}