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

Find the correct kubeconfig based on the current context #310

Merged

Conversation

algobot76
Copy link
Contributor

@algobot76 algobot76 commented Jan 7, 2024

Fix: #309
Fix: #300

@@ -152,3 +155,33 @@ func addKubeConfigFlags(cmd *cobra.Command) {
cmd.PersistentFlags().StringVarP(kubeconfigArgs.Namespace, "namespace", "n", *kubeconfigArgs.Namespace, "The the namespace scope for the operation.")
cmd.RegisterFlagCompletionFunc("namespace", completeNamespaceList)
}

func getCurrentKubeconfigPath() string {
defaultPath := path.Join(homedir.HomeDir(), ".kube", "config")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can set defaultPath := "". The cli-runtime package that we use in Timoni has the home dir logic when the client is initialised with an empty kubeconfig path, so we don't need to import k8s.io/client-go/util/homedir.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, please take a look.

@algobot76 algobot76 marked this pull request as ready for review January 8, 2024 00:46
@algobot76 algobot76 requested a review from stefanprodan January 8, 2024 06:26
@stefanprodan stefanprodan added the area/cli CLI related issues and pull requests label Jan 8, 2024
Copy link
Owner

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @algobot76 🏅

@stefanprodan stefanprodan merged commit 82eee89 into stefanprodan:main Jan 9, 2024
4 checks passed
@stefanprodan stefanprodan changed the title Find the correct kubeconfig based on thee current context Find the correct kubeconfig based on the current context Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli CLI related issues and pull requests
Projects
None yet
2 participants