Browse Source

[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
changes/90/738290/3
Bharat Kunwar 2 years ago
parent
commit
5a688b1869
  1. 11
      magnum/drivers/heat/k8s_template_def.py
  2. 11
      magnum/drivers/heat/swarm_mode_template_def.py
  3. 10
      magnum/drivers/heat/template_def.py

11
magnum/drivers/heat/k8s_template_def.py

@ -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'

11
magnum/drivers/heat/swarm_mode_template_def.py

@ -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']

10
magnum/drivers/heat/template_def.py

@ -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,

Loading…
Cancel
Save