fix: refresh EKS authentication token per request#4741
fix: refresh EKS authentication token per request#4741hwayoungjun wants to merge 1 commit intokubernetes-client:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hwayoungjun The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
Welcome @hwayoungjun! |
Fixes #4731
Description
EKSAuthenticationcurrently generates an EKS bearer token whenprovide()is called and stores it on theApiClientas a static API key.However, EKS authentication tokens are short-lived. Once the generated token expires, subsequent requests continue to use the same expired token and fail with an authentication error.
This change updates
EKSAuthenticationto install an OkHttp interceptor instead. The interceptor adds the bearer token to each request, reuses the token before expiry, and generates a new token after expiry.Changes
EKSAuthenticationTesting
./mvnw -pl util -am -Dtest=EKSAuthenticationTest -Dsurefire.failIfNoSpecifiedTests=false test./mvnw -pl util spotless:checkgit diff --checkI also ran a manual smoke test against an EKS cluster with a 60 second token expiry: