Change Heat and Glance client to use internal endpoint

Change-Id: I8267edfb6b10b0f7360c0464ebca8f97db41045e
This commit is contained in:
Chi Lo 2020-08-05 11:28:32 -07:00
parent 7a99462270
commit e8b268c21b
2 changed files with 21 additions and 13 deletions

View File

@ -45,7 +45,11 @@ SERVICE_OPTS = [
]
cfg.CONF.register_opts(SERVICE_OPTS, OPT_GROUP)
CONF = cfg.CONF.keystone_authtoken
cfg.CONF.register_opts([
cfg.StrOpt('glance_api_url', default=None, help="glance api internal url")
])
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@ -99,13 +103,13 @@ class Clients(object):
def keystone(self):
"""Returns keystone Client."""
params = {
'username': CONF.username,
'password': CONF.password,
'auth_url': CONF.auth_url,
'project_name': CONF.project_name,
'user_domain_name': CONF.user_domain_name,
'project_domain_name': CONF.project_domain_name,
'https_cacert': CONF.https_cacert
'username': CONF.keystone_authtoken.username,
'password': CONF.keystone_authtoken.password,
'auth_url': CONF.keystone_authtoken.auth_url,
'project_name': CONF.keystone_authtoken.project_name,
'user_domain_name': CONF.keystone_authtoken.user_domain_name,
'project_domain_name': CONF.keystone_authtoken.project_domain_name,
'https_cacert': CONF.keystone_authtoken.https_cacert
}
try:
client = create_keystone_client(params)
@ -128,13 +132,13 @@ class Clients(object):
while attempt >= 0:
try:
kwargs = {
'auth_url': CONF.auth_url,
'auth_url': CONF.keystone_authtoken.auth_url,
'session': kc.session,
'auth': kc.session.auth,
'service_type': 'orchestration',
'endpoint_type': 'publicURL',
'username': CONF.username,
'password': CONF.password,
'endpoint_type': 'internalURL',
'username': CONF.keystone_authtoken.username,
'password': CONF.keystone_authtoken.password,
'include_pass': 'False',
'endpoint_override': '',
}
@ -162,7 +166,9 @@ class Clients(object):
attempt = 1
while attempt >= 0:
try:
return glance.Client(version, session=kc.session)
return glance.Client(version=version,
session=kc.session,
endpoint=CONF.glance_api_url)
except Exception as ex:
try:
kc = self.keystone()

View File

@ -63,6 +63,8 @@ default_opts = [
help="Max allotment of tries for resource creation"),
cfg.StrOpt('transport_url', default='',
help="Messaging queue url", secret=True),
cfg.StrOpt('glance_api_url', default=None,
help="glance api internal url"),
cfg.StrOpt('use_stderr', default='true', help=""),
cfg.StrOpt('verbose', default='false', help=""),
cfg.BoolOpt('enable_rds_callback_check',