-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Watch handles resourceVersion wrong #1018
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
Comments
/assign |
I think we do extract the latest resource version from the apiserver response and use that: https://github.com/kubernetes-client/python-base/blob/a2d1024524de78b62e5f9aa72d34cb9ea9de2b97/watch/watch.py#L96 /close |
@roycaihw: Closing this issue. In response to this:
Instructions 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. |
But that is the resource version for each of the elements in the list, not of the list itself. The resource_version exists in the response of func (at least if resp = func(*args, **kwargs)
resp.get("metadata", {}).get("resourceVersion", None) But maybe the semantics is different because |
The semantics is different. The apiserver responds to watch requests with a stream of watch events. See https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes:
The python client extracts the resource version from each of the watch event. If you print the
|
Warning: I might have misunderstood something. Feel free to correct.
As described several places (e.g. kubernetes-client/python-base#131 (comment)
#819) one can not just use a ẁatch on a "list-functon", but one has to first do a list, get the resourceVersion from the list-call itself, and then use that in the watch.
The problem is that watch itself reapplies the provided function in an infinite loop, and if
func
is e.g.list_namespace
(as in the example in the readme), then the correct course of action is to get the resourceVersion of that call and use it. But instead only the resourceVersions of the elements in the list is used.The text was updated successfully, but these errors were encountered: