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(kumactl) pagination #690

Merged
merged 4 commits into from
Apr 22, 2020
Merged

feat(kumactl) pagination #690

merged 4 commits into from
Apr 22, 2020

Conversation

jakubdyszkiewicz
Copy link
Contributor

Summary

Introducing pagination in kumactl.

Examples

Universal

❯❯❯ kumactl get dataplanes --size=1
MESH      NAME     TAGS
default   web-01   service=web

Rerun command with --offset=1 argument to retrieve more resources

❯❯❯ kumactl get dataplanes --size=1 --offset=1
MESH      NAME         TAGS
default   backend-01   env=production protocol=http service=backend version=2.0

Kubernetes

❯❯❯ kumactl get dataplanes --size=3
MESH      NAME                                              TAGS
default   kuma-demo-app-68758d8d5d-ptfgl.kuma-demo          app=kuma-demo-frontend env=prod pod-template-hash=68758d8d5d protocol=http service=frontend.kuma-demo.svc:8080 version=v8
default   kuma-demo-backend-v0-6fdb79ddfd-ms566.kuma-demo   app=kuma-demo-backend env=prod pod-template-hash=6fdb79ddfd protocol=http service=backend.kuma-demo.svc:3001 version=v0
default   postgres-master-78d9c9c8c9-fvdr2.kuma-demo        app=postgres pod-template-hash=78d9c9c8c9 protocol=tcp service=postgres.kuma-demo.svc:5432

Rerun command with --offset=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MTAwMzMsInN0YXJ0Ijoia3VtYS1kZW1vL3Bvc3RncmVzLW1hc3Rlci03OGQ5YzljOGM5LWZ2ZHIyXHUwMDAwIn0 argument to retrieve more resources

❯❯❯ kumactl get dataplanes --size=3 --offset=eyJ2IjoibWV0YS5rOHMuaW8vdjEiLCJydiI6MTAwMzMsInN0YXJ0Ijoia3VtYS1kZW1vL3Bvc3RncmVzLW1hc3Rlci03OGQ5YzljOGM5LWZ2ZHIyXHUwMDAwIn0
MESH      NAME                                      TAGS
default   redis-master-657c58c859-xzldf.kuma-demo   app=redis pod-template-hash=657c58c859 protocol=tcp role=master service=redis.kuma-demo.svc:6379 tier=backend

Sidenotes:
By default, the size is 1000 (defined in API Server)

I turned off Kubernetes cache in client

  1. It didn't support chunking (pagination)
  2. We maintain our cache for resources so we won't store "same" objects twice.

@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team April 21, 2020 13:12
app/kumactl/cmd/get/get.go Outdated Show resolved Hide resolved
app/kumactl/cmd/get/get_dataplanes.go Outdated Show resolved Hide resolved
pkg/plugins/bootstrap/k8s/plugin.go Outdated Show resolved Hide resolved
@jakubdyszkiewicz jakubdyszkiewicz merged commit 587d233 into master Apr 22, 2020
@jakubdyszkiewicz jakubdyszkiewicz deleted the feat/kumactl-pagination branch April 22, 2020 09:22
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

2 participants