From d65cf3d422c825af4f29a5705706c64614ab7820 Mon Sep 17 00:00:00 2001 From: shlomosfez <143969671+shlomosfez@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:14:23 +0300 Subject: [PATCH] Load kubeconfig first in case it is provided by CLI arg (#251) * Load kubeconfig first in case it is provided by CLI arg * simplify implementation --------- Co-authored-by: Pavel Zhukov <33721692+LeaveMyYard@users.noreply.github.com> --- robusta_krr/core/models/config.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/robusta_krr/core/models/config.py b/robusta_krr/core/models/config.py index d4f04a0e..ff6142a6 100644 --- a/robusta_krr/core/models/config.py +++ b/robusta_krr/core/models/config.py @@ -138,11 +138,10 @@ def logging_console(self) -> Console: def load_kubeconfig(self) -> None: try: - config.load_incluster_config() - except ConfigException: config.load_kube_config(config_file=self.kubeconfig, context=self.context) self.inside_cluster = False - else: + except ConfigException: + config.load_incluster_config() self.inside_cluster = True def get_kube_client(self, context: Optional[str] = None):