From: garciadeblas Date: Wed, 8 Jun 2022 13:39:24 +0000 (+0200) Subject: Update _split_version to check if the kdu_model is a reference or a file X-Git-Tag: v12.0.0rc1~9 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0439319e76e6a5e71ecf4b3efd1ece2c82d52b53;p=osm%2FN2VC.git Update _split_version to check if the kdu_model is a reference or a file Change-Id: I80dac9f24f652d2a71d9dcbb88cbc2c6850440db Signed-off-by: garciadeblas --- diff --git a/n2vc/k8s_helm3_conn.py b/n2vc/k8s_helm3_conn.py index bb08f07..107f954 100644 --- a/n2vc/k8s_helm3_conn.py +++ b/n2vc/k8s_helm3_conn.py @@ -84,7 +84,12 @@ class K8sHelm3Connector(K8sHelmBaseConnector): """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. diff --git a/n2vc/k8s_helm_base_conn.py b/n2vc/k8s_helm_base_conn.py index d446b9b..a4eab4b 100644 --- a/n2vc/k8s_helm_base_conn.py +++ b/n2vc/k8s_helm_base_conn.py @@ -371,6 +371,9 @@ class K8sHelmBaseConnector(K8sConnector): 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, @@ -1954,7 +1957,7 @@ class K8sHelmBaseConnector(K8sConnector): 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]) diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index 8c526f5..5fe624b 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -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 - :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 - - 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