Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve the refreshing of tokens from inside the cluster #1949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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