X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fk8s_helm_conn.py;h=01b448b7e97350823f4c7cae81bb0a4874495bea;hp=e57c42fb7bbba4bff985136411420ed5e38656a9;hb=refs%2Fchanges%2F44%2F8544%2F1;hpb=23451b824137bb675246562d7cc67d090720ff8f diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index e57c42f..01b448b 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -102,6 +102,17 @@ class K8sHelmConnector(K8sConnector): namespace: str = 'kube-system', reuse_cluster_uuid=None ) -> (str, bool): + """ + It prepares a given K8s cluster environment to run Charts on both sides: + client (OSM) + server (Tiller) + + :param k8s_creds: credentials to access a given K8s cluster, i.e. a valid '.kube/config' + :param namespace: optional namespace to be used for helm. By default, 'kube-system' will be used + :param reuse_cluster_uuid: existing cluster uuid for reuse + :return: uuid of the K8s cluster and True if connector has installed some software in the cluster + (on error, an exception will be raised) + """ cluster_uuid = reuse_cluster_uuid if not cluster_uuid: @@ -770,6 +781,15 @@ class K8sHelmConnector(K8sConnector): def _generate_release_name( chart_name: str ): + # check embeded chart (file or dir) + if chart_name.startswith('/'): + # extract file or directory name + chart_name = chart_name[chart_name.rfind('/')+1:] + # check URL + elif '://' in chart_name: + # extract last portion of URL + chart_name = chart_name[chart_name.rfind('/')+1:] + name = '' for c in chart_name: if c.isalpha() or c.isnumeric():