Kubernetes Prow Robot
b9cc79e17a
Merge pull request #250 from twitter-forks/emenendez/741
...
Refresh exec-based API credentials when they expire
2021-11-29 16:36:56 -08:00
WalkerWang731
8b306c0f57
add a new method of config.kube_config.new_client_from_config_dict
...
Signed-off-by: WalkerWang731 <wxy1990731@hotmail.com>
2021-11-17 16:53:43 +08:00
DiptoChakrabarty
95e2e85af5
closes open file descriptors to prevent leaks
2021-10-15 19:14:37 +05:30
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
David Otto
e2ba3fb9fc
do expanduser in load_config
2021-07-12 11:21:13 +02:00
David Otto
dca0ca6df2
Fix load_config: expand ~
2021-07-07 12:54:38 +02:00
Kubernetes Prow Robot
0d4f822f4f
Merge pull request #221 from MoShitrit/m3e-issue-1005
...
Add load_config method which allows a more generic way to load the kubeconfig
2021-06-22 12:18:10 -07:00
Moshe Shitrit
6d1c8d3713
Apply suggestion
2021-06-19 17:42:37 +03:00
JackYoon
fc5b7302b1
load_kube_config_from_dict() support define custom temp files path
2021-04-15 02:59:36 +08:00
Moshe Shitrit
698299af9d
isort
2021-03-22 00:22:04 -04:00
Moshe Shitrit
b5aa2dd371
Address remarks from pycodestyle
2021-03-22 00:16:52 -04:00
Moshe Shitrit
cf2f312fd0
Applied autopep8 properly this time. This should work
2021-03-21 23:59:43 -04:00
Moshe Shitrit
0a5b04feea
Revert black and only try autopep8 this time
2021-03-21 23:44:32 -04:00
Moshe Shitrit
0395a10718
Run black linter to make update-pycodestyle happy
2021-03-21 23:27:47 -04:00
Moshe Shitrit
9bce8696ff
Switching print statement to use legacy .format() method, in order to maintain backwards-compatibility with pre-3.6 Python versions
2021-03-21 23:01:35 -04:00
Moshe Shitrit
8e4c5ebe4f
Merge branch 'master' into m3e-issue-1005
2021-03-21 22:38:33 -04:00
Tom Haddon
ed98daeae9
Fix trivial typo in error messages - 'does not exist' vs. 'does not exists'
2021-03-19 05:56:27 +01:00
Mridul Seth
3c719874c6
fix typo in test file
2021-02-01 19:13:29 +01:00
Mridul Seth
76d8fbda28
fix codestyle
2021-01-25 13:43:26 +01:00
Mridul Seth
8a3bdb8ebe
take care of empty kube_config files
2021-01-23 19:23:45 +01:00
Moshe Shitrit
2c9ddf94b6
Revert switch to pathlib, to maintain Python2 support
2021-01-04 23:58:25 -05:00
Moshe Shitrit
10db259908
Document kwargs param
2020-12-25 12:59:27 -05:00
Moshe Shitrit
0c662bb33d
Adding load_config wrapper method to have a more generic way of initializing the client config
2020-12-25 12:22:38 -05:00
Moshe Shitrit
7199c14a8d
Change KUBE_CONFIG_DEFAULT_LOCATION to use pathlib.Path.home instead of hard-coded "~". This is a more "Pythonic" way of setting that value.
2020-12-25 12:11:42 -05:00
Dylan Shepard
0559445cb4
unused io import, pre-setting pycodestyle
2020-09-09 07:28:51 -07:00
Dylan Shepard
9f4775f43f
trying to fix pycodestyle problems
2020-09-09 07:22:04 -07:00
Dylan Shepard
49cbb1de99
replace inside the parens
2020-09-09 07:07:13 -07:00
Dylan Shepard
bfa968140c
supporting 2.7, reading works fine, writing reqs unicode
2020-09-09 07:03:45 -07:00
Dylan Shepard
f85a41fa31
renaming functions and setting to internal
2020-08-31 12:01:11 -07:00
Dylan Shepard
aac4e35ca9
correcting tests
2020-08-19 12:49:33 -07:00
Dylan Shepard
f65f06b1ed
commiting changes to branch
2020-08-19 12:36:32 -07:00
Kubernetes Prow Robot
54d188f89e
Merge pull request #205 from greed42/plugin-certificates
...
Accept client certificates from an authn/authz plugin
2020-07-29 19:42:31 -07:00
Kubernetes Prow Robot
ab61ca3c27
Merge pull request #201 from Akasurde/kube_config_no_obj_fix
...
FileOrData: Handle None object
2020-07-29 09:39:47 -07:00
Graham Reed
b85aff2b3e
Accept client certificates from an authn/authz plugin
...
(Plugin interface reference: https://kubernetes.io/docs/reference/access-authn-authz/authentication/#input-and-output-formats )
When handling the response from the authn/authz plugin, `token` will be used if provided, which maintains current behaviour. Newly added is handling `clientCertificateData`: if it is present, that certificate (and its key) will be used as provided by the plugin. (And any certificate/key pair provided via the `users` section of the configuration file will be ignored.)
2020-07-23 10:31:30 +01:00
Haowei Cai
a7c78291bf
add old api_key to set auth attributes
2020-07-16 00:38:24 -07:00
Abhijeet Kasurde
a270ea2946
FileOrData: Handle None object
...
Return when object is None in FileOrData class
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-07-02 23:04:48 +05:30
Kubernetes Prow Robot
3ea80032c3
Merge pull request #198 from ACXLM/fix/load-kube-config
...
fix cfg is none, load kube config error
2020-06-25 10:10:38 -07:00
ACXLM
30d9e2af1c
change test case
2020-06-25 20:53:29 +08:00
Haowei Cai
982de11392
generated by scripts/update-pycodestyle.sh in main repo
2020-06-22 16:08:20 -07:00
vishnu667
91812350e4
updated docstring for load_kube_config_from_dict
2020-06-20 00:50:39 +05:30
ACXLM
3ff79da50c
fix cfg is none, load kube config error
...
Signed-off-by: zhu hui <hui.zhu@daocloud.io>
2020-06-02 13:55:43 +08:00
vishnu667
52a3bdc159
removing load from dict presist from the added test cases.
2020-05-22 00:57:46 +05:30
vishnu667
6c327377e8
test case fix __get_kube_config_loader_dict_no_persist
2020-05-22 00:05:15 +05:30
vishnu667
c6e8194127
Adding config to init file and indentation fixes
2020-05-15 22:14:22 +05:30
vishnu667
e92495f0d1
Adding test Cases
2020-05-15 20:37:36 +05:30
vishnu667
27a1b811d4
Re-using the _get_kube_config_loader in _get_kube_config_loader_for_yaml_file
2020-05-14 16:13:47 +05:30
vishnu667
ab515103d8
Adding ability to pass kube_config as a dict.
2020-05-14 07:44:54 +05:30
Shihang Zhang
0b1ac80470
allow incluster to accept pass-in config
2020-05-13 14:57:27 -07:00
Shihang Zhang
3cfc41ea9e
set expiration on token of incluster config and reload if expires
2020-04-22 09:35:37 -07:00
Kubernetes Prow Robot
d30f1e6fd4
Merge pull request #184 from fooka03/bugfix/179
...
Fix apiserver_id 'get' method
2020-02-21 15:38:47 -08:00