Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python-clusters/attach-gke-cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions python-lib/dku_kube/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the kube config path is already log before, but I guess the repetition doesn't harm anyone ;)

subprocess.check_call(["kubectl", "create", "clusterrolebinding", "cluster-admin-binding", "--clusterrole", "cluster-admin", "--user", user_name], env=env)