From 3f55265730220a1e43621b7b26b17f2d5ff8a076 Mon Sep 17 00:00:00 2001 From: Dominik Fleischmann Date: Thu, 26 Mar 2020 12:21:42 +0100 Subject: [PATCH] Add local k8s charms support This adds the support to deploy Kuberentes Charm Bundles that are available locally (directly inside the vnf descriptor). Change-Id: Ib2e191df5f905ba909f935f2005347d2cf83da74 Signed-off-by: Dominik Fleischmann --- n2vc/k8s_juju_conn.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/n2vc/k8s_juju_conn.py b/n2vc/k8s_juju_conn.py index 895e82b..3316087 100644 --- a/n2vc/k8s_juju_conn.py +++ b/n2vc/k8s_juju_conn.py @@ -351,6 +351,8 @@ class K8sJujuConnector(K8sConnector): - """ + previous_workdir = os.getcwd() + bundle = kdu_model if kdu_model.startswith("cs:"): bundle = kdu_model @@ -358,12 +360,11 @@ class K8sJujuConnector(K8sConnector): # Download the file pass else: - # Local file + new_workdir = kdu_model.strip(kdu_model.split("/")[-1]) - # if kdu_model.endswith(".tar.gz") or kdu_model.endswith(".tgz") - # Uncompress temporarily - # bundle = - pass + os.chdir(new_workdir) + + bundle = "local:{}".format(kdu_model) if not bundle: # Raise named exception that the bundle could not be found @@ -396,6 +397,7 @@ class K8sJujuConnector(K8sConnector): self.log.debug("All units active.") except concurrent.futures._base.TimeoutError: + os.chdir(previous_workdir) self.log.debug("[install] Timeout exceeded; resetting cluster") await self.reset(cluster_uuid) return False @@ -405,6 +407,8 @@ class K8sJujuConnector(K8sConnector): self.log.debug("[install] Disconnecting model") await model.disconnect() + os.chdir(previous_workdir) + return kdu_instance raise Exception("Unable to install") -- 2.17.1