-
Notifications
You must be signed in to change notification settings - Fork 337
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
Conversation
@@ -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 |
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.
Does it turn off escaping for all api-server responses?
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.
Yes, you cannot differentiate it.
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.
Marco decided that we should not escape it for better UX
1c8726b
to
d2921ec
Compare
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 guess we need to consider using some url-sanitizer in the future
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 toitems
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