Skip to content

Commit

Permalink
remove check for cluster port
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin <[email protected]>
  • Loading branch information
KPostOffice authored and openshift-merge-bot[bot] committed May 23, 2024
1 parent 077db18 commit 7d758eb
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/codeflare_sdk/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,20 +633,17 @@ def get_current_namespace(): # pragma: no cover
print("Unable to find current namespace")
return None
else:
if "KUBERNETES_PORT" in os.environ:
if os.path.isfile(
"/var/run/secrets/kubernetes.io/serviceaccount/namespace"
):
try:
file = open(
"/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r"
)
active_context = file.readline().strip("\n")
return active_context
except Exception as e:
print(
"unable to gather namespace from /var/run/secrets/kubernetes.io/serviceaccount/namespace trying to gather from current context"
)
if os.path.isfile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"):
try:
file = open(
"/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r"
)
active_context = file.readline().strip("\n")
return active_context
except Exception as e:
print(
"unable to gather namespace from /var/run/secrets/kubernetes.io/serviceaccount/namespace trying to gather from current context"
)
else:
try:
_, active_context = config.list_kube_config_contexts(config_check())
Expand Down

0 comments on commit 7d758eb

Please sign in to comment.