-
Notifications
You must be signed in to change notification settings - Fork 696
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
Move external command execution from token source provider to token source #6255
base: master
Are you sure you want to change the base?
Conversation
…ource Signed-off-by: Andrei Trandafir <[email protected]>
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
Code Review Agent Run #cbee27Actionable Suggestions - 0Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6255 +/- ##
=======================================
Coverage 36.86% 36.87%
=======================================
Files 1318 1318
Lines 134767 134771 +4
=======================================
+ Hits 49682 49692 +10
+ Misses 80755 80749 -6
Partials 4330 4330
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Code Review Agent Run Status
|
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.
Looks reasonable, I have one small comment. Also, can you add a test to auth_interceptor_test.go?
type externalCommandTokenSource struct { | ||
command []string | ||
} |
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.
Do we really need to define externalCommandTokenSource
? We could implement Token
in ExternalTokenSourceProvider
, right?
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.
We could implement Token()
in ExternalTokenSourceProvider
, but I feel it would potentially feel a bit confusing to follow.
I don't personally mind either way.
Tracking issue
#6254
Why are the changes needed?
External command doesn't get called again if authentication starts failing due to the returned token.
What changes were proposed in this pull request?
Create a new externalCommandTokenSource that runs the external command instead of the token source provider.
This results in:
MaterialiseCredentials
function instead of thegetTokenSourceAndMetadata
function that is synchronized (in theflyteidl/go/client/admin/auth_interceptor.go
).Unauthenticated
response from the flyte admin, the external command is called again.How was this patch tested?
ExternalCommand
auth that returns an expiring tokenCheck all the applicable boxes
Related PRs
The issue resulted from the following PR: #5686
Summary by Bito
Refactored external command token source implementation with improved token caching and refresh mechanism. Added mutex-protected token caching to prevent unnecessary command executions. Enhanced authentication system by implementing proper token expiration checks. Modified token generation logic to ensure efficient external command execution.Unit tests added: False
Estimated effort to review (1-5, lower is better): 1