-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add structural OpenAPI schema to Tekton CRDs #1461
Comments
This PR is related: #1179 |
Is this something that can be easily generated using existing tooling? I'm a bit worried we'll end up with structs and YAML validation out of sync, and I'm also a bit uncomfortable with maintaining code to generate one from the other. Is there something OpenAPI provides for this? |
/kind feature |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: 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. |
/remove-lifecycle rotten |
@vdemeester: Reopened 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. |
GitHub recently introduced this too https://github.blog/2020-07-27-introducing-githubs-openapi-description/ |
this enables us to have an openapi validation in the CRDs by default Closes tektoncd#1461
this enables us to have an openapi validation in the CRDs by default Closes tektoncd#1461
this enables us to have an openapi validation in the CRDs by default Closes tektoncd#1461
this enables us to have an openapi validation in the CRDs by default Closes tektoncd#1461
this enables us to have an openapi validation in the CRDs by default Closes tektoncd#1461
knative does this now, one try is available here : main...vdemeester:schema-gen. |
I've started playing around with this, and narrowed down the panic to something thinking the package EDIT: Actually, that's just 'cos I copied in |
I'm pretty sure there's something weird about our CRDs and/or our packages resulting in this... EDIT: Ok, my best guess so far is that it's getting confused by the existence of both pipeline v1alpha1 and resource v1alpha1 with the same group ( EDIT AGAIN: My description of the problem may not be right, but I just tested and verified that if I just put |
Arg.. I don't like that 😝… Seems like it's a bit too "tightly" coupled to the assumption that you put all your type in the same package.. 😅 |
Yeah, I'm trying to figure out exactly where that assumption is made... |
Ok, the panic is the same as in kubernetes-sigs/controller-tools#624, though the scenario in that PR doesn't quite match ours...BUT! I have a tentative fix: abayer/controller-tools@c8009f3 - I'm now working on a test case, then will open a PR to controller-tools. After that, I'll see what of the knative fork of controller-tools we actually need to see if I can turn that into a PR to controller-tools as well, and if it's too weird/specific to do that, I'll just push a branch to my fork that we can use. |
PR opened for that fix - kubernetes-sigs/controller-tools#627 - I'm now trying to determine if we need to filter some fields out, like the knative-specific branch does. I think at a minimum we need to only take the So yeah, if we do need that filtering, we'll need a change to |
/assign @abayer |
Well, kubernetes-sigs/controller-tools#627 (comment) - our layout is awfully nonstandard, and the not-unreasonable response from the maintainer is asking if we can restructure things rather than make a change to |
Started playing around with what would be involved in moving |
They are in separate packages because of « loop dependency ». We may want to go ahead and reorganize that by duplicating some code and make v1alpha1 and v1beta1 completely independent of each other (code wise) which could be beneficial for the future anyway 😇 |
OpenAPI schemas will also help with managing Tekton through Terraform - without them Terraform doesn't know how to ignore the release annotation in a taskrun which causes Terraform to constantly want to destroy and create the manifest. |
I want to add that the OpenAPI schema also is really handy for users. I tend to use $ kubectl explain tasks
KIND: Task
VERSION: tekton.dev/v1beta1
DESCRIPTION:
<empty> Compare the above to one that has a OpenAPI schema. You can drill down into the spec as far as you like. $ kubectl explain podmonitors
KIND: PodMonitor
VERSION: monitoring.coreos.com/v1
DESCRIPTION:
PodMonitor defines monitoring for a set of pods.
FIELDS:
apiVersion <string>
APIVersion defines the versioned schema of this representation of an
object. Servers should convert recognized schemas to the latest internal
value, and may reject unrecognized values. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind <string>
Kind is a string value representing the REST resource this object
represents. Servers may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata <Object>
Standard object's metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec <Object> -required-
Specification of desired Pod selection for target discovery by Prometheus. |
if we're not going to get common recipes for Tekton, we really need the autocomplete in our editors |
/unassign |
Just want to second this. Managing Tekton resources with |
Adding my voice here, today, that I was looking for this documentation and discovered that not only was the structural schema missing, but there's also no standard Open-API generated schema documentation, only by-hand documentation which doesn't document (for example) |
/assign |
This would be a really nice addition for developer UX. |
Kubernetes 1.15 introduced structural OpenAPI schema which helps with validation, supporting
kubectl explain
and also building tools around it:Structural schema should be added for all CRDs introduced by Tekton.
The text was updated successfully, but these errors were encountered: