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: add GET listCustomObjectForAllNamespaces #269

Conversation

davidxia
Copy link
Contributor

@davidxia davidxia commented Sep 16, 2024

for the API path /apis/{group}/{version}/{plural}. We define a new key /apis/{group}/{version}/{plural}#[U+200E] in custom_objects_spec.json to work around this limitation.

OpenAPI defines a unique operation as a combination of a path and an HTTP
method. This means that two GET or two POST methods for the same path are not
allowed.

https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the Swagger UI.

addresses #268

Work around was taken from here.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. labels Sep 16, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 16, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @davidxia!

It looks like this is your first PR to kubernetes-client/gen 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/gen has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 16, 2024
@davidxia davidxia force-pushed the list_custom_object_for_all_namespaces branch from 6b1ba62 to c9eb266 Compare September 16, 2024 18:38
for the API path `/apis/{group}/{version}/{plural}`.
We define a new key `/apis/{group}/{version}/{plural}#[U+200E]`
in `custom_objects_spec.json` to work around this limitation.

> OpenAPI defines a unique operation as a combination of a path and an HTTP
> method. This means that two GET or two POST methods for the same path are not
> allowed.

— https://swagger.io/docs/specification/paths-and-operations

We use the hair space empty character to visually hide this path param from the
Swagger UI.

addresses kubernetes-client#268

Work around was taken from [here][1].

[1]: OAI/OpenAPI-Specification#182 (comment)
@davidxia davidxia force-pushed the list_custom_object_for_all_namespaces branch from c9eb266 to 317500f Compare September 16, 2024 18:38
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Sep 16, 2024
@brendandburns
Copy link
Contributor

@davidxia thanks for the PR, this looks good to me, have you tested it with code generation?

@davidxia
Copy link
Contributor Author

have you tested it with code generation?

With this settings file

export KUBERNETES_BRANCH="master"
export CLIENT_VERSION="31.0.0b1"
export PACKAGE_NAME="client"

I ran from root of this repo openapi/python.sh kubernetes settings. I diffed custom_objects_api.py between the one generated here and the latest one from kubernetes-client/python. See gist of diff. The important part is this in the function list_custom_object_for_all_namespaces_with_http_info().

>         return self.api_client.call_api(
>             '/apis/{group}/{version}/{plural}#', 'GET',

Here's the full generated Python client and link to list_custom_object_for_all_namespaces(). Lmk if this looks good or other things I should test.

@brendandburns brendandburns removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 18, 2024
@brendandburns
Copy link
Contributor

Thanks, looks good to me.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 18, 2024
@brendandburns brendandburns marked this pull request as ready for review September 18, 2024 15:26
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, davidxia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 18, 2024
@k8s-ci-robot k8s-ci-robot merged commit 6b9189a into kubernetes-client:master Sep 18, 2024
2 checks passed
@davidxia davidxia deleted the list_custom_object_for_all_namespaces branch September 18, 2024 17:29
@davidxia
Copy link
Contributor Author

@brendandburns Amazing, thank you. Are there any docs on or do you know the release cadence of clients from changes in this repo? For kubernetes-client/python it looks like an ad-hoc cadence?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants