[fix] Append v3/v1 to auth_url/magnum_url if discovery fails
Sometimes, version discovery fails when Magnum cannot talk to Keystone via specified trustee_keystone_interface intended for cluster instances either because it is not unreachable from the controller or CA certs are missing for TLS enabled interface and the returned auth_url or magnum_url may not be suffixed with /v3 or /v1 respectively, in which case append the url with the suffix so that instances can still talk to Keystone/Magnum. Story: 2007868 Task: 40235 Change-Id: Iae831dc549a855269b4639c31676e75d2a9433d6
This commit is contained in:
parent
05f7ceea17
commit
5a688b1869
@ -202,7 +202,16 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
|
|||||||
|
|
||||||
extra_params['discovery_url'] = self.get_discovery_url(cluster)
|
extra_params['discovery_url'] = self.get_discovery_url(cluster)
|
||||||
osc = self.get_osc(context)
|
osc = self.get_osc(context)
|
||||||
extra_params['magnum_url'] = osc.magnum_url()
|
# NOTE: Sometimes, version discovery fails when Magnum cannot talk to
|
||||||
|
# Keystone via specified magnum_client.endpoint_type intended for
|
||||||
|
# cluster instances either because it is not unreachable from the
|
||||||
|
# controller or CA certs are missing for TLS enabled interface and the
|
||||||
|
# returned auth_url may not be suffixed with /v1 in which case append
|
||||||
|
# the url with the suffix so that instances can still talk to Magnum.
|
||||||
|
magnum_url = osc.magnum_url()
|
||||||
|
extra_params['magnum_url'] = magnum_url + ('' if
|
||||||
|
magnum_url.endswith('/v1')
|
||||||
|
else '/v1')
|
||||||
|
|
||||||
if cluster_template.tls_disabled:
|
if cluster_template.tls_disabled:
|
||||||
extra_params['loadbalancing_protocol'] = 'HTTP'
|
extra_params['loadbalancing_protocol'] = 'HTTP'
|
||||||
|
@ -117,7 +117,16 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
|
|||||||
# it should be replaced with an actual trust token with only
|
# it should be replaced with an actual trust token with only
|
||||||
# access to do what the template needs it to do.
|
# access to do what the template needs it to do.
|
||||||
osc = self.get_osc(context)
|
osc = self.get_osc(context)
|
||||||
extra_params['magnum_url'] = osc.magnum_url()
|
# NOTE: Sometimes, version discovery fails when Magnum cannot talk to
|
||||||
|
# Keystone via specified magnum_client.endpoint_type intended for
|
||||||
|
# cluster instances either because it is not unreachable from the
|
||||||
|
# controller or CA certs are missing for TLS enabled interface and the
|
||||||
|
# returned auth_url may not be suffixed with /v1 in which case append
|
||||||
|
# the url with the suffix so that instances can still talk to Magnum.
|
||||||
|
magnum_url = osc.magnum_url()
|
||||||
|
extra_params['magnum_url'] = magnum_url + ('' if
|
||||||
|
magnum_url.endswith('/v1')
|
||||||
|
else '/v1')
|
||||||
|
|
||||||
label_list = ['rexray_preempt', 'availability_zone']
|
label_list = ['rexray_preempt', 'availability_zone']
|
||||||
|
|
||||||
|
@ -391,7 +391,15 @@ class BaseTemplateDefinition(TemplateDefinition):
|
|||||||
}
|
}
|
||||||
if CONF.trust.trustee_keystone_region_name:
|
if CONF.trust.trustee_keystone_region_name:
|
||||||
kwargs['region_name'] = CONF.trust.trustee_keystone_region_name
|
kwargs['region_name'] = CONF.trust.trustee_keystone_region_name
|
||||||
extra_params['auth_url'] = osc.url_for(**kwargs).rstrip('/')
|
# NOTE: Sometimes, version discovery fails when Magnum cannot talk to
|
||||||
|
# Keystone via specified trustee_keystone_interface intended for
|
||||||
|
# cluster instances either because it is not unreachable from the
|
||||||
|
# controller or CA certs are missing for TLS enabled interface and the
|
||||||
|
# returned auth_url may not be suffixed with /v3 in which case append
|
||||||
|
# the url with the suffix so that instances can still talk to Keystone.
|
||||||
|
auth_url = osc.url_for(**kwargs).rstrip('/')
|
||||||
|
extra_params['auth_url'] = auth_url + ('' if auth_url.endswith('/v3')
|
||||||
|
else '/v3')
|
||||||
|
|
||||||
return super(BaseTemplateDefinition,
|
return super(BaseTemplateDefinition,
|
||||||
self).get_params(context, cluster_template, cluster,
|
self).get_params(context, cluster_template, cluster,
|
||||||
|
Loading…
Reference in New Issue
Block a user