-
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
Kubebuilder with multi-group and same Kind names doesn't generate proper crd/patch and rbac manifests #2495
Comments
Hi @rmb938, Could you please provide some additional info?
See that we have sample projects generated at testdata/ directory and I could not find the issue raised by you in the project which has multi-group support (see, kubebuilder/testdata/project-v3-multigroup).
Note the config/crd/patches generated for all groups:
Also, see the rbac generated for all: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v3-multigroup/config/rbac If you want see how the sample/testdata project is generated see the script: https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/testdata/generate.sh |
I created a kubebuilder project and push it to a repo for easy reference. PROJECT file: https://github.com/rmb938/multi-group-test/blob/main/PROJECT as you can see there's 2 groups each with a kind that is named the same. APIs https://github.com/rmb938/multi-group-test/tree/main/apis Controllers https://github.com/rmb938/multi-group-test/tree/main/controllers CRD Patches https://github.com/rmb938/multi-group-test/tree/main/config/crd/patches Notice they only exist for the single group RBAC https://github.com/rmb938/multi-group-test/tree/main/config/rbac notice that the editor and viewer roles only exist for You can replicate this project by running the following commands:
|
Hi @rmb938, Thank you for the clarifications That shows that when the multi-group support is enabled we are not using the group in the name of the files and generating them. So we need to: a) Ensure that we will consider the group to do the scaffolds Such as, change the boilerplates to use the group, see: https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/crd/patches. In the same way that we do here (https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/v2/scaffolds/internal/templates/api/group.go#L37-L43). ( The same implementation actually) b) Update the sample/testdata to have the same kind for different groups to ensure the scenario Could you help out with this fix? WDYT about a collab with a PR to fix this scenario? |
Yup I can get that done. I've been working on some internal kubebuilder scaffolds myself so I'm familiar with the modifications. I'll get the changes committed and a PR ready. |
What broke? What's expected?
In a multi-group project when 2 groups have the same CRD name for example
The crd patches generated in
config/crd/patches
and the rbac generated (for viewer and editor) inconfig/rbac
are only for the first group and kind that gets generated. They should be generated for all groups.Reproducing this issue
Run the following
KubeBuilder (CLI) Version
Version: main.version{KubeBuilderVersion:"3.3.0", KubernetesVendor:"1.23.1", GitCommit:"47859bf2ebf96a64db69a2f7074ffdec7f15c1ec", BuildDate:"2022-01-18T17:03:29Z", GoOs:"darwin", GoArch:"amd64"}
PROJECT version
3
Plugin versions
Other versions
Extra Labels
No response
The text was updated successfully, but these errors were encountered: