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
OpenAPI definition for AdmissionReview #84081
Comments
/sig api-machinery |
/assign great to hear you're implementing webhooks in other language. @liggitt is that intended? the last api group disable openapi generation :-/ |
sure, there's no requirement for webhooks to be written in go
Can you clarify what you mean by that? |
sry to be ambiguous, by scanning all the api groups in k/k, i found only
reading that as a yes to enable the openapi generation for the group. |
Generally the openapi should contain every resource served by the kube-apiserver, but AdmissionReview is different in that, it's a request made by the apiserver to a webhook servers. It probably doesn't belong in the main openapi spec served by the apiserver, but generating openapi for it and putting it somewhere could be useful. |
UPDATE: i tried toggle on the openapi generation for these groups but it doesnt work. i see the admission{request,response} types are already present in the pkg/generated/zz_generated_openapi.go but in the published doc from the apiserver, the types are gone.. or they can probably be filtered on aggregating/merging the openapi specs.. |
There seems to be a mechanism in OpenAPI to describe "callbacks": https://swagger.io/docs/specification/callbacks/ |
yes! however the callbacks only applies to v3 spec https://swagger.io/blog/news/whats-new-in-openapi-3-0/, we can consider include this in this KEP kubernetes/enhancements#1263 @p0lyn0mial |
@yue9944882 did you fetch the openapi.json using the |
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. |
was looking at the shellscripts again the |
/remove-lifecycle stale |
/lifecycle frozen |
Any plans for further work on this issue? Currently best option is to use unofficial clients like fabric8 for java, that has model for AdmissionReview class https://github.com/fabric8io/kubernetes-client/ |
In case it's useful for others, here are the swagger 2.0 specs I generated from k8s.io/api/admission. I used these swagger specs to generate models for my controller's webhook callbacks: I generated them with kubernetes/kube-openapi after changing Source code for the generator: https://gist.github.com/bergeron/70ca86cf31762e16f18b2be3c549a074?permalink_comment_id=3504827#gistcomment-3504827 |
What would you like to be added:
I would like an OpenAPI schema definition for admission controllers for the purposes of generating the API types (and potentially servers or server stubs) in multiple languages.
Why is this needed:
Now that AdmissionReview is promoted to v1, it would be welcome if we could get an OpenAPI schema on how such an API would look like.
Currently we have a nice OpenAPI schema that is used to programmatically generate API server clients in a multitude of languages. This is great for writing components that interact directly with the API Server.
We do however have the AdmissionReview API where one does not communicate with the component indirectly by watching API resources, but instead the component is called synchronously on API resource changes.
For such use-cases it would be nice to have a separate OpenAPI schema as well, where the types can also be generated for a multitude of languages, and maybe even generate servers from them, where you only need to pass in a request handler for example.
Right now it would be sufficient to simply generate the OpenAPI spec for the AdmissionReview types though.
The text was updated successfully, but these errors were encountered: