File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments