-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for configuring boilerplatePath
during API scaffolding on plugin base.go.kubebuilder.io/v4
#3697
Comments
boilerplatePath
during api creation on plugin base.go.kubebuilder.io/v4
boilerplatePath
during API scaffolding on plugin base.go.kubebuilder.io/v4
boilerplatePath
during API scaffolding on plugin base.go.kubebuilder.io/v4
boilerplatePath
during API scaffolding on plugin base.go.kubebuilder.io/v4
Hi @ardikabs, Thank you for bringing up this issue. I agree that the ability to customize all paths, not just specific ones, would be a valuable addition to Kubebuilder. A config file allowing users to define paths for controllers, hack, etc., would indeed enhance the tool's flexibility. However, introducing such customization for only one aspect without addressing the others would lead to inconsistency in behavior. We aim for a uniform and predictable user experience. Therefore, implementing this feature across the board is crucial, albeit it introduces significant complexities. IHMO: Given these considerations, the best approach would be to develop a detailed proposal. This document would outline the implementation strategy, consider potential problems, and propose solutions. You can find a template for proposals here: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/template.md, and some examples at: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs. As a temporary measure for the current issue, one possibility could be to issue a warning instead of an error when the boilerplate is not found, though this might be perceived as a bug by some users. However, it might be an acceptable interim solution. We're definitely open to contributions that would help us move in this direction. |
Hi @camilamacedo86 , seems I missed the notification, sorry for the late response. It seems there is no error returned when Nevertheless, I am willing to address this concern by modifying Regarding the design proposal, I am interested in contributing to it. However, I'm unsure if focusing solely on |
Hi @ardikabs,
That is great, and you are right. The proposal should be a solution that provides a design that allows users to customise the path for controllers and APIs as well. We cannot allow it partially. Otherwise, the UX will be hard. However, I am proposing a third option that might be acceptable.
I was thinking better about this one. So I think we can: a) Improve the error message, say that the file was not found, and outline the Options. use None if you do not want any scaffold b) An alternative option might be: would you like to work on this one? |
About current structure (using
|
Hi mateusoliveira43,
Yes, the default layout in Kubebuilder adheres to the standards and best practices established by Golang and Kubernetes communities. Here's a brief explanation of the directory structure:
For more information, you can refer to these resources:
Please note that any changes in the project layout and the scaffolding process are extensively discussed within the community and are not made lightly. Furthermore: https://book.kubebuilder.io/migration/legacy/v2vsv3#project-customizations |
thanks for the detailed explanation @camilamacedo86 ! |
Hi @camilamacedo86 , i have submitted a PR for this request, but instead of storing to the |
Hi @ardikabs
What you want to change here is related to the base of the Project Change it is outside of the domain of responsibility of create API, and create webhook commands |
I see, in other words, we need to introduce a new field in the PROJECT file, yes? |
Hi @ardikabs Yes. We need to:
Lastly, we need an e2e test to ensure the functionality. I hope that helps clear things up. Thank you a lot for looking on that. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
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-sigs/prow repository. |
What do you want to happen?
Description:
Currently, I've configured my operator to adhere to an opinionated directory structure preference, causing me to execute
kubebuilder
with a non-default plugin, which isbase.go.kubebuilder.io/v4
. However,kubebuilder
seems to define a hardcoded boilerplate path attribute inhack/boilerplate.go.txt
during API scaffolding, as can be seen below at line 70:kubebuilder/pkg/plugins/golang/v4/scaffolds/api.go
Lines 66 to 77 in 26ee671
Feature Request:
Could it be configured to accommodate an opinionated directory structure when attempting to satisfy certain preferences? say i expect the boilerplate refer to
tools/hack/boilerplate.go.txt
, as compared tocontroller-gen
tool that could refer to a customheaderFile
like below:Plugin:
base.go.kubebuilder.io/v4
Extra Labels
No response
The text was updated successfully, but these errors were encountered: