-
Notifications
You must be signed in to change notification settings - Fork 148
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
Change directory tree to the new kubebilder template #840
Conversation
58cc757
to
8554a6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi guys, even though I generally approve of standardization changes, this would make it impossible for us to consume the controllers of topolvm via go import as you move them to the internal package. This is a severe issue for us as we would need to constantly patch a huge mv from files everytime we do a rebase. The reason we do this is because we dont bundle the cmds as they do not contain enough flexibility for us to integrate them into lvm-operator in openshift.
Is it possible to challenge moving everything to internal and keeping controllers in pkg? If not could we at least wait until we have a discussion on how to solve our downstream so that we can ensure continuity?
@jakobmoellerdev |
Thanks, we appreciate you modifying the current approach: These are all the usages in lvm-operator of any topolvm package as of now:
|
b11f439
to
5273c59
Compare
In the last commit of this PR, the functions used from lvm-operator are put in the pkg dir.
|
Ill pull your branch and do a temporary recompile to see if we have any incompatibilities. Please give me some time to confirm, will report ASAP. |
Okay so maybe my Feedback here: I think this will work (at least my compile didnt go crazy, but I may have to open up follow up issues if there is in the future any type that would need to be exported (something we can do though and not blocking this PR) However, I think the passing of internal to pkg (via aliasing of a pkg type into the internal pacakge) to expose the types is quite convoluted and makes the code harder to maintain. I'm wondering why it is necessary for us to adopt "internal" over pkg, since we have no sensitive code that is not "allowed" to be imported. Why is it a must have for us to adopt this suggested build pattern from kubebuilder v4? |
Thanks for the confirmation. We think about the directory structure as follows. When adding a new controller or modules, kubeuilder generates a skeleton in the specific directory. So we were going to do this code migration to ease future development. We'll keep pkg dir for now. However, we don't expect the code under this directory to be used for other projects and want to do this migration in the future. Could you modify lvm-operator to remove the dependency on this directory and let us know if it's done? |
I understand the incentive but the only alternative for us is to use the commands as is which prohibits us from starting the controllers within the same controller manager. Thus we need direct access to the Controller structs
I'm not certain how this would ever work out for us (and we cannot migrate unless you change your package structures anyway in main, since we depend on the latest topolvm code). We just recently switched to a model where we incorporated all the controllers directly because of resource constraints: Starting the controllers like in https://github.com/openshift/lvm-operator/blob/main/cmd/vgmanager/vgmanager.go#L153-L196 is currently only possible via go import. If there is a way to do this without actually importing the code from these packages, Im open to this of course. We could for example change the way that the topolvm cmd package is started because this is non-standard kubebuilder. If we find a way to incorporate the manager into this then I believe this can solve our issue. |
Maybe let me summarize: I am not opposed to this change (its always good to stick to upstream), but I also dont think that moving the controllers into internal is really a must-enforce. Kubebuilder does a suggested layout like this because most controllers actually nowadays are downstream controllers that do not need to have controllers exposed. |
@jakobmoellerdev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the following. Other than that, I don't think there are any problems.
5273c59
to
916cbda
Compare
@llamerada-jp Could you add this link to the PR description and the description in the following commit?
In addition, how about adding this link to the following commits?
I believe that both links will help us very much to understand why we made these changes. |
pkg -> cmd e2e -> test/e2e util/testing -> test/util controllers -> internal/controller other sources -> internal/* ref: https://book.kubebuilder.io/migration/migration_guide_gov3_to_gov4 Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
The same test is executed on the test target in the Makefile. Therefore, this one is removed. Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
ref: #840 (comment) ref: #840 (comment) Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
916cbda
to
aecf180
Compare
a part of: #760
ref: https://book.kubebuilder.io/migration/migration_guide_gov3_to_gov4