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

fix: prioritize KUBECONFIG env over inCluster #499

Closed
wants to merge 1 commit into from

Conversation

MJjainam
Copy link

This is the behaviour even for kubectl CLI.

@dark0dave dark0dave requested review from chaitanya-rafay, stepanstipl and dark0dave and removed request for chaitanya-rafay August 16, 2023 21:52
@stepanstipl stepanstipl added this to the 0.8.0 milestone Sep 4, 2023
This is the behaviour even for kubectl CLI.
@dark0dave
Copy link
Collaborator

dark0dave commented Sep 5, 2023

This should be handled in config.go not in the kube.go. This is a configuration. Happy to change it. @stepanstipl wdyt?

@stepanstipl
Copy link
Contributor

stepanstipl commented Sep 5, 2023

Hmm.. 🤔 I think it would be best to mirror kubectl behaviour in this aspect, as that's what everyone is used to (and I think it's a bit more complex than just checking one env variable). But I would also like to keep it simple, and for sure don't want to reinvent the wheel. Also, there're multiple ways to create the client config in the client-go clientcmd package.

Can we find out what exactly the kubectl does (code ref. would be great)?

@dark0dave dark0dave requested review from chaitanya-rafay and removed request for chaitanya-rafay September 9, 2023 02:45
@MJjainam
Copy link
Author

MJjainam commented Oct 8, 2023

@stepanstipl I was unable to find the exact way how kubectl loads. Although what I could find was that

clientConfig := clientcmd.NewDefaultClientConfig(*config, &configOverrides)

client-go function does have loading rules from KUBECONFIG env variable.

Copy link

github-actions bot commented Dec 8, 2023

This PR has not seen any activity in last 60 days and has been marked as stale

@github-actions github-actions bot added the stale label Dec 8, 2023
@dark0dave dark0dave removed the stale label Dec 22, 2023
@dark0dave dark0dave assigned dark0dave and unassigned stepanstipl Dec 22, 2023
@dark0dave
Copy link
Collaborator

this should be handled in config.go

@dark0dave dark0dave closed this Dec 22, 2023
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