Skip to content

Commit ea59fa2

Browse files
committed
fix: Search for incluster config if no kubeconfig is given
Signed-off-by: oliver könig <okoenig@nvidia.com>
1 parent 7fc5426 commit ea59fa2

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

nemo_run/run/ray/kuberay.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,20 @@ class KubeRayCluster:
6060
def __post_init__(self) -> None: # noqa: D401 – simple verb is fine
6161
"""Initialise Kubernetes API clients once the instance is created."""
6262
# Load local kube-config once; the function returns *None* so we don't store it.
63-
config.load_kube_config()
63+
try:
64+
config.load_kube_config()
65+
except Exception as kube_config_error:
66+
logger.error(
67+
"Error loading kube-config: %s, trying with incluster config", kube_config_error
68+
)
69+
try:
70+
config.load_incluster_config()
71+
except Exception as incluster_config_error:
72+
logger.error(
73+
"Error loading incluster config: %s, raising original error",
74+
incluster_config_error,
75+
)
76+
raise kube_config_error from incluster_config_error
6477

6578
# The dedicated clients are what we interact with throughout the class
6679
# – separating CoreV1 for pods/services from CustomObjects for CRDs.

0 commit comments

Comments
 (0)