-
Notifications
You must be signed in to change notification settings - Fork 423
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
Incorrect crd properties generated for structs defined in k8s/api #457
Comments
/kind bug |
To me, the validation of core types is a feature rather than a bug. Without it, I would have to implement a validating webhook to verify core types, yes? There are some limitations (declarative defaults, #444) and possibly bugs, but those should be fixed upstream on the core types rather than here. I see that |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. 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/test-infra repository. |
Hi folks,
we define CRD with fields defined in
k8s.io/api
, such as:For this kind:
With controller-tools
v0.1.x
, the CRD yaml is generated like this.This is ok, all structs defined in
k8s.io/api
are all generated without properties. It is because controller-gen in this version will ignore fork8s.io/api
https://github.com/kubernetes-sigs/controller-tools/blob/release-0.1/pkg/internal/codegen/parse/crd.go#L457But with controller-tools higher than
v0.2.x
, the CRD yaml is generated like this.It generates properties for structs defined in
k8s.io/api
, which not only makes the CRD yaml much bigger, but also causes incorrect validation.Problems we have found:
VolumeClaimTemplates []v1.PersistentVolumeClaim
, it requires user to definedataSource
inv1.PersistentVolumeClaim
, which should be optional. (Issue)Template v1.PodTemplateSpec
, it will returnThe CloneSet "demo" is invalid: type: Required value
when we definedownwardAPI
intemplate.spec.volumes
.So, could we skip to generate properties for structs defined in
k8s.io/api
, just like thev0.1.x
did?The text was updated successfully, but these errors were encountered: