File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
src/codeflare_sdk/cluster Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 2121
2222import abc
2323from kubernetes import client , config
24+ import os
2425
2526global api_client
2627api_client = None
@@ -161,14 +162,16 @@ def config_check() -> str:
161162 """
162163 global config_path
163164 global api_client
165+ home_directory = os .path .expanduser ("~" )
164166 if config_path == None and api_client == None :
165- try :
167+ if os . path . isfile ( "%s/.kube/config" % home_directory ) :
166168 config .load_kube_config ()
167- except config .config_exception .ConfigException :
168- try :
169- config .load_incluster_config ()
170- except :
171- print ("Unable to load config file or in cluster configuration" )
169+ elif "KUBERNETES_PORT" in os .environ :
170+ config .load_incluster_config ()
171+ else :
172+ print (
173+ "Unable to load config file or in cluster configuration, try specifying a config file path with load_kube_config()"
174+ )
172175
173176 if config_path != None and api_client == None :
174177 return config_path
You can’t perform that action at this time.
0 commit comments