From 5b596e39badef2add94daa2348cc35d63c3fccaa Mon Sep 17 00:00:00 2001 From: chung00-lee Date: Mon, 13 Nov 2023 13:29:56 +0900 Subject: [PATCH] Use region option in keystone endpoint-update.py In multi-region environment, endpoints of other regions are also changed. So, if we add the region option to endpoint-update file, it changes endpoints only for the current region. story: 2010965 task: 49081 Change-Id: Ia678b6737871dec8f6979924de7f2ba53153e7bf --- keystone/Chart.yaml | 2 +- keystone/templates/bin/_endpoint-update.py.tpl | 18 ++++++++++++------ releasenotes/notes/keystone.yaml | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/keystone/Chart.yaml b/keystone/Chart.yaml index fcd5d74998..6284033213 100644 --- a/keystone/Chart.yaml +++ b/keystone/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Keystone name: keystone -version: 0.3.5 +version: 0.3.6 home: https://docs.openstack.org/keystone/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png sources: diff --git a/keystone/templates/bin/_endpoint-update.py.tpl b/keystone/templates/bin/_endpoint-update.py.tpl index bb4d7b9071..14f8fc3cf9 100644 --- a/keystone/templates/bin/_endpoint-update.py.tpl +++ b/keystone/templates/bin/_endpoint-update.py.tpl @@ -68,10 +68,12 @@ except: # Set Internal Endpoint try: endpoint_url = os.environ['OS_BOOTSTRAP_INTERNAL_URL'] + region_id = os.environ['OS_REGION_NAME'] cmd = ("update endpoint set url = %s where interface ='internal' and " "service_id = (select id from service where " - "service.type = 'identity')") - user_engine.execute(cmd, (endpoint_url,)) + "service.type = 'identity') and " + "region_id = %s") + user_engine.execute(cmd, (endpoint_url,region_id)) except: logger.critical("Could not update internal endpoint") raise @@ -79,10 +81,12 @@ except: # Set Admin Endpoint try: endpoint_url = os.environ['OS_BOOTSTRAP_ADMIN_URL'] + region_id = os.environ['OS_REGION_NAME'] cmd = ("update endpoint set url = %s where interface ='admin' " "and service_id = (select id from service where " - "service.type = 'identity')") - user_engine.execute(cmd, (endpoint_url,)) + "service.type = 'identity') " + "and region_id = %s") + user_engine.execute(cmd, (endpoint_url,region_id)) except: logger.critical("Could not update admin endpoint") raise @@ -90,10 +94,12 @@ except: # Set Public Endpoint try: endpoint_url = os.environ['OS_BOOTSTRAP_PUBLIC_URL'] + region_id = os.environ['OS_REGION_NAME'] cmd = ("update endpoint set url = %s where interface ='public' " "and service_id = (select id from service where " - "service.type = 'identity')") - user_engine.execute(cmd, (endpoint_url,)) + "service.type = 'identity') " + "and region_id = %s") + user_engine.execute(cmd, (endpoint_url,region_id)) except: logger.critical("Could not update public endpoint") raise diff --git a/releasenotes/notes/keystone.yaml b/releasenotes/notes/keystone.yaml index c67589b54b..b537ceb1b5 100644 --- a/releasenotes/notes/keystone.yaml +++ b/releasenotes/notes/keystone.yaml @@ -52,4 +52,5 @@ keystone: - 0.3.3 Add 2023.1 overrides - 0.3.4 Add Ubuntu Jammy overrides - 0.3.5 Add 2023.2 Ubuntu Jammy overrides + - 0.3.6 Use region option in keystone endpoint-update.py ...