Use NS uuid when creating a juju k8s model 96/8396/1 sol006
authorDominik Fleischmann <dominik.fleischmann@canonical.com>
Thu, 12 Dec 2019 16:35:38 +0000 (17:35 +0100)
committerDominik Fleischmann <dominik.fleischmann@canonical.com>
Thu, 12 Dec 2019 16:35:38 +0000 (17:35 +0100)
This commit fixes bug 972, previously it was using the namespace
value that was always assigned to kube-system. This caused an error
in Juju due to kube-system already existing.
https://osm.etsi.org/bugzilla/show_bug.cgi?id=972

Change-Id: I840d65ef9991f64eba42a205900d42cb0a9bbeef
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
n2vc/k8s_juju_conn.py

index 1f7cc00..bffa8bf 100644 (file)
@@ -316,16 +316,16 @@ class K8sJujuConnector(K8sConnector):
             await self.login(cluster_uuid)
 
         ##
             await self.login(cluster_uuid)
 
         ##
-        # Get or create the model, based on the namespace the cluster was
-        # instantiated with.
-        namespace = self.get_namespace(cluster_uuid)
+        # Get or create the model, based on the NS 
+        # uuid.
+        model_name = db_dict["filter"]["_id"]
 
 
-        self.log.debug("Checking for model named {}".format(namespace))
-        model = await self.get_model(namespace, cluster_uuid=cluster_uuid)
+        self.log.debug("Checking for model named {}".format(model_name))
+        model = await self.get_model(model_name, cluster_uuid=cluster_uuid)
         if not model:
             # Create the new model
         if not model:
             # Create the new model
-            self.log.debug("Adding model: {}".format(namespace))
-            model = await self.add_model(namespace, cluster_uuid=cluster_uuid)
+            self.log.debug("Adding model: {}".format(model_name))
+            model = await self.add_model(model_name, cluster_uuid=cluster_uuid)
 
         if model:
             # TODO: Instantiation parameters
 
         if model:
             # TODO: Instantiation parameters