support gcp authentication refresh token#1810
support gcp authentication refresh token#1810k8s-ci-robot merged 6 commits intokubernetes-client:masterfrom
Conversation
|
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
Welcome @jhbae200! |
|
@jhbae200 thank you for kicking this off! can you resign your commit by properly setting up your git workspace? git config user.name ..
git config user.email ... |
Signed-off-by: jhbae200 <[email protected]>
Signed-off-by: jhbae200 <[email protected]>
|
/check-cla |
|
/assign @yue9944882 |
yue9944882
left a comment
There was a problem hiding this comment.
@jhbae200 can you run mvn spotless:apply before submitting the changes? thanks!
| import java.time.Instant; | ||
| import java.util.Date; | ||
| import java.util.Map; | ||
| import java.util.*; |
There was a problem hiding this comment.
wildcard import will fail the lint checker
| Process process = new ProcessBuilder().command(commandList).start(); | ||
| process.waitFor(10, TimeUnit.SECONDS); | ||
| if(process.exitValue() != 0) { | ||
| throw new IOException("Process exit code: "+process.exitValue()); |
There was a problem hiding this comment.
I'm not sure that IOException is right here. IllegalStateException(...)?
There was a problem hiding this comment.
Also, please make the message more descriptive and include the stderr to make the exception more debuggable.
String stderr = IOUtils.toString(process.getErrorStream(), StandardCharsets.UTF_8)
throw new IllegalStateException("Failed to get token (" + process.exitValue() + ") " + stderr
|
Some small comments. Generally looks good. Needs linter formatting to conform to the style guide. |
Signed-off-by: jhbae200 <[email protected]>
|
Updated the code. am i right? |
|
Code looks great. Can you add a unit test for this new functionality (sorry, I should have mentioned that before). Once it is tested (and passing) we can merge. |
Signed-off-by: jhbae200 <[email protected]>
|
I think need to mock the ProcessBuilder to test the refresh method. |
Signed-off-by: jhbae200 <[email protected]>
|
Thanks for adding the test! I think it is simpler if you just make the ProcessBuilder an optional constructor parameter, e.g. public GCPAuthenticator() {
this(new ProcessBuilder());
}
public GCPAuthenticator(ProcessBuilder pb) {
this.pb = pb;
}
.... |
Signed-off-by: jhbae200 <[email protected]>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, jhbae200 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Great to have it implemented! Are there any plans to release it in the near future? |
|
It took me a while to discover that this existed and was released. Any chance this can be added to the documentation for those coming after me? Thanks |
Related Issues:
I wrote a "refresh" function because it seems to be using "cmd-path", "cmd-args", "expiry-key", "token-key" to refresh the token.
Need to check that it works on various os platforms.