From 4e71ab61d598867dce5d557be179ac1d6db5b732 Mon Sep 17 00:00:00 2001 From: romeromonser Date: Fri, 28 May 2021 12:06:34 +0200 Subject: [PATCH] Bugfix 1550: Setting a custom release name for Helm based kdus Change-Id: I9aac130501bcbc207a4acacb77aada1a67028128 Signed-off-by: romeromonser --- osm_lcm/ns.py | 19 ++++++++++++------- osm_lcm/tests/test_ns.py | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index ddd827e..2f0d6f6 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -2848,13 +2848,16 @@ class NsLcm(LcmBase): "path": nsr_db_path, } - kdu_instance = self.k8scluster_map[ - k8sclustertype - ].generate_kdu_instance_name( - db_dict=db_dict_install, - kdu_model=k8s_instance_info["kdu-model"], - kdu_name=k8s_instance_info["kdu-name"], - ) + if k8s_instance_info.get("kdu-deployment-name"): + kdu_instance = k8s_instance_info.get("kdu-deployment-name") + else: + kdu_instance = self.k8scluster_map[ + k8sclustertype + ].generate_kdu_instance_name( + db_dict=db_dict_install, + kdu_model=k8s_instance_info["kdu-model"], + kdu_name=k8s_instance_info["kdu-name"], + ) self.update_db_2( "nsrs", nsr_id, {nsr_db_path + ".kdu-instance": kdu_instance} ) @@ -3093,6 +3096,7 @@ class NsLcm(LcmBase): if kdud["name"] == kdur["kdu-name"] ) namespace = kdur.get("k8s-namespace") + kdu_deployment_name = kdur.get("kdu-deployment-name") if kdur.get("helm-chart"): kdumodel = kdur["helm-chart"] # Default version: helm3, if helm-version is v2 assign v2 @@ -3205,6 +3209,7 @@ class NsLcm(LcmBase): "kdu-name": kdur["kdu-name"], "kdu-model": kdumodel, "namespace": namespace, + "kdu-deployment-name": kdu_deployment_name, } db_path = "_admin.deployed.K8s.{}".format(index) db_nsr_update[db_path] = k8s_instance_info diff --git a/osm_lcm/tests/test_ns.py b/osm_lcm/tests/test_ns.py index 62de111..ef87a4c 100644 --- a/osm_lcm/tests/test_ns.py +++ b/osm_lcm/tests/test_ns.py @@ -754,6 +754,7 @@ class TestMyNS(asynctest.TestCase): "kdu-name": "ldap", "member-vnf-index": "multikdu", "namespace": None, + "kdu-deployment-name": None, } nsr_result = copy.deepcopy(db_nsr["_admin"]["deployed"]["K8s"][0]) -- 2.25.1