Update _split_version to check if the kdu_model is a reference or a file 83/12183/4
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 8 Jun 2022 13:39:24 +0000 (15:39 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 8 Jun 2022 15:23:38 +0000 (17:23 +0200)
Change-Id: I80dac9f24f652d2a71d9dcbb88cbc2c6850440db
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
n2vc/k8s_helm3_conn.py
n2vc/k8s_helm_base_conn.py
n2vc/k8s_helm_conn.py

index bb08f07..107f954 100644 (file)
@@ -84,7 +84,12 @@ class K8sHelm3Connector(K8sHelmBaseConnector):
         """Install a helm chart
 
         :param cluster_uuid str: The UUID of the cluster to install to
         """Install a helm chart
 
         :param cluster_uuid str: The UUID of the cluster to install to
-        :param kdu_model str: The name or path of a bundle to install
+        :param kdu_model str: chart/reference (string), which can be either
+            of these options:
+            - a name of chart available via the repos known by OSM
+              (e.g. stable/openldap, stable/openldap:1.2.4)
+            - a path to a packaged chart (e.g. mychart.tgz)
+            - a path to an unpacked chart directory or a URL (e.g. mychart)
         :param kdu_instance: Kdu instance name
         :param atomic bool: If set, waits until the model is active and resets
                             the cluster on failure.
         :param kdu_instance: Kdu instance name
         :param atomic bool: If set, waits until the model is active and resets
                             the cluster on failure.
index d446b9b..a4eab4b 100644 (file)
@@ -371,6 +371,9 @@ class K8sHelmBaseConnector(K8sConnector):
 
         return True
 
 
         return True
 
+    def _is_helm_chart_a_file(self, chart_name: str):
+        return chart_name.count("/") > 1
+
     async def _install_impl(
         self,
         cluster_id: str,
     async def _install_impl(
         self,
         cluster_id: str,
@@ -1954,7 +1957,7 @@ class K8sHelmBaseConnector(K8sConnector):
 
     def _split_version(self, kdu_model: str) -> (str, str):
         version = None
 
     def _split_version(self, kdu_model: str) -> (str, str):
         version = None
-        if ":" in kdu_model:
+        if not self._is_helm_chart_a_file(kdu_model) and ":" in kdu_model:
             parts = kdu_model.split(sep=":")
             if len(parts) == 2:
                 version = str(parts[1])
             parts = kdu_model.split(sep=":")
             if len(parts) == 2:
                 version = str(parts[1])
index 8c526f5..5fe624b 100644 (file)
@@ -110,11 +110,12 @@ class K8sHelmConnector(K8sHelmBaseConnector):
         happen before any _initial-config-primitive_of the VNF is called).
 
         :param cluster_uuid: UUID of a K8s cluster known by OSM
         happen before any _initial-config-primitive_of the VNF is called).
 
         :param cluster_uuid: UUID of a K8s cluster known by OSM
-        :param kdu_model: chart/ reference (string), which can be either
+        :param kdu_model: chart/reference (string), which can be either
             of these options:
             - a name of chart available via the repos known by OSM
             of these options:
             - a name of chart available via the repos known by OSM
-            - a path to a packaged chart
-            - a path to an unpacked chart directory or a URL
+              (e.g. stable/openldap, stable/openldap:1.2.4)
+            - a path to a packaged chart (e.g. mychart.tgz)
+            - a path to an unpacked chart directory or a URL (e.g. mychart)
         :param kdu_instance: Kdu instance name
         :param atomic: If set, installation process purges chart/bundle on fail, also
             will wait until all the K8s objects are active
         :param kdu_instance: Kdu instance name
         :param atomic: If set, installation process purges chart/bundle on fail, also
             will wait until all the K8s objects are active