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

update openapi scripts to fetch protobuffer schemas #4582

Merged
merged 5 commits into from Aug 5, 2022

Conversation

natasha41575
Copy link
Contributor

@natasha41575 natasha41575 commented Apr 14, 2022

This should be merged after #4568, it updates the openapi scripts to fetch protobuffer schemas instead of JSON schemas.

openapiinfo.go (which stores the version number of kubernetes openapi data that we have) will now need to be updated manually. Previously we were parsing the JSON schema to get the version number, but I'm not sure if that's feasible with protobuffer. Instead, I added instructions to the README for how to update it manually which is a pretty lightweight process.

To test this, you can do the following steps:

  • pull this branch
  • go into the kyaml/openapi directory and run API_VERSION=v1.21.10 make kubernetesapi/swagger.go.
  • update openapiinfo.go manually to v1.21.10 according to these updated README instructions
  • run BenchmarkProtoUnmarshal in openapi_benchmark_test.go

/cc @KnVerey
/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 14, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 19, 2022
@natasha41575
Copy link
Contributor Author

/hold cancel

@natasha41575 natasha41575 removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 2, 2022
@natasha41575
Copy link
Contributor Author

/retest

@natasha41575
Copy link
Contributor Author

@KnVerey pinging in case this fell off your radar

kyaml/openapi/Makefile Outdated Show resolved Hide resolved
kyaml/openapi/Makefile Show resolved Hide resolved
kyaml/openapi/README.md Outdated Show resolved Hide resolved
kyaml/openapi/Makefile Show resolved Hide resolved
kyaml/openapi/README.md Outdated Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

@natasha41575: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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.

@natasha41575
Copy link
Contributor Author

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 7, 2022
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 18, 2022
@natasha41575 natasha41575 force-pushed the openapiScripts branch 7 times, most recently from f364b70 to e71e76a Compare July 18, 2022 22:27
@KnVerey KnVerey self-requested a review July 18, 2022 22:36
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 4, 2022

# TODO (natasha41575) Add a `kustomize openapi fetch --proto` option
kubectl proxy &
sleep 5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to add this delay because sometimes the curl timed out before the kubectl proxy was ready

kyaml/openapi/README.md Show resolved Hide resolved
Copy link
Contributor

@KnVerey KnVerey left a comment

Choose a reason for hiding this comment

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

I have two small questions but otherwise this looks good! Tried it locally both to regen the current version and to add a second, and works well.

if kubernetesOpenAPIVersion == "" {
return nil
kubernetesOpenAPIVersion = version
if version == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

why the switch to use the local var instead of the global one set on the line above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The global variable kubernetesOpenAPIVersion is keeping track of whether or not a custom schema or nondefault version has been set or not (and which one it has been set to) - while the version specifies what to actually use here, which might be the default.

I actually wrote up a much longer explanation and then realized the way that this is implemented is overcomplicated, so I updated it to something that is easier to follow and closer to what it was before.

kyaml/openapi/README.md Show resolved Hide resolved
@KnVerey
Copy link
Contributor

KnVerey commented Aug 5, 2022

/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 Aug 5, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KnVerey, natasha41575

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:
  • OWNERS [KnVerey,natasha41575]

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 merged commit 1b0fe2a into kubernetes-sigs:master Aug 5, 2022
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants