[Draft] Added rancher store
fixes #22
@danielfoehrKn I implemented all the requested changes.
Thank you for the quick review and useful hints.
@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.
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 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.
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!
Let me know if I can help you in any way :)
waiting for #50
Hey @danielfoehrKn, I would say this PR is ready now.
Please have a look.
Thank you very much & sorry for the delays. Unfortunately, I did not have a lot of time lately. Will create a release soon