Skip to content
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

feat(kuma-cp) pagination in the API #673

Merged
merged 6 commits into from
Apr 17, 2020
Merged

Conversation

jakubdyszkiewicz
Copy link
Contributor

Summary

Adds pagination functionality.
You can now query API with size query param to have a list with given numbers of items.
The default page size is 100. Page size limit is 1000, so we won't load all entities in the memory (at least here, we do it in other places, but that's out of scope of this PR).
Returned response contains next field next to items with link to fetch next page of the items.
Offset in Postgres and Memory is just a number, but on K8S is a continue token

Dataplane overview is tricky endpoint, because we retrieve dataplanes and dataplane insights and then we merge it. Additionaly we have filters that we do in memory (because at the time of creating those, there was no option to do the filtering on K8S API). This makes pagination hard to do, so for now we provide pagination to it only if there are no filters.

Support for kumactl pagination comes in another PR, because I don't want to makes huge conflicts with this PR https://github.com/Kong/kuma/pull/667

@jakubdyszkiewicz jakubdyszkiewicz requested review from lobkovilya and a team April 10, 2020 09:33
@@ -29,6 +32,24 @@ func (a *ApiServer) Address() string {
return a.server.Addr
}

func init() {
// turn off escape & character so the link in "next" fields for resources is user friendly
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it turn off escaping for all api-server responses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you cannot differentiate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marco decided that we should not escape it for better UX

Copy link
Contributor

@lobkovilya lobkovilya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to consider using some url-sanitizer in the future

@jakubdyszkiewicz jakubdyszkiewicz merged commit 6a86d27 into master Apr 17, 2020
@jakubdyszkiewicz jakubdyszkiewicz deleted the feat/pagination branch October 15, 2020 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants