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

Support ad-hoc client generation for CRDs #121

Open
yue9944882 opened this issue Jun 27, 2019 · 22 comments
Open

Support ad-hoc client generation for CRDs #121

yue9944882 opened this issue Jun 27, 2019 · 22 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@yue9944882
Copy link
Member

as 1.15's out, users can publish their own openapi spec w/ CRD integration. we should probably refactor the scripts to support ad-hoc client generations.

/cc @brendandburns @roycaihw

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 25, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 25, 2019
@zoidyzoidzoid
Copy link

Would love to see this done. I'd be happy to help if I can.

@zoidyzoidzoid
Copy link

Generating clients for CRDs would be amazing

zoidyzoidzoid added a commit to zoidyzoidzoid/shipper that referenced this issue Dec 4, 2019
Some of the modern Kubernetes clients use clients generated from a
swagger.json

kubernetes-client/javascript uses kubernetes-client/gen which uses
OpenApiTools/openapi-generator and kubernetes/kubernetes/api/openapi-spec/swagger.json

There are open/closed/rotten/ignored issues all over the place about
making these easier to use with CRDs.

Wrongly closed issue on kubernetes-client/javascript: kubernetes-client/javascript#341
Open issue on kubernetes-client/gen: kubernetes-client/gen#121

It seems like kubernetes/kube-openapi is one of the repos working on
solving the main part of this problem, generating the Go code to make
it easy to generate a swagger.json

I found the following Argo code via the following issue:

kubernetes/kube-openapi#13

https://github.com/argoproj/argo/blob/master/hack/gen-openapi-spec/main.go
https://github.com/argoproj/argo/blob/master/pkg/apis/workflow/v1alpha1/openapi_generated.go#L14:6
https://github.com/kubernetes/kube-openapi/blob/master/cmd/openapi-gen/openapi-gen.go

So I'm working on adding similar stuff to Shipper.

gen-openapi-spec uses the generated openapi_generated.go module that is
generated via the openapi-gen command.

The following commit adds the code to generate openapi_generated.go

Signed-off-by: William Stewart <zoidbergwill@gmail.com>
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/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.

@zoidyzoidzoid
Copy link

/reopen ?

@zoidyzoidzoid
Copy link

I think this would be a useful feature.

I recently went down this route, of trying to get this working, and it was painful and required some manual work too: bookingcom/shipper#243

@yue9944882
Copy link
Member Author

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Dec 9, 2019
@k8s-ci-robot
Copy link
Contributor

@yue9944882: Reopened this issue.

In response to this:

/reopen

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.

@yue9944882
Copy link
Member Author

@zoidbergwill we had an experimental CRD model generator for java (just generating model would be sufficient b/c we have custom-object api to be the general client) https://github.com/kubernetes-client/java/blob/master/docs/generate-model-from-third-party-resources.md. it will require kubernetes v1.15+ tho. it works for us in production..

@yue9944882
Copy link
Member Author

/lifecycle active

@k8s-ci-robot k8s-ci-robot added lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Dec 9, 2019
@aespinosa
Copy link
Contributor

@yue9944882 @zoidbergwill we had success using https://github.com/kubernetes-client/gen/ for our case. we grabbed swagger.json.unprocessed (via 1.15+) and post-processed the spec by hand through gron.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/active Indicates that an issue or PR is actively being worked on by a contributor. labels Mar 9, 2020
@zoidyzoidzoid
Copy link

I had some luck in December, but it was pretty painful. I also ended up doing a bunch of copypasta by hand.

Most of it is documented in bookingcom/shipper#243

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 16, 2020
@palnabarun
Copy link
Member

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label May 10, 2020
@palnabarun
Copy link
Member

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label May 10, 2020
@yue9944882
Copy link
Member Author

UPDATE: for java the CRD models now can also be written manually by properly implementing some interfaces: kubernetes-client/java#1020

@std4453
Copy link

std4453 commented Feb 18, 2022

After roughly 1.5 year, is anyone actually working on this issue?

@aespinosa
Copy link
Contributor

The work on the java client has been pretty active. I'm not sure about other languages though. I guess a status at the main github issue status for other languages would be handy.

@liangyuanpeng
Copy link

liangyuanpeng commented Aug 24, 2023

I'm looking to generate client-go for CRD, does anyone know of any way?

Have check the https://github.com/kubernetes/code-generator and seems like it's base the golang (mean base on mode of golang, like types.go ) and i just have the CRD files, it's generate from rust.


EDIT: checking the https://github.com/OpenAPITools/openapi-generator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

8 participants