From ebf5a99afe296644ac783505b79e8fba94ffe733 Mon Sep 17 00:00:00 2001 From: Amandine Souilleux Date: Thu, 15 Dec 2022 17:07:56 +0100 Subject: [PATCH] [sc-47182] Add logs, fix logs --- python-clusters/attach-gke-cluster/cluster.py | 2 +- python-lib/dku_kube/role.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python-clusters/attach-gke-cluster/cluster.py b/python-clusters/attach-gke-cluster/cluster.py index a189437..1287018 100644 --- a/python-clusters/attach-gke-cluster/cluster.py +++ b/python-clusters/attach-gke-cluster/cluster.py @@ -31,7 +31,7 @@ def start(self): kube_config_path = os.path.join(os.getcwd(), 'kube_config') create_kube_config_file(cluster.name, is_regional, kube_config_path) - # add the admin role so that we can do the managed kubernetes stuff for spark + # add the admin role so that we can do the managed kubernetes stuff for Spark create_admin_binding(self.config.get("userName", None), kube_config_path) # collect and prepare the overrides so that DSS can know where and how to use the cluster diff --git a/python-lib/dku_kube/role.py b/python-lib/dku_kube/role.py index 0a7515a..58f1bba 100644 --- a/python-lib/dku_kube/role.py +++ b/python-lib/dku_kube/role.py @@ -9,9 +9,10 @@ def create_admin_binding(user_name=None, kube_config_path=None): env = os.environ.copy() if not _is_none_or_blank(kube_config_path): env['KUBECONFIG'] = kube_config_path - logging.info("Checking clusterrolebinding with KUBECONFIG=%s" % kube_config_path) + logging.info("Checking ClusterRoleBinding existence with KUBECONFIG=%s" % kube_config_path) out = subprocess.check_output(["kubectl", "get", "clusterrolebinding", "cluster-admin-binding", "--ignore-not-found"], env=env) if not _is_none_or_blank(out): - logging.info("Clusterrolebinding already exist") + logging.info("ClusterRoleBinding already exists") else: + logging.info("Creating ClusterRoleBinding with KUBECONFIG=%s" % kube_config_path) subprocess.check_call(["kubectl", "create", "clusterrolebinding", "cluster-admin-binding", "--clusterrole", "cluster-admin", "--user", user_name], env=env)