From 6da7447d3abcfae1c278c7d8a200288b5e408cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=A9?= Date: Mon, 12 Dec 2022 06:54:17 +0000 Subject: [PATCH] separte weak relate condtions --- kubernetes/base/config/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kubernetes/base/config/__init__.py b/kubernetes/base/config/__init__.py index 74c24dcc5..d66816e27 100644 --- a/kubernetes/base/config/__init__.py +++ b/kubernetes/base/config/__init__.py @@ -33,8 +33,12 @@ def load_config(**kwargs): can be passed to either load_kube_config or load_incluster_config functions. """ - if "kube_config_path" in kwargs.keys() or exists(expanduser(KUBE_CONFIG_DEFAULT_LOCATION)): - kwargs["config_file"] = kwargs.pop("kube_config_path", None) + if "kube_config_path" in kwargs.keys(): + kube_config_path = kwargs.pop("kube_config_path", None) + if "config_file" not in kwargs.keys(): + kwargs["config_file"] = kube_config_path + load_kube_config(**kwargs) + elif exists(expanduser(KUBE_CONFIG_DEFAULT_LOCATION)): load_kube_config(**kwargs) else: print(