-
Notifications
You must be signed in to change notification settings - Fork 428
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
Rethinking metadata schema generation in CRD yamls #385
Comments
/sig api-machinery |
I would prefer to see a stripped down EmbeddedObjectMeta if possible, or at least let controller-gen do the restriction. ObjectMeta has so many fields which do not make sense for embedded ObjectMeta. Also the schema is super huge. |
I like the idea of |
/help |
@DirectXMan12: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed 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. |
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. |
/remove-lifecycle stale |
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. |
/remove-lifecycle rotten |
I think #395 is actually close to being mergable, it's just a bit out of date. If someone wants to pick that up, I've left comments on it. |
@DirectXMan12 see my comment in 395. IMO we should not do that. Instead let's add a sensible EmbeddedObjectMeta to API machinery and make controller-tools warn if that is not used instead of ObjectMeta. |
@sttts that doesn't work for when you embed things with ObjectMeta in them already though -- e.g. PodTemplateSpec, which is probably the most common case. We'd have to swap that out on demand or something. |
True. So we must add special handling for embedded ObjectMeta to only specifiy sensible fields (more than just |
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-contributor-experience at kubernetes/community. |
@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. |
Controller-gen cannot generate embedded metadata fields, resulting in those fields deserializing to empty objects. In order to embed metadata in a CRD, it is necessary to duplicate metadata fields where appropriate. See issue: kubernetes-sigs/controller-tools#385 for details Signed-off-by: Angel Misevski <[email protected]>
Controller-gen cannot generate embedded metadata fields, resulting in those fields deserializing to empty objects. In order to embed metadata in a CRD, it is necessary to duplicate metadata fields where appropriate. See issue: kubernetes-sigs/controller-tools#385 for details Signed-off-by: Angel Misevski <[email protected]>
Controller-gen cannot generate embedded metadata fields, resulting in those fields deserializing to empty objects. In order to embed metadata in a CRD, it is necessary to duplicate metadata fields where appropriate. See issue: kubernetes-sigs/controller-tools#385 for details Signed-off-by: Angel Misevski <[email protected]>
Controller-gen cannot generate embedded metadata fields, resulting in those fields deserializing to empty objects. In order to embed metadata in a CRD, it is necessary to duplicate metadata fields where appropriate. See issue: kubernetes-sigs/controller-tools#385 for details Signed-off-by: Angel Misevski <[email protected]>
For posterity: if you're developing a CRD with a spec field that uses This will ensure that your CRD has a schema for |
Currently controller-tools does not generate any properties for metadata fields at any level in CRD yamls to accommodate for structural schema.
https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/crd/known_types.go#L29-L33
My it is my understanding that only top level metadata field is restricted to define name & generatedName fields. Any other nested metadata field can have detailed schema. Some common cases are embedding PodTemplate, PersistentVolumeClaim in CRDs.
Currently we are creating our own
ObjectMeta
types are using them in our CRDs to work around this issue.Do you think controller-tools could just strip the properties for top level metadata field? One way to do that will be to remove
ObjectMeta
from known types and then clean the generated yaml before writing to disk.Any thoughts?
The text was updated successfully, but these errors were encountered: