-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add client.wait method #15
Conversation
I think adding this functionality is a nice idea, as it's not straight forward to implement. Few things I was thinking about regarding the interface:
Any opinion/idea? |
d01f982
to
46ff45a
Compare
Thanks for the review, and sorry for the slow response. I've updated this branch with all requested changes other than the timeouts and |
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.
Code coverage for the two new functions is missing. Tests should go in tests/test_client.py
and tests/test_async_client.py
. Be sure we are covering every condition.
01ad53c
to
d23677b
Compare
cf3df80
to
b235719
Compare
Adds client.wait as a rough analogue of kubectl wait. Builds on top of client.watch to wait for specified resource to enter expected state.
b235719
to
4d4030d
Compare
Merged. @knkski, thanks a lot for the contribution :) |
Adds
client.wait
as a rough analogue ofkubectl wait
. Builds on top ofclient.watch
to wait for specified resource to enter expected state.Opening as draft PR to ensure that this is something that is generally desired in lightkube. If so, will also implement logic for
AsyncClient
and convert to regular PR.Punts on implementing an equivalent of
kubectl wait
's--timeout
flag, as that would require some deeper changes in how exactly the watch requests are handled. Some extra logic aroundstream=True
and setting the read timeout should work if that's desired, but this PR also includes an example of how to achieve the same thing withgevent.Timeout
.