-
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
fix buggy pager func #4306
fix buggy pager func #4306
Conversation
fdad931
to
a225d1b
Compare
fixes #4244 |
692a043
to
1131aca
Compare
err = meta.EachListItem(list, func(object runtime.Object) error { | ||
u, ok := object.(*unstructured.Unstructured) | ||
if !ok { | ||
log.WithError(errors.WithStack(fmt.Errorf("expected *unstructured.Unstructured but got %T", u))).Error("unable to understand entry in the list") |
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.
Should we return from here directly if the object
isn't Unstructured
rather than putting it into the item list?
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.
+1 yes. Missed returning the error here, good catch
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.
@alaypatel07 Could you make an update for this? This is the only comment from my side
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.
updated, PTAL
fix paging items in to use list options passed by the paging function The client-go pager sets the Limit options for the list call to paginate the request[1]. This PR fixes the paging function to use the options passed by the pager instead of shadowed options This is required for the pagination to work correctly. - simplify the pager list implementation by using pager.List() The List() function already implements a lot of the logic that was needed for paging here, using it simplifies the code. 1. https://github.com/kubernetes/kubernetes/blob/3f40906dd8a54fb91650553a6457496181f591bc/staging/src/k8s.io/client-go/tools/pager/pager.go#L219 Signed-off-by: Alay Patel <alay1431@gmail.com>
Signed-off-by: Alay Patel <alay1431@gmail.com>
1131aca
to
569fc1d
Compare
@alaypatel07 Could you open another PR to cherry-pick the fix into branch release-1.7? |
fix paging items in to use list options passed by the paging function
The client-go pager sets the Limit options for the list call
to paginate the request[1]. This PR fixes the paging function
to use the options passed by the pager instead of shadowed options
This is required for the pagination to work correctly.
The List() function already implements a lot of the logic that was
needed for paging here, using it simplifies the code.
Signed-off-by: Alay Patel alay1431@gmail.com
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #(issue)
Please indicate you've done the following:
/kind changelog-not-required
.site/content/docs/main
.