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

[DO NOT MERGE] Switch to openapi-generator #926

Closed

Conversation

roycaihw
Copy link
Member

ref kubernetes-client/gen#93, kubernetes-client/gen#97

This is for reviewing and testing the diff of generated code in master branch. The change is basically:

  1. pick feat: switch python client to use openapi-generator gen#97
  2. run scripts/update-client.sh

but split into logical commits for easier review.

I plan to:

  • do a 11.0.0a1 release with openapi-generator in release branch (and keep using swagger-codegen in master branch for now)
  • switch master branch to use openapi-generator and do a 11.0.0b1 release

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 13, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: roycaihw

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 13, 2019
@roycaihw roycaihw added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 13, 2019
@roycaihw
Copy link
Member Author

Test is green. This is ready for review: 7387639

/cc @micw523 @scottilee @tomplus @yliaog

user-facing changes:

non-user-facing changes:

  • kubernete/.swagger-codegen is deleted, openapi-generator uses kubernetes/.openapi-generator and also .openapi-generator-ignore instead of .swagger-codegen-ignore (renamed)
  • various code cleanup

@k8s-ci-robot
Copy link
Contributor

@roycaihw: GitHub didn't allow me to request PR reviews from the following users: scottilee.

Note that only kubernetes-client members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Test is green. This is ready for review: 7387639

/cc @micw523 @scottilee @tomplus @yliaog

user-facing changes:

non-user-facing changes:

  • kubernete/.swagger-codegen is deleted, openapi-generator uses kubernetes/.openapi-generator and also .openapi-generator-ignore instead of .swagger-codegen-ignore (renamed)
  • various code cleanup

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.

@micw523
Copy link
Contributor

micw523 commented Aug 14, 2019

I remember openapi-generator uses flake8 as the main Python linter and that's why you see the #noqa flags scattered everywhere in the code. We may want to make the switch too in the future since these flags are not recognized by pycodestyle.

The code style test is green right now - I don't think we need to act right now but I may just send in a PR switching us to flake8 when this is merged.

kubernetes/README.md Show resolved Hide resolved
@@ -68,7 +70,7 @@ except ApiException as e:

## Documentation for API Endpoints

All URIs are relative to *https://localhost*
All URIs are relative to *http://localhost*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https -> http?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from the code generator. The documentation change looks reasonable to me, since by default the generated client doesn't have TLS set up

kubernetes/README.md Show resolved Hide resolved
scripts/update-client.sh Show resolved Hide resolved
**selector** | [**V1LabelSelector**](V1LabelSelector.md) | Label query over pods whose evictions are managed by the disruption budget. | [optional]
**max_unavailable** | [**object**](.md) | An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\". | [optional]
**min_available** | [**object**](.md) | An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\". | [optional]
**selector** | [**V1LabelSelector**](V1LabelSelector.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the description of a few parameters have disappeared. The loss of descriptions is very consistent across docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The openapi spec didn't change. @tomplus Do you know what may cause the doc change in the generators?

@@ -2,7 +2,7 @@

from kubernetes import config
from kubernetes.client import Configuration
from kubernetes.client.apis import core_v1_api
from kubernetes.client.api import core_v1_api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? I get an error: ModuleNotFoundError: No module named 'kubernetes.client.api'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you print the package info in your code, to see if it's using the updated code from this pull? I suspect you have official kubernetes package installed in your env and the code is using that by default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also try modifying your PYTHONPATH variable if you’re under Linux and prioritize searching for the k8s package locally.

@roycaihw roycaihw mentioned this pull request Aug 15, 2019
@roycaihw
Copy link
Member Author

included in #931

/close

@k8s-ci-robot
Copy link
Contributor

@roycaihw: Closed this PR.

In response to this:

included in #931

/close

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
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants