-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🌱 inmemory: fix watch to continue serving based on resourceVersion parameter #11695
🌱 inmemory: fix watch to continue serving based on resourceVersion parameter #11695
Conversation
54e7e43
to
1b644a2
Compare
Kudos to @sbueringer for helping analysing and brainstorming to find the root cause. |
/test help |
@chrischdi: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
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-sigs/prow repository. |
/test pull-cluster-api-e2e-main |
1b644a2
to
3bac618
Compare
/test pull-cluster-api-e2e-main |
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.
Great job in investigating and fixing this issue, kudos!
@@ -145,6 +145,9 @@ func (c *cache) List(resourceGroup string, list client.ObjectList, opts ...clien | |||
if err := meta.SetList(list, items); err != nil { | |||
return apierrors.NewInternalError(err) | |||
} | |||
|
|||
list.SetResourceVersion(fmt.Sprintf("%d", tracker.lastResourceVersion)) |
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.
Q: is it correct that list ResourceVersion in the system and not the last resource version in the list of items?
Q: is is correct set set this value non matter of it is a "plain" list or a lis watch?
(from a quick check with kubectl yes to both, but I like a confirmation)
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.
Q: is it correct that list ResourceVersion in the system and not the last resource version in the list of items?
In case of kube-apiserver it sets the resourceVersion of the system, which makes sense because new events will only have a higher resourceVersion.
Any new event (create/update/delete) will have a higher resourceVersion, no matter which type of object is going to change.
For the in-memory provider it does not make a difference. For kube-apiserver its a performance thing: its simply unnecessary to go through all events between highest resourceversion of objects in list
and last used resourceversion of the system
.
Also: It would not make sense to set the list's resourceVersion to the highest resourceVersion of all items, because it would be a duplication of information.
Q: is is correct set set this value non matter of it is a "plain" list or a lis watch?
(from a quick check with kubectl yes to both, but I like a confirmation)
kubectl get
just hides/removes the resourceVersion of a list:
❯ k get no -v=8 -o yaml
...
I0120 09:19:14.542768 77874 request.go:1212] Response Body: {"kind":"NodeList","apiVersion":"v1","metadata":{"resourceVersion":"195803"},"items":[{" ...
...
kind: List
metadata:
resourceVersion: ""
...
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 think the second question was about "list watch". @fabriziopandini Are you referring to the new ListWatch beta feature in Kubernetes 1.32?
I don't think we have implemented ListWatch yet, though
(also it's disabled per default in client-go atm so we're not forced to implement it yet)
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 was not thinking about ListWatch :D
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.
But overall looks fine:
- List: we have to set it
- Watch: the "list" is not send to the client
- ListWatch: not implemented
/test pull-cluster-api-e2e-main |
/lgtm |
LGTM label has been added. Git tree hash: 914bd9fbece01b130980a84832feef4bcf5e2f79
|
@@ -145,6 +145,9 @@ func (c *cache) List(resourceGroup string, list client.ObjectList, opts ...clien | |||
if err := meta.SetList(list, items); err != nil { | |||
return apierrors.NewInternalError(err) | |||
} | |||
|
|||
list.SetResourceVersion(fmt.Sprintf("%d", tracker.lastResourceVersion)) |
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 think the second question was about "list watch". @fabriziopandini Are you referring to the new ListWatch beta feature in Kubernetes 1.32?
I don't think we have implemented ListWatch yet, though
(also it's disabled per default in client-go atm so we're not forced to implement it yet)
/cherry-pick release-1.9 |
@sbueringer: once the present PR merges, I will cherry-pick it on top of 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-sigs/prow repository. |
Thank you! /lgtm |
LGTM label has been added. Git tree hash: 85a402458616ed3456dad109453fa94ffbc67c47
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@sbueringer: new pull request created: #11710 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-sigs/prow repository. |
What this PR does / why we need it:
This PR has the following changes:
resourceVersion
parameter on watches (if given) to enqueue events for all objects which have a higher resourceVersionWhich issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
/area provider/infrastructure-in-memory