client icon indicating copy to clipboard operation
client copied to clipboard

Load config file from KUBECONFIG env

Open MyIgel opened this issue 1 year ago • 2 comments

It would be great it the client would try to load a config defined in the KUBECONFIG env var. At the moment only $HOME/.kube/config is checked: https://github.com/swiftkube/client/blob/4f278b291ae53870306c5346bbb5f5d2c5c3e563/Sources/SwiftkubeClient/Config/KubernetesClientConfig.swift#L207

MyIgel avatar May 24 '23 09:05 MyIgel

Hi @MyIgel, I think this would make sense. I actually wrote this bit of code and I can give you some guidance here if you want to do a PR.

I think you should just make a new struct that implements the protocol KubernetesClientConfigLoader and that way it'll fit in with all the others. I'm not sure modifying the existing behaviour is what you want to do. But you can check with @iabudiab

thomashorrobin avatar Jun 02 '23 17:06 thomashorrobin

@MyIgel Yes, this is useful and should be easy to do

@thomashorrobin Exactly. I guess, the behaviour change is minimal and should be expected:

  • first $HOME/.kube/config
  • then KUBECONFIG env var
  • then /var/run/secrets/kubernetes.io/serviceaccount

iabudiab avatar Jun 04 '23 12:06 iabudiab