Generate names for K8s pods when file or url 19/8519/2
authorquilesj <e.nvi001.tid@telefonica.com>
Thu, 23 Jan 2020 09:28:26 +0000 (09:28 +0000)
committerisraelad <adam.israel@canonical.com>
Thu, 30 Jan 2020 16:39:36 +0000 (17:39 +0100)
Change-Id: I99e50cda65df2462c90775eb84a096232428ffc4
Signed-off-by: quilesj <e.nvi001.tid@telefonica.com>
n2vc/k8s_helm_conn.py

index f7ff853..f49159e 100644 (file)
@@ -770,6 +770,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():