Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load kubeconfig first in case it is provided by CLI arg #251

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

shlomosfez
Copy link
Contributor

Currently, krr tries to load local cluster by default, and only if fails it tries to load from kubeconfig.

In this small PR, we first check if the kubeconfig or context arguments are provided, and if so, try to use it first

Thanks

@CLAassistant
Copy link

CLAassistant commented Mar 29, 2024

CLA assistant check
All committers have signed the CLA.

@aantn
Copy link
Contributor

aantn commented Mar 31, 2024

Thanks for the PR. As a slightly alternative implementation, would something like this work?

    def load_kubeconfig(self) -> None:
        try:
            config.load_kube_config(config_file=self.kubeconfig, context=self.context)
            self.inside_cluster = False
        except ConfigException:
            config.load_incluster_config()
            self.inside_cluster = True

It simplies the flow and should have the same behaviour in every case we care about. But note that I haven't tested it yet.

@shlomosfez
Copy link
Contributor Author

Love it! Changes applied

@LeaveMyYard LeaveMyYard merged commit d65cf3d into robusta-dev:main Apr 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants