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
controller-gen v0.9.0 does not generate CRDs for additional paths #680
Comments
sbueringer
changed the title
controller-tools v0.9.0 does not generate CRDs for additional paths
controller-gen v0.9.0 does not generate CRDs for additional paths
May 25, 2022
This was referenced May 25, 2022
I am taking a look. This is definitely odd as the paths should arrive in the library call as a single slice. |
akutz
added a commit
to akutz/controller-tools
that referenced
this issue
May 25, 2022
This patch updates the way the CRD generator compares an imported metav1 package. Previously the comparison occurred using a Golang equality operator, !=, against two, in-memory data structures. However, this fails when multiple root paths are loaded. Their metav1 packages are identical, just not identical objects in memory. This patch updates the comparison to compare the package IDs, not the instance of the object. Fixes kubernetes-sigs#680
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The new controller-gen version only generates CRDs for the first specified path.
An example:
Only CRDs from the
./api/
folder are generated/updated none of./exp/api/...
(i.e. the MachinePool CRD).I took a closer look at the code and it looks like the metav1Pkg does not match when checking if MachinePool has ObjectMeta and TypeMeta:
controller-tools/pkg/crd/gen.go
Line 250 in 0fba82b
Not sure if it would be a correct fix, but by changing the line to
controller-gen was updating the MachinePool CRD again.
I think it's an additional issue, but after introducing this fix controller-gen did update the MachinePool CRD but it ignored the
+kubebuilder:validation:MinLength=1
annotation (i.e. it didn't include minLength in the CRD anymore).The text was updated successfully, but these errors were encountered: