-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-27997][K8S] Add support for kubernetes OAuth Token refresh #33675
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b0f6c3
[SPARK-27997][K8S] Add support for OAuth Token refresh
haodemon a20229b
Changed doc and version=3.3.0 for KUBERNETES_CLIENT_OAUTH_TOKEN_PROVIDER
haodemon 5bca16f
Merge branch 'apache:master' into SPARK-27997
haodemon 5830123
Changed doc for token provider option
haodemon 56fc132
Merge branch 'apache:master' into SPARK-27997
haodemon 61fed91
Refactoring OAuthToken options: now mutually exclusive, added docs
haodemon 58ce2f4
Merge branch 'SPARK-27997' of github.com:haodemon/spark into SPARK-27997
haodemon b69ddc2
Merge branch 'apache:master' into SPARK-27997
haodemon f28744b
Merge branch 'master' into SPARK-27997
haodemon 8d44ca8
Merge branch 'SPARK-27997' of github.com:haodemon/spark into SPARK-27997
haodemon 2035f5d
Merge branch 'master' into SPARK-27997
haodemon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
To be clear, if we have two configurations at the same time mistakingly, we invoke
OAuthTokenProviderand override it withoauthTokenValue?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.
Could you check what happens when we call
configBuilder.withOauthTokenProvider(provider)andconfigBuilder.withOauthToken(token)together?Uh oh!
There was an error while loading. Please reload this page.
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.
The token that was specified in
configBuilder.withOauthToken(token)will stay unused, and the class that implementsOAuthTokenProviderwill be used instead. I confirmed this via tests on my cluster by simultaneously:1 . Adding a debugging log into my class and providing it via
My log:
From the log it could be concluded that
OAuthTokenProviderhas a higher precedence over the token that was specified inconfigBuilder.withOauthToken(token). It could also be confirmed by looking at the fabric's code inhttps://github.com/fabric8io/kubernetes-client/blob/74cc63df9b6333d083ee24a6ff3455eaad0a6da8/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/RequestConfig.java#L136
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.
Thank you for checking. In that case, the current situation may cause a confusion to the Spark users. From Spark perspective, we have two options.
spark.kubernetes.client.oauth.token.provider.classwhenoauthTokenexists from Spark side.Which one do you prefer?
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.
Indeed. Thanks for making me realize this. The patch is missing a way for a Spark user to specify how they would like the Spark to authenticate in Kubernetes when running on a client or cluster mode. There is several options present for oauthToken:
And I think we need to have the same for token provider, like
spark.kubernetes.authenticate.*.oauthTokenProvider.This change would:
oauthToken,oauthTokenFile,oauthTokenProviderwould be allowed.If we try this, we won't have to add anything about precedence into the docs and there would be no need to ignore anything in the code.
@dongjoon-hyun, sorry for a lot of text.
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.
I think either precedence or doing an assertion that only one of these is set is fine, but let's just pick one and do it so we can get this in.
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.
I prepared the changes, so now we have:
•
OAuthTokenProvideroptions are now consistent with the other two options –OAuthTokenandOAuthTokenFile.• Added an assertion that only one of the options is set (either
OAuthToken,OAuthTokenFileorOAuthTokenProvider• Added docs
I have tested this in client mode on Kubernetes.