-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update waitUntilCondition to use a watcher instead of polling. #2239
Conversation
…itUntil* methods should end up calling waitUntilCondition. Retry all exceptions except HTTP_GONE, with backoff
Can one of the admins verify this patch? |
ok to test |
a72d158
to
e1cee61
Compare
e1cee61
to
fd6d26d
Compare
This is ready for review. SonarCloud failed again due to coverage, but I think there is reasonably good coverage for the code I changed. I added a bunch of unit tests for WaitForConditionWatcher, and a bunch of mock tests in kubernetes-test for the new functionality of waitUntilCondition. |
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.
It's been a long time since I looked at this code, but the change seems reasonable to me
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/Waitable.java
Outdated
Show resolved
Hide resolved
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.
Besides the nitpicking comment, looks great to me. Thx for contributing!
Co-authored-by: Marc Nuri <[email protected]>
@bbeaudreault : There seems to some compilation error. Could you please address them whenever you get time? |
SonarCloud Quality Gate failed. 0 Bugs |
Ok everything is working again. Something had merged into master which turned one of my function calls ambiguous. |
[merge] |
@manusa looks like the merge build failed:
|
[merge] |
It happens sometimes, we need to fix it. Retry has been started ;) |
Great, thanks! |
There were a couple different implementations of
waitUntil*
, and this PR unifies all of them on an approach that somewhat mirrors the native go watcher code. I couldn't fully mirror that approach because of the typing we do in the WatchConnectionManager and elsewhere. I think this is a good incremental step towards that, and we can do any necessary refactoring in those manager classes in another PR down the line if necessary.When you call waitUntilCondition or waitUntilReady, the code will first just try to fetch the item once from the server. If the item matches the condition it returns early. Otherwise it proceeds to create a watcher. Any errors in the watcher will cause a retry, except HTTP_GONE which will propagate. We will retry with backoff until the timeout is met.
I wanted to make the backoff configurable, so I added the plumbing necessary to support a
withWaitRetryBackoff
method. It defaults to 5ms initial backoff with 2x exponential backoff growth.Fixes #2204