Skip to content

Conversation

@upsaurav12
Copy link
Contributor

@upsaurav12 upsaurav12 commented Aug 10, 2025

This add new pagination API which would help to send only request that the user is veiwing only not just full resource list.

How To Test.

Currently this functionality is not integrated with the frontend of Headlamp but still we can see the pagination works easily if we have tools like POSTMAN or ThunderClient (VS Code Extension).

  1. Make sure that you have resource that have list over 1000's of items or even 100 would be fine.
  2. Then open POSTMAN and add something like this localhost:4466/clusters/{your-cluster-name}/api/v1/{your-desired-resource}?pageNo=<page-you-want-to-go>.
  3. Enter it now you should see only page that you requested (15 items which pageNo).
  4. Also see the response timing you can see how much time is it taking to paginate the items, from my POV it is taking around 30ms for 1000's of secrets,
  5. Also you can see how much KB does client is taking, from my POV for 1000's of secrets normally it is taking 74KB which means it is downloading full items list, but with pagination it is downloading only 1.12KB which means it is downloading only the page which was requested.
  6. You can also test using load-tests and create 1000's of pods and nodes, there you can see that the client is downloading the resource page of that page with size of ~2KB, and with the current setup it is downloading 100KB.

here is my current implementation for pagination, i am currently figuring out how i am going to integrate this with frontend so that we can see the actual change due to pagination.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 10, 2025
@k8s-ci-robot k8s-ci-robot requested review from sniok and yolossn August 10, 2025 07:29
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: upsaurav12
Once this PR has been reviewed and has the lgtm label, please assign joaquimrocha for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 10, 2025
@upsaurav12
Copy link
Contributor Author

upsaurav12 commented Aug 10, 2025

@yolossn @illume I have tested this with POSTMAN client tool where i have to add continueToken for the next batch of resource list which means it is working as expected.

only thing we would need is to set continueToken in frontend .

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2025
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 11, 2025
@upsaurav12 upsaurav12 force-pushed the pagination branch 2 times, most recently from dffbf5a to df35553 Compare August 11, 2025 04:12
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2025
@upsaurav12
Copy link
Contributor Author

@illume @yolossn the only problem in this approach would be that if there are > 1000's of pods/nodes or other heavy resources it would take 800ms for returning that paginating data.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 2, 2025
response size

this helps to get only limited number of resources that the users want
to access not just fetching full resource. and then set continueToken in
the proxy URL.
This adds a new Pagination Middleware that will help to fetch multiple
pages once for example page 1 to page 5.
page that was requested from the client.

This improves the pagination functionality, which help to return only
page that was requested from the client not the full list, this help
the frontend to fetch only page that the user wants to see the page not
the full list.

Currently the page size is limit =15, we can make it dynamic according
to the headlamp.
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2025
@upsaurav12
Copy link
Contributor Author

@illume @yolossn I am trying to implement the pagination part but here the problem is the it is somehow still taking 800ms or even 1s taking from the backend server. I checked in postman it is giving response time like 10ms etc.

Here in this code i am adding query that will go to backend server which results adding p unneccesarily into URL.
for example if i am on secrets page it should add /api/v1/secrets?p=1,2,3,4 etc but it is also adding /api/v1/namespace=5,6,7 even mutating pageNo with many resources here is the screenshot from network tab, it seems backend is working fine but rather frontend is doing more work
Screenshot 2025-10-19 165738

I think i need to manage the pageState in such a way that it should send pageNo to backend when the user is going to next or prev page

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 7, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants