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

Provider no longer handles pagination in Metal API endpoints #630

Closed
ctreatma opened this issue Aug 28, 2023 · 5 comments
Closed

Provider no longer handles pagination in Metal API endpoints #630

ctreatma opened this issue Aug 28, 2023 · 5 comments

Comments

@ctreatma
Copy link
Contributor

What steps did you take and what happened:

N/A; I haven't observed an impact of this bug (depending on how the provider is used--for example, if every cluster has its own project and/or the total number of devices is less than the default page size for the devices API--it doesn't necessarily have an impact.

What did you expect to happen:

For Metal API endpoints that include pagination details (a meta object with current page, total number of pages, etc.), the provider should automatically navigate pagination. Alternatively: auto-page-navigation support could be added as a feature in metal-go and this provider updated to use that new features.

Anything else you would like to add:

The pager module in metal-cli is a good reference for implementing auto-page-navigation in a metal-go-based tool: https://github.com/equinix/metal-cli/blob/main/internal/pagination/pager.go

Environment:

  • cluster-api-provider-packet version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):
@displague
Copy link
Member

Anywhere that we are listing is somewhere that we could miss the desired resource by not paginating. Some examples:

(These are the only Find* methods that I found in cluster-api-provider-packet/pkg/cloud/packet
/client.go that look to require pagination)

@displague
Copy link
Member

displague commented Dec 20, 2023

@cprivitere points out that the EM API spec for these functions do not explicitly say that the results are paginated, they say that they return "all" of the resources.

@ctreatma
Copy link
Contributor Author

Does this issue still need to be addressed?

Both metal-go and its replacement equinix-sdk-go include built-in methods for automatic page navigation. For example: https://github.com/equinix/equinix-sdk-go/blob/cbfa94f/services/metalv1/api_projects.go#L1698

Those automatic pagination methods should provide equivalent behavior to what the previous packngo-based provider was doing.

@cprivitere
Copy link
Member

As @ctreatma points out, this is no longer necessary.

@ctreatma
Copy link
Contributor Author

ctreatma commented Feb 9, 2024

The SDK provides pagination functions now, but I don't think we're using them yet in this project. I only see Execute() calls, nothing using ExecuteWithPagination().

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

No branches or pull requests

3 participants