Fix bug 1467
[osm/N2VC.git] / n2vc / k8s_helm_base_conn.py
index af22ecc..a79f038 100644 (file)
@@ -293,6 +293,7 @@ class K8sHelmBaseConnector(K8sConnector):
             kdu_model: str,
             paths: dict,
             env: dict,
+            kdu_instance: str,
             atomic: bool = True,
             timeout: float = 300,
             params: dict = None,
@@ -313,23 +314,6 @@ class K8sHelmBaseConnector(K8sConnector):
                 version = str(parts[1])
                 kdu_model = parts[0]
 
-        # generate a name for the release. Then, check if already exists
-        kdu_instance = None
-        while kdu_instance is None:
-            kdu_instance = self._generate_release_name(kdu_model)
-            try:
-                result = await self._status_kdu(
-                    cluster_id=cluster_id,
-                    kdu_instance=kdu_instance,
-                    namespace=namespace,
-                    show_error_log=False,
-                )
-                if result is not None:
-                    # instance already exists: generate a new one
-                    kdu_instance = None
-            except K8sException:
-                pass
-
         command = self._get_install_command(kdu_model, kdu_instance, namespace,
                                             params_str, version, atomic, timeout)
 
@@ -389,8 +373,6 @@ class K8sHelmBaseConnector(K8sConnector):
             self.log.error(msg)
             raise K8sException(msg)
 
-        return kdu_instance
-
     async def upgrade(
         self,
         cluster_uuid: str,
@@ -1377,7 +1359,8 @@ class K8sHelmBaseConnector(K8sConnector):
         return params_str
 
     @staticmethod
-    def _generate_release_name(chart_name: str):
+    def generate_kdu_instance_name(**kwargs):
+        chart_name = kwargs["kdu_model"]
         # check embeded chart (file or dir)
         if chart_name.startswith("/"):
             # extract file or directory name