-
Notifications
You must be signed in to change notification settings - Fork 227
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
Kubernetes OpenAPI v3 #337
Comments
Hi @apelisse , maintainer of Kubeconform here - I would be very interested. Kubeval and Kubeconform do not validate directly against openapi, but convert the file to json schemas first https://github.com/yannh/kubernetes-json-schema If you know of a good Go library to use to validate against OpenAPI v3, and Kubernetes provided an OpenAPI v3 schema, I would most likely upgrade Kubeconform to use that. |
Absolutely, we're using https://github.com/getkin/kin-openapi internally to validate that our OpenAPI definition is valid, but you can also validate data against an OpenAPI definition! (I think). Let me know how this goes, happy to work with you toward that goal! |
@apelisse to clarify - you are talking about using the OpenAPIs as served by the Kubernetes endpoint? The way I use Kubeval/Kubeconform (and I think as do many others do) is to validate manifests within a CI, without direct access to a Kubernetes cluster. Currently they both use a separate repo for validation https://github.com/yannh/kubernetes-json-schema , derived from the swagger file, and it would be great to be able to retire this conversion. What I was wondering about was using kin-openapi to validate directly against https://github.com/kubernetes/kubernetes/tree/release-1.24/api/openapi-spec/v3 ? I'm looking into this but I admit I'm not exactly an expert on the differences between openapi v2/v3/swagger/ and json schemas 😬 |
For general lack of access, I'm planning on working on a tool to extract it from clusters and push it either as a file, base-layer docker image, but indeed you can get it from https://github.com/kubernetes/kubernetes/tree/release-1.24/api/openapi-spec/v3 too, though it won't include your custom-resource types, which is frustrating (we definitely want to validate custom-resources). I think that |
For CRDs - I usually put them all in a local folder to make them available (see https://github.com/yannh/kubeconform/#overriding-schemas-location---crd-and-openshift-support ) If you ever managed to come with an example how to validate a single manifest against the openapiv3 with kin-openapi I could probably update Kubeconform, but I've been looking at https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3?utm_source=godoc scratching my head how to do that in the past 😬 |
Hi there,
Kubernetes (and my team specifically) has been trying to migrate Kubernetes to use OpenAPI v3 and the feature is now in beta in Kubernetes v1.24. This means that both built-in types and CRDs are described through the same endpoint, with new improved caching mechanisms. I'm curious if this project has any interest into validating resources using the newly served OpenAPI rather than the existing v2 OpenAPI and its huge limitations to CRD validation.
Thanks!
The text was updated successfully, but these errors were encountered: