-
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
move webhooks away from api folder #3215
Comments
Hi @malt3, I would like to suggest you read the PR #3055 and the comment #2627 (comment) as #2627 (comment). You can see that those who raise the idea after their experiment realize that it is not a good option and decide that it would be better addressed by documentation.
Therefore, I'd like to raise a few questions:
|
@malt3 We would like to look into this issue in-depth to accept this as feature. Assigning this to myself to take a look. |
Hello, I will try to answer the open questions.
You are right. Depending on your viewpoint, webhooks may not be seen as controllers. However, webhooks have handlers (private implementation only used by the operator that is not required for other projects that may import the api folder). Placing the implementation and tests of webhooks into a new folder may also be an option.
I agree. The webhook envtests should live in the same folder as the webhooks. This means they should be moved together, away from the api folder.
Have operators that use multiple
For operators that use kubebuilder and also use go workspaces. And to allow imports of API modules of other open source operators without having to also depend on their version of envtest and other imports that are currently in the api folder.
A general best practice for go packages: If a package/module is meant to be imported by other modules, it should only import what is needed to consume the public api. The package/module The reconcile loops for custom resources live in
This would have negligible impact for the standard case (only one go.mod). Pros:
Cons:
|
Hi @n1r1, It is a very interesting thought. However, we just released go/v4 stable. Therefore, any change in the layout (breaking change) like this one can only be addressed in the new version, which would be go/v5. I am adding this one to the go/v5 milestone, and when we have a significant number of changes that justify we getting started with the new layout, we can discuss this request. I hope that can be fine. |
It seems the others are either looking for this one: #3721 (comment) Motivation: (IMO) However, before we start working in a go/v5 we will need to:
Then, we can start to work within a go/v5 alpha, but we will only be able to make it stable and the default scaffold once we have enough changes to do so. c/c @@nathanperkins |
Thanks for bringing this up. I want to stress how important this kind of change is to the community health at large. When projects include controller-runtime code (like webhook implementations) in their public API packages, any breaking change in that controller-runtime code creates a version barrier in which projects on either side of the barrier can't import each other's APIs. The suggested change here is the only way to fix the issue so that it doesn't reoccur whenever there are breaking changes. |
I am closing this one in favor of #4062 |
What do you want to happen?
This may be seen as an extension to #2627. I want projects to not place webhook handlers and envtests in the api folder.
Instead, webhooks should be moved into the controllers folder (or into a completely separate folder).
This allows external projects to import the api module without importing envtest libraries.
Extra Labels
No response
The text was updated successfully, but these errors were encountered: