Skip to content

Commit

Permalink
Merge pull request kubernetes-client#1949 from arrikto/feature-in-clu…
Browse files Browse the repository at this point in the history
…ster-token-refresh

Improve the refreshing of tokens from inside the cluster
  • Loading branch information
k8s-ci-robot authored Jan 17, 2023
2 parents 8f80cf4 + 392a8c1 commit 2a27133
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kubernetes/base/config/incluster_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def _set_config(self, client_configuration):
if not self._try_refresh_token:
return

def load_token_from_file(*args):
def _refresh_api_key(client_configuration):
if self.token_expires_at <= datetime.datetime.now():
self._read_token_file()
return self.token
self._set_config(client_configuration)

client_configuration.get_api_key_with_prefix = load_token_from_file
client_configuration.refresh_api_key_hook = _refresh_api_key

def _read_token_file(self):
with open(self._token_filename) as f:
Expand Down

0 comments on commit 2a27133

Please sign in to comment.