Skip to content

Commit

Permalink
Load kubeconfig first in case it is provided by CLI arg (#251)
Browse files Browse the repository at this point in the history
* Load kubeconfig first in case it is provided by CLI arg

* simplify implementation

---------

Co-authored-by: Pavel Zhukov <[email protected]>
  • Loading branch information
shlomosfez and LeaveMyYard authored Apr 2, 2024
1 parent a005d7e commit d65cf3d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions robusta_krr/core/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d65cf3d

Please sign in to comment.