-
Notifications
You must be signed in to change notification settings - Fork 440
Adjust for structural schema KEP #216
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
Comments
/kind feature |
cc @sttts |
Which are those reasons? Note that the spec is most probably incomplete when defined by the developer because ObjectMeta is defined by the cluster at hand. In contrast to anything else in a CRD, the ObjectMeta life cycle is not the one the operator builder controls. When the cluster adds a meta feature (server side apply, more powerful GC, etc.), every resource will inherit it. |
We have a contributor who initially wanted to use this code for generating openapi specs to be consumed by editor tooling. |
Any thoughts on how to tackle this @DirectXMan12? |
@pires With structural schema we have And the published spec will have a |
I've worked around this with a kustomize patch of the crd manifest to only include name and generateName in ObjectMeta properties, but still with ObjectMeta in original struct (nothing gets generated if this isn't present). We could just do that on generation of validation spec, just restrict to name and generateName properties in metadata. |
@jimmidyson you will be able to have |
@jimmidyson @sttts IIUC the approach Cluster API folks picked up was to remove ObjectMeta and explicitly specify the attributes Jimmi mentioned. As I was reading the updates for CRD in 1.15, including |
@pires that will verify TypeMeta and ObjectMeta automatically yes. Plus whatever you add to that for additional constraints. |
@sttts I thought that was for types embedded in eg spec, not for the top level crd? Do you have an example to hand? |
@jimmidyson right. For top-level it is automatic. And you are able to (only) constrain name and generateName. I guess it is more of a kubebuilder question how to overlay arbitrary custom constraints. |
So, one option is to use an override, which will handle explicit uses of objectmeta. We'll override it to put @sttts presumably we need to strip that for the top-level objectmeta? We can do that with a special case. |
as for overlaying custom constraints, that'll take a bit more thought. One option would be to have a special marker for roughly the equivalent of I'm open to alternatives, though. |
Yes, top-level does not have it.
That's what I would have expected. Even if we don't force anybody into the full OpenAPI spec (using some syntax), I would appreciate it very much if there were at least a generic, raw OpenAPI marker as well. Sometimes it will be easier to just write down what you want than to find a way with markers on types. |
See also #266 |
Still need a marker for embedded-resource, but I'm calling this done for now. |
A new kep was introduces to restrict how we generate OpenAPI validation for CRDs. It has a number of special extensions that we'll want to support, plus restrictions on validating objectmeta. We'll need some specially handling here, since people might want a full metadata openapi spec for other reasons.
See also https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190425-structural-openapi.md
The text was updated successfully, but these errors were encountered: