Merge "[fix] Append v3/v1 to auth_url/magnum_url if discovery fails" into stable/train

This commit is contained in:
Zuul 2020-11-05 12:47:16 +00:00 committed by Gerrit Code Review
commit f1dd750d79
3 changed files with 29 additions and 3 deletions

View File

@ -202,7 +202,16 @@ class K8sTemplateDefinition(template_def.BaseTemplateDefinition):
extra_params['discovery_url'] = self.get_discovery_url(cluster)
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:
extra_params['loadbalancing_protocol'] = 'HTTP'

View File

@ -117,7 +117,16 @@ class SwarmModeTemplateDefinition(template_def.BaseTemplateDefinition):
# it should be replaced with an actual trust token with only
# access to do what the template needs it to do.
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']

View File

@ -391,7 +391,15 @@ class BaseTemplateDefinition(TemplateDefinition):
}
if 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,
self).get_params(context, cluster_template, cluster,