From: garciadeblas Date: Mon, 31 May 2021 13:49:15 +0000 (+0200) Subject: Improve logs for K8sJujuConnector init_env X-Git-Tag: v12.0.0rc1~29 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F10920%2F5;p=osm%2FN2VC.git Improve logs for K8sJujuConnector init_env Change-Id: I013b6c062cf29d9a69e39ab8fdc363e9bd052873 Signed-off-by: garciadeblas --- diff --git a/n2vc/k8s_juju_conn.py b/n2vc/k8s_juju_conn.py index d9dc607..1704ec0 100644 --- a/n2vc/k8s_juju_conn.py +++ b/n2vc/k8s_juju_conn.py @@ -122,10 +122,12 @@ class K8sJujuConnector(K8sConnector): # if it fails in the middle of the process cleanup_data = [] try: + self.log.debug("Initializing K8s cluster for juju") kubectl.create_cluster_role( name=metadata_name, labels=labels, ) + self.log.debug("Cluster role created") cleanup_data.append( { "delete": kubectl.delete_cluster_role, @@ -137,6 +139,7 @@ class K8sJujuConnector(K8sConnector): name=metadata_name, labels=labels, ) + self.log.debug("Service account created") cleanup_data.append( { "delete": kubectl.delete_service_account, @@ -148,6 +151,7 @@ class K8sJujuConnector(K8sConnector): name=metadata_name, labels=labels, ) + self.log.debug("Role binding created") cleanup_data.append( { "delete": kubectl.delete_service_account, @@ -159,6 +163,7 @@ class K8sJujuConnector(K8sConnector): ) default_storage_class = kubectl.get_default_storage_class() + self.log.debug("Default storage class: {}".format(default_storage_class)) await libjuju.add_k8s( name=cluster_uuid, rbac_id=rbac_id, @@ -168,9 +173,10 @@ class K8sJujuConnector(K8sConnector): storage_class=default_storage_class, credential_name=self._get_credential_name(cluster_uuid), ) + self.log.debug("K8s cluster added to juju controller") return cluster_uuid, True except Exception as e: - self.log.error("Error initializing k8scluster: {}".format(e)) + self.log.error("Error initializing k8scluster: {}".format(e), exc_info=True) if len(cleanup_data) > 0: self.log.debug("Cleaning up created resources in k8s cluster...") for item in cleanup_data: