kontena / k8s-client

Ruby Kubernetes API client
Apache License 2.0
76 stars 26 forks source link

Config load path must be tracked #167

Open kke opened 4 years ago

kke commented 4 years ago

Any relative file references are supposed to be searched for under the directory of the kubeconfig file that defined the reference.

client-go uses filepath.isAbs(), the javascript lib uses path.isAbsolute(). k8s-client should probably use the Pathname#absolute? to build the final path.

For example when merging kubeconfigs, the origin of each entry must be tracked so the reference can be resolved later.

kke commented 4 years ago

Actually it does not resolve exec command paths the same way:

https://github.com/kubernetes/client-go/blob/611184f7c43ae2d520727f01d49620c7ed33412d/tools/clientcmd/loader.go#L579

But the issue is still relevant for the relative certificate paths etc. The load location must be tracked and in case the command has path separators, and is not absolute?, the load origin must be known.