Skip to content

Commit 392a8c1

Browse files
author
Alexis Zamanis
committed
Improve the refreshing of tokens from inside the cluster
Requests from inside the cluster misuse the API to refresh tokens. Signed-off-by: Alexis Zamanis <[email protected]>
1 parent 9df5fa7 commit 392a8c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kubernetes/base/config/incluster_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ def _set_config(self, client_configuration):
9292
if not self._try_refresh_token:
9393
return
9494

95-
def load_token_from_file(*args):
95+
def _refresh_api_key(client_configuration):
9696
if self.token_expires_at <= datetime.datetime.now():
9797
self._read_token_file()
98-
return self.token
98+
self._set_config(client_configuration)
9999

100-
client_configuration.get_api_key_with_prefix = load_token_from_file
100+
client_configuration.refresh_api_key_hook = _refresh_api_key
101101

102102
def _read_token_file(self):
103103
with open(self._token_filename) as f:

0 commit comments

Comments
 (0)