X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm_helm_conn.py;h=0c88abedbd983a3a48c4d8cadb465d1c0308f5a1;hb=1d8aa81e353f6a9a1921d1efb0bd96b4719ec576;hp=6fd33745f68ba0b7c7cf67318512968f6a8e92ab;hpb=28b0bf87c3fe2bd99cd3d5665eae484df8c3b44c;p=osm%2FLCM.git diff --git a/osm_lcm/lcm_helm_conn.py b/osm_lcm/lcm_helm_conn.py index 6fd3374..0c88abe 100644 --- a/osm_lcm/lcm_helm_conn.py +++ b/osm_lcm/lcm_helm_conn.py @@ -167,32 +167,41 @@ class LCMHelmConn(N2VCConnector, LcmBase): total_timeout: float = None, config: dict = None, artifact_path: str = None, + chart_model: str = None, vca_type: str = None, *kargs, **kwargs, ) -> (str, dict): """ Creates a new helm execution environment deploying the helm-chat indicated in the - attifact_path + artifact_path :param str namespace: This param is not used, all helm charts are deployed in the osm system namespace :param dict db_dict: where to write to database when the status changes. It contains a dictionary with {collection: str, filter: {}, path: str}, e.g. {collection: "nsrs", filter: {_id: , path: "_admin.deployed.VCA.3"} - :param str reuse_ee_id: ee id from an older execution. TODO - right now this params is not used + :param str reuse_ee_id: ee id from an older execution. TODO - right now this param is not used :param float progress_timeout: :param float total_timeout: :param dict config: General variables to instantiate KDU - :param str artifact_path: path of package content + :param str artifact_path: path of package content + :param str chart_model: helm 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 str vca_type: Type of vca, must be type helm or helm-v3 :returns str, dict: id of the new execution environment including namespace.helm_id and credentials object set to None as all credentials should be osm kubernetes .kubeconfig """ self.log.info( - "create_execution_environment: namespace: {}, artifact_path: {}, db_dict: {}, " - "reuse_ee_id: {}".format(namespace, artifact_path, db_dict, reuse_ee_id) + "create_execution_environment: namespace: {}, artifact_path: {}, " + "chart_model: {}, db_dict: {}, reuse_ee_id: {}".format( + namespace, artifact_path, db_dict, chart_model, reuse_ee_id + ) ) # Validate artifact-path is provided @@ -224,6 +233,13 @@ class LCMHelmConn(N2VCConnector, LcmBase): while full_path.find("//") >= 0: full_path = full_path.replace("//", "/") + # By default, the KDU is expected to be a file + kdu_model = full_path + # If the chart_model includes a "/", then it is a reference: + # e.g. (stable/openldap; stable/openldap:1.2.4) + if chart_model.find("/") >= 0: + kdu_model = chart_model + try: # Call helm conn install # Obtain system cluster id from database @@ -238,11 +254,11 @@ class LCMHelmConn(N2VCConnector, LcmBase): if vca_type == "helm": helm_id = self._k8sclusterhelm2.generate_kdu_instance_name( db_dict=db_dict, - kdu_model=full_path, + kdu_model=kdu_model, ) await self._k8sclusterhelm2.install( system_cluster_uuid, - kdu_model=full_path, + kdu_model=kdu_model, kdu_instance=helm_id, namespace=self._KUBECTL_OSM_NAMESPACE, params=config, @@ -252,11 +268,11 @@ class LCMHelmConn(N2VCConnector, LcmBase): else: helm_id = self._k8sclusterhelm2.generate_kdu_instance_name( db_dict=db_dict, - kdu_model=full_path, + kdu_model=kdu_model, ) await self._k8sclusterhelm3.install( system_cluster_uuid, - kdu_model=full_path, + kdu_model=kdu_model, kdu_instance=helm_id, namespace=self._KUBECTL_OSM_NAMESPACE, params=config,