Fix bug 1412: Generate kdu instance from LCM
[osm/LCM.git] / osm_lcm / ns.py
index e5b1060..75db8e5 100644 (file)
@@ -1232,7 +1232,7 @@ class NsLcm(LcmBase):
                         cloud_name=vca_k8s_cloud,
                         credential_name=vca_k8s_cloud_credential,
                     )
-                elif vca_type == "helm" or vca_type == "helm-v3":                    
+                elif vca_type == "helm" or vca_type == "helm-v3":     
                     ee_id, credentials = await self.vca_map[vca_type].create_execution_environment(
                         namespace=namespace,
                         reuse_ee_id=ee_id,
@@ -2192,7 +2192,12 @@ class NsLcm(LcmBase):
                                "filter": {"_id": nsr_id},
                                "path": nsr_db_path}
 
-            kdu_instance = await self.k8scluster_map[k8sclustertype].install(
+            kdu_instance = self.k8scluster_map[k8sclustertype].generate_kdu_instance_name(
+                db_dict=db_dict_install,
+                kdu_model=k8s_instance_info["kdu-model"],
+            )
+            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"],
                 kdu_model=k8s_instance_info["kdu-model"],
                 atomic=True,
@@ -2200,7 +2205,9 @@ class NsLcm(LcmBase):
                 db_dict=db_dict_install,
                 timeout=timeout,
                 kdu_name=k8s_instance_info["kdu-name"],
-                namespace=k8s_instance_info["namespace"])
+                namespace=k8s_instance_info["namespace"],
+                kdu_instance=kdu_instance,
+            )
             self.update_db_2("nsrs", nsr_id, {nsr_db_path + ".kdu-instance": kdu_instance})
 
             # Obtain services to obtain management service ip