From: romeromonser Date: Fri, 28 May 2021 09:53:17 +0000 (+0200) Subject: Bugfix 1550: Setting a custom release name for Helm based kdus X-Git-Tag: v9.1.2~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F10905%2F3;p=osm%2FLCM.git Bugfix 1550: Setting a custom release name for Helm based kdus Change-Id: Ia561b6c840d29b4d6c091c8871924ed837acd76f Signed-off-by: romeromonser --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index bac3755..ce7be13 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -2207,11 +2207,14 @@ class NsLcm(LcmBase): "filter": {"_id": nsr_id}, "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}) await self.k8scluster_map[k8sclustertype].install( cluster_uuid=k8s_instance_info["k8scluster-uuid"], @@ -2364,6 +2367,7 @@ class NsLcm(LcmBase): vnfd_with_id = find_in_list(db_vnfds, lambda vnfd: vnfd["_id"] == vnfd_id) kdud = next(kdud for kdud in vnfd_with_id["kdu"] 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 @@ -2427,7 +2431,8 @@ class NsLcm(LcmBase): "member-vnf-index": vnfr_data["member-vnf-index-ref"], "kdu-name": kdur["kdu-name"], "kdu-model": kdumodel, - "namespace": namespace} + "namespace": namespace, + "kdu-deployment-name": kdu_deployment_name} db_path = "_admin.deployed.K8s.{}".format(index) db_nsr_update[db_path] = k8s_instance_info self.update_db_2("nsrs", nsr_id, db_nsr_update) diff --git a/osm_lcm/tests/test_ns.py b/osm_lcm/tests/test_ns.py index c0dda15..0dac1e1 100644 --- a/osm_lcm/tests/test_ns.py +++ b/osm_lcm/tests/test_ns.py @@ -547,7 +547,9 @@ class TestMyNS(asynctest.TestCase): "k8scluster-type": "helm-chart-v3", "kdu-name": "ldap", "member-vnf-index": "multikdu", - "namespace": None} + "namespace": None, + "kdu-deployment-name": None, + } nsr_result = copy.deepcopy(db_nsr["_admin"]["deployed"]["K8s"][0]) nsr_kdu_model_result = nsr_result.pop("kdu-model")