From: Zhang Rong(Jon) Date: Fri, 14 Jun 2024 06:57:36 +0000 (+0800) Subject: Fix install O2 on subcloud failed X-Git-Tag: 2.0.4~2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F12963%2F3;hp=6e18a1ce517d87dcaf56756a04c66949f51ca991;p=pti%2Fo2.git Fix install O2 on subcloud failed The O2 application installation on a subcloud will fail because the default region name is "RegionOne," while the subcloud has a different region name. This commit adds an environment variable that allows the user to set the region name, replacing the default one. Test Cases: 1. Successfully installed the O2 application on the subcloud. 2. Successfully installed the O2 application on the central cloud. Issue-ID: INF-467 Change-Id: I893680b8c2519667b1784b751950ea8a3f14cbce Signed-off-by: Zhang Rong(Jon) --- diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index 19d7431..a1596e3 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -122,6 +122,8 @@ spec: value: {{ .Values.ocloud.OS_PASSWORD }} - name: OS_USERNAME value: {{ .Values.ocloud.OS_USERNAME }} + - name: OS_REGION_NAME + value: {{ .Values.ocloud.OS_REGION_NAME }} - name: PYTHONDONTWRITEBYTECODE value: "1" - name: REDIS_HOST diff --git a/charts/values.yaml b/charts/values.yaml index 83629c4..ee88d9c 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -77,6 +77,7 @@ ocloud: OS_AUTH_URL: "" OS_USERNAME: "" OS_PASSWORD: "" + OS_REGION_NAME: "RegionOne" K8S_KUBECONFIG: "" API_HOST_EXTERNAL_FLOATING: "" HELM_USER_PASSWD: "St8rlingX*" diff --git a/o2common/config/config.py b/o2common/config/config.py index f8eee94..2ad1da3 100644 --- a/o2common/config/config.py +++ b/o2common/config/config.py @@ -63,6 +63,11 @@ def get_api_url(): return f"https://{host}:{port}" +def get_region_name(): + region_name = os.environ.get("OS_REGION_NAME", "RegionOne") + return region_name + + def get_stx_url(): try: return get_stx_client_args()["auth_url"] @@ -150,7 +155,8 @@ def is_ipv6(address): return False -def get_stx_access_info(region_name="RegionOne", subcloud_hostname: str = "", +def get_stx_access_info(region_name=get_region_name(), + subcloud_hostname: str = "", sub_is_https: bool = False): try: client_args = get_stx_client_args()