The new controller-gen version only generates CRDs for the first specified path.
An example:
controller-gen-v0.9.0 \
paths=./api/... \
paths=./exp/api/... \
crd:crdVersions=v1 \
output:crd:dir=./config/crd/bases
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:
|
if fieldPkg != metav1Pkg { |
Not sure if it would be a correct fix, but by changing the line to
if fieldPkg != nil && fieldPkg.PkgPath != metav1Pkg.PkgPath {
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 new controller-gen version only generates CRDs for the first specified path.
An example:
controller-gen-v0.9.0 \ paths=./api/... \ paths=./exp/api/... \ crd:crdVersions=v1 \ output:crd:dir=./config/crd/basesOnly 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=1annotation (i.e. it didn't include minLength in the CRD anymore).