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

Chunks functionality for custom objects #965

Closed
filippomc opened this issue Sep 24, 2019 · 2 comments · Fixed by kubernetes-client/gen#130
Closed

Chunks functionality for custom objects #965

filippomc opened this issue Sep 24, 2019 · 2 comments · Fixed by kubernetes-client/gen#130
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@filippomc
Copy link

What is the feature and why do you need it:
I'm using the client to retrieve custom objects generated by Argo workflows.

The functionality to get results in chunks is missing from the Python api, while is working correctly making the rest calls.

It's important to have the chunks pagination since the system based on argo is generating a fairly big amount of workflows.

Describe the solution you'd like to see:
Add the parameters limit and continue_token to the listing methods like the following:

from __future__ import print_function
import time
import kubernetes.client
from kubernetes.client.rest import ApiException
from pprint import pprint

# Configure API key authorization: BearerToken
configuration = kubernetes.client.Configuration()
configuration.api_key['authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['authorization'] = 'Bearer'

# create an instance of the API class
api_instance = kubernetes.client.CustomObjectsApi(kubernetes.client.ApiClient(configuration))
group = 'group_example' # str | The custom resource's group name
version = 'version_example' # str | The custom resource's version
plural = 'plural_example' # str | The custom resource's plural name. For TPRs this would be lowercase plural kind.

limit = 10
try:
    api_response_page_1 = api_instance.list_cluster_custom_object(group, version, plural, limit=limit)
    continue_token = api_response_page_1['metadata']['continue']
    api_response_page_2 = api_instance.list_cluster_custom_object(group, version, plural, limit=limit, continue_token=continue_token)
except ApiException as e:
    print("Exception when calling CustomObjectsApi->list_cluster_custom_object: %s\n" % e)

Thanks in advance

@filippomc filippomc added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 24, 2019
@roycaihw
Copy link
Member

The openapi spec that we use to generate the APIs for custom objects needs to be fixed.

It should have the same continue and limit parameters for LIST and DELETECOLLECTION paths as the openapi spec for native types

once the openapi spec is fixed, we can regenerate the client so the custom object APIs also have _continue and limit parameters as the native types (e.g. here)

/assign @scottilee

@k8s-ci-robot
Copy link
Contributor

@roycaihw: GitHub didn't allow me to assign the following users: scottilee.

Note that only kubernetes-client members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

The openapi spec that we use to generate the APIs for custom objects needs to be fixed.

It should have the same continue and limit parameters for LIST and DELETECOLLECTION paths as the openapi spec for native types

once the openapi spec is fixed, we can regenerate the client so the custom object APIs also have _continue and limit parameters as the native types (e.g. here)

/assign @scottilee

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants