-
Notifications
You must be signed in to change notification settings - Fork 61
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
Make 'LoginUtils.requireLogin()' to not block the execution. #3674
Make 'LoginUtils.requireLogin()' to not block the execution. #3674
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3674 +/- ##
==========================================
- Coverage 33.20% 33.12% -0.08%
==========================================
Files 84 84
Lines 6159 6195 +36
Branches 1258 1268 +10
==========================================
+ Hits 2045 2052 +7
- Misses 4114 4143 +29 ☔ View full report in Codecov by Sentry. |
I think the reason this patch work is that it uses I don't think this timeout does anything, since it's mispelt: https://github.com/redhat-developer/vscode-openshift-tools/pull/3674/files#diff-fb06bee2638b8012f20db654d2191ea1dd8448a73ebe4da36750b489a188ecbbR469 . |
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 did some testing on Windows and non-OpenShift clusters, and it seems to be working there as well (with the caveat that you can't log in/out of non-OpenShift clusters).
May be, but
There is 10 seconds default value for the timeout used... So, misspelling actually doesn't break the things (But yes, it is misspelled) |
@datho7561 I thought we can make |
Good call. I like that refactoring better. Maybe this will end up fixing the issue Mohit has been running into (and me occasionally) where the view takes a while to load if the kubecontext is set to an inaccessible cluster. |
I don't think so... I haven't dig into this yet, maybe it'll speed up the things a little bit, but not too much. |
If a cluster "is inaccessible" we're actually aren't able to speed up anything. We still need to log in and this will take as much time as it takes (if possible at all). The only thing we can do is limiting the time to connect/login with a timeout (and make such timeout to be configurable through a user preference - because the normal time needed to login to different clusters may vary a lot, so it's difficult to imagine/calculate what default value could it be). |
18b7e45
to
2e29e36
Compare
b56c1c2
to
6860c60
Compare
6860c60
to
0c7e4c4
Compare
Do we have any special binary/API to be invoked for non-OpenShift clusters? I might be missing something but I thought we always use |
Most non-OpenShift clusters don't have a username/password system. Instead, you configure an access token in your kubeconfig, and any Kubernetes clients (eg. |
So, the solution for
Also, I don't know if we really need this, but as we cannot login to a non-openshift cluster (because we cannot provide user credentials nor a token (like for a Kind-cluster), we probably can skip User Credentials/Token selection (and the following try to login using them).. So for
|
4687a48
to
4e6f0ca
Compare
The demo of login/logout to Kind and OS Clusters, and switching to the these clusters in case we're already logged in: |
This should be changed now - you can login to /logout from non-OpenShift clusters
Checking whether the user is logged in should not block 'oc' binary execution in case login is required Also `Oc.logout()' is made to throw an exception in case it's invoked when user wan't logged in. Signed-off-by: Victor Rubezhny <[email protected]>
Signed-off-by: Victor Rubezhny <[email protected]>
This allows to login to Kind-like clusters and login faster to OS clusters that the user is already is logged in to Signed-off-by: Victor Rubezhny <[email protected]>
...as it's not just a one command call anymore and if not moved out of `ocWrappers` causes a cycle dependencies appearance Signed-off-by: Victor Rubezhny <[email protected]>
Signed-off-by: Victor Rubezhny <[email protected]>
b799123
to
4bfd412
Compare
@datho7561 Could you, please, take a look again. Now 'Login' works (during my tests) for any type of cluster including Kind and Sandbox, the only problem is a ~3 seconds delay that may occur while checking whether we're logged in in case we're logged in to an OS cluster (potentially any remote/slow/etc. cluster) where |
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.
Sorry about the delay in the review. This is working very well! I found two small things in the code.
Signed-off-by: Victor Rubezhny <[email protected]>
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 good and works great. Thanks Victor!
Checking whether the user is logged in should not block 'oc' binary execution in case login is required