Skip to content

Commit 2a27133

Browse files
authored
Merge pull request #1949 from arrikto/feature-in-cluster-token-refresh
Improve the refreshing of tokens from inside the cluster
2 parents 8f80cf4 + 392a8c1 commit 2a27133

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)