Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

relative paths in kube config file are not interpreted correctly #130

Open
exarkun opened this issue Apr 28, 2017 · 5 comments
Open

relative paths in kube config file are not interpreted correctly #130

exarkun opened this issue Apr 28, 2017 · 5 comments

Comments

@exarkun
Copy link

exarkun commented Apr 28, 2017

This was reported by a txkube user: LeastAuthority/txkube#119. txkube uses pykube's config loader.

From the original report:

$ cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
    certificate-authority: dev-ca.crt
...
  File "/usr/local/lib/python2.7/dist-packages/pykube/config.py", line 142, in clusters
    BytesOrFile.maybe_set(c, "certificate-authority")
  File "/usr/local/lib/python2.7/dist-packages/pykube/config.py", line 225, in maybe_set
    d[file_key] = cls(filename=d[file_key])
  File "/usr/local/lib/python2.7/dist-packages/pykube/config.py", line 241, in __init__
    raise exceptions.PyKubeError("'{}' file does not exist".format(filename))
pykube.exceptions.PyKubeError: 'dev-ca.crt' file does not exist``` 

the ca file resides in ~/.kube/dev-ca.crt. The same problem reoccurs with users[].user.client-certificate and .client-key. Putting absolute paths into ~/.kube/config appears to avoid the issue.

@exarkun
Copy link
Author

exarkun commented May 17, 2017

Anybody?

@brosner
Copy link
Contributor

brosner commented Jun 30, 2017

My apologies on the long response time.

I definitely want to see this supported. I am going to look up the expected behavior of kubectl here. Do you know if what you are proposing (relative paths are relative to the kube config) the behavior of kubectl?

@exarkun
Copy link
Author

exarkun commented Jun 30, 2017

Thanks for the reply.

I'm not sure if this is the behavior of kubectl but the upstream bug report seems to imply it is. The value is taken from someone's existing ~/.kube/config and they were expecting it to work. I suspect that means they're successfully using it with kubectl but I don't know for sure.

@brosner
Copy link
Contributor

brosner commented Jul 1, 2017

I have confirmed that relative paths in kubeconfig should be resolved relative to the location of the file. I will get a fix up in the next couple of days.

@exarkun
Copy link
Author

exarkun commented Sep 14, 2017

Any chance you've had time or will have time soon for this? Thanks. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants