-
Notifications
You must be signed in to change notification settings - Fork 185
set expiration on token of incluster config and reload if expires #191
Conversation
Welcome @zshihang! |
/cc |
/assign @roycaihw |
Codecov Report
@@ Coverage Diff @@
## master #191 +/- ##
=======================================
Coverage 92.23% 92.24%
=======================================
Files 13 13
Lines 1481 1521 +40
=======================================
+ Hits 1366 1403 +37
- Misses 115 118 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
if identifier == 'authorization' and identifier in self.api_key and in_cluster_config.token_expires_at <= datetime.datetime.now(): | ||
in_cluster_config._read_token_file() | ||
self.api_key[identifier] = "bearer " + in_cluster_config.token | ||
return f(self, identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm a little concerned what if someone calls load_and_set
more than once in the same program. Will we end up with nested if conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. i assumed load_and_set
will only be called once. maybe enforce this restriction in a separate PR
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: roycaihw, zshihang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
fixes kubernetes-client/python/issues/616. by default, this will set an expiration period of 1 minutes on service account token. as we are graduating the Beta feature Projected Service Account Volume to GA, we expect clients to reload token before it expires.