-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Making client-gen work with layout V4 #3795
Comments
Hi @shaneutt, Since you have been using the code-generator with Kubebuilder could you please help us by providing the following information: 1 - What changes were required for you to integrate the Kubebuilder project with the code generator? If you update the makefile target, could you please provide a snippet of the code? |
I've done this for several project, and yes it's generally just adding a
And then you get a generated, updated clientset for all your
It has historically not been an issue to use them in tandem. I think it's important to note that I'm only talking about the use of client-gen specifically. It's useful because it automatically provides a typed client that can be used for end-users to integrate with your operators, with extremely low amounts of code and maintenance. |
Hi @shaneutt Thank you that is very interesting. Regards:
Can you please let us know more about it? |
As a user of the ACME Operator, I want my Golang-based controllers to be able to read and write to resources of API types provided by the ACME Operator with a typed client. For some additional context, we have upstream Kubernetes APIs that do this as well. In Gateway API we provide such a client for our CRDs: https://github.com/kubernetes-sigs/gateway-api/tree/main/pkg/client/clientset/versioned |
Hi @shaneutt Thank you for provide the info. However, sorry I never used the project https://github.com/kubernetes/code-generator So, could you please help understand better:
|
We don't use this in our operators. Our users use these to integrate with our operators.
Same as above, it's for end-users or cases where you are building something that integrates with our APIs.
The motivation was common practice. Again, this is also something that we provide in upstream Gateway API. |
Hi @shaneutt We might could add an e2e test to ensure that changes does not break with the integration and make a documentation explaining when to use, why to use, how to use. (ps: it still not clear 100% for me sorry) |
This comment was marked as outdated.
This comment was marked as outdated.
It is no longer blocked. |
What we need to do here:The goal is to create a sample project using
Following is a comprehensive detailed explanation of what needs to be done here and the suggestions on how to do it:1) Understand the Project Client-Gen and when/why/how to use it with kubebuilder:
2) Create a new documentation under the Reference section:See: https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/reference
3) Ensure that example, sample are generated automatically and that the integration with client-gen is either called always on it so that we can validate that properly works:
|
As was discussed in #1152, I think the recommended way for users to consume CRDs in Go apps is to use the This then lets you simply import the generated CRD interface types from the Kubebuilder app, and you also get the benefit of being able to use That is, there is not really a need for explicitly generated client sets anymore. |
What do you want to happen?
There are many projects out there which use
kubebuilder
to manage their controllers and APIs while also using controller-gen'sclient-gen
command to generate a Golang client for those APIs.Historically this has "just worked" but with layout v4 things have been breaking:
kubernetes/code-generator#167
The purpose of this request is to get this back into a working state and make support for this even more official so that we can coordinate and avoid breakages in the future.
/cc @camilamacedo86 who requested I put this issue in
Extra Labels
No response
The text was updated successfully, but these errors were encountered: