kubeswitch icon indicating copy to clipboard operation
kubeswitch copied to clipboard

[Draft] Added rancher store

Open kbudde opened this issue 3 years ago • 6 comments

fixes #22

kbudde avatar Jul 13 '22 20:07 kbudde

@danielfoehrKn I implemented all the requested changes.

Thank you for the quick review and useful hints.

kbudde avatar Jul 14 '22 06:07 kbudde

@danielfoehrKn I will address them as well.

But in the meantime I've noticed an unexpected(?) behavior. Every time kubeswitch is called to select one cluster, it will create kubeconfig files for all clusters. As rancher is maintaining one list for all kubeconfig files, this is getting a little messy. Creating kubeconfig fiIes for rancher should only happen if really needed. I will have a look at it.

kbudde avatar Jul 15 '22 05:07 kbudde

Thanks for looking at it.

Every time kubeswitch is called to select one cluster, it will create kubeconfig files for all clusters.

That's one kubeconfig containing the contexts for all clusters?

danielfoehrKn avatar Jul 15 '22 08:07 danielfoehrKn

@danielfoehrKn I was misinterpreting how caching currently works. Correct me if I'm wrong but the current cache is only to speed up the initial search (StartSearch).

For rancher it is necessary to prevent GetKubeconfigForPathto be called to often. At the moment it is called once for the preview and another time after selecting the context. Each time a kubeconfig token is created on the server.

Does it make sense to move the KubeconfigFile cache to a central place. Otherwise I would add the necessary cache to this PR.

kbudde avatar Jul 17 '22 12:07 kbudde

Sorry for the late response.

Correct me if I'm wrong but the current cache is only to speed up the initial search (StartSearch).

that's correct, the Index is used to store {context_name -> kubeconfig_path}. Benefit: the user can instantly see the contexts to select.

Does it make sense to move the KubeconfigFile cache to a central place. Otherwise I would add the necessary cache to this PR.

That would make sense, so other stores could use it to save API requests (most useful for network-based stores) At the moment, all stores request the kubeconfig again each time.

Great idea!

danielfoehrKn avatar Jul 20 '22 12:07 danielfoehrKn

Let me know if I can help you in any way :)

danielfoehrKn avatar Jul 28 '22 11:07 danielfoehrKn

waiting for #50

kbudde avatar Aug 29 '22 07:08 kbudde

Hey @danielfoehrKn, I would say this PR is ready now.

Please have a look.

kbudde avatar Sep 01 '22 05:09 kbudde

Thank you very much & sorry for the delays. Unfortunately, I did not have a lot of time lately. Will create a release soon

danielfoehrKn avatar Sep 10 '22 12:09 danielfoehrKn