Go to file
Eric Menendez 70b78cd848 Refresh exec-based API credentials when they expire
This is a fix for kubernetes-client/python#741.

As described in kubernetes-client/python#741, some of the authentication schemes supported by Kubernetes require updating the client's credentials from time to time. The Kubernetes Python client currently does not support this, except for when using the `gcp` auth scheme. This is because the OpenAPI-generated client code does not generally expect credentials to change after the client is configured.

However, in OpenAPITools/openapi-generator#3594, the OpenAPI generator added a (undocumented) hook on the `Configuration` object which provides a method for the client credentials to be refreshed as needed. Now that this hook exists, the `load_kube_config()` function, used by the Kubernetes API to set up the `Configuration` object from the client's local k8s config, just needs to be updated to take advantage of this hook.

This patch does this for `exec`-based authentication, which should resolve kubernetes-client/python#741.

Also, as noted above, `load_kube_config()` already has a special-case monkeypatch to refresh GCP tokens. I presume this functionality was added before the OpenAPI generator added support for the refresh hook. This patch also refactors the GCP token refreshing code to use the new hook instead of the monkeypatch.

Tests are also updated.
2021-09-03 15:53:25 -06:00
.github add PR template 2021-04-20 17:06:52 -07:00
config Refresh exec-based API credentials when they expire 2021-09-03 15:53:25 -06:00
dynamic Merge pull request #244 from hedrox/bug-rc-delete 2021-08-15 14:41:46 -07:00
hack Remove all shebangs from Python modules and checker 2019-08-27 22:18:52 +02:00
leaderelection Leader Election issue #434 2021-01-13 19:47:43 -05:00
stream Rename Method _websocket_reqeust to _websocket_request 2021-04-30 23:53:25 +02:00
watch quick fix of decoding error for BOOKMARK event 2021-04-12 21:09:53 -07:00
.gitignore Ignore IDE files 2017-06-09 13:22:07 -07:00
.travis.yml drop python2 support 2021-05-18 00:03:38 +05:30
code-of-conduct.md Add code-of-conduct.md 2017-12-20 14:15:28 -05:00
CONTRIBUTING.md Remove all shebangs from Python modules and checker 2019-08-27 22:18:52 +02:00
LICENSE Initial commit 2017-04-19 16:12:18 -07:00
OWNERS Add fabianvf to reviewers 2021-07-29 16:56:44 -04:00
README.md Remove link to kubernetes-client/community 2018-08-23 10:51:03 -07:00
run_tox.sh Verify Boilerplate fix 2018-12-05 22:22:59 +05:30
SECURITY_CONTACTS Add SECURITY_CONTACTS 2018-07-10 16:13:56 -07:00
tox.ini drop python2 support 2021-05-18 00:03:38 +05:30

python-base

Build Status

This is the utility part of the python client. It has been added to the main repo using git submodules. This structure allow other developers to create their own kubernetes client and still use standard kubernetes python utilities. For more information refer to clients-library-structure.

Contributing

Please see CONTRIBUTING.md for instructions on how to contribute.