Skip to content
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 ConversionReview to Kubernetes ApiExtensions Model #3336

Closed
rohanKanojia opened this issue Jul 21, 2021 · 5 comments · Fixed by #3388
Closed

Add ConversionReview to Kubernetes ApiExtensions Model #3336

rohanKanojia opened this issue Jul 21, 2021 · 5 comments · Fixed by #3388
Assignees
Milestone

Comments

@rohanKanojia
Copy link
Member

ConversionReview, ConversionRequest and ConversionResponse might be used by users who are interested in writing a conversion webhook in order to handle CustomResource conversions from one version to other.

You can find equivalent go struct here: https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apis/apiextensions/v1/types.go#L457

@MUzairS15
Copy link
Contributor

Can I try on this?

@rohanKanojia
Copy link
Member Author

Yes, sure. Here are the steps you need to follow in order to complete this:

  1. Add ConversionReview in Kubernetes Model APIExtension generator:
    V1JSONSchemaPropsOrStringArray v1apiextensions.JSONSchemaPropsOrStringArray
  2. If you have golang installed run make to generate model.
  3. Verify you have ConversionRequest.java, ConversionResponse.java, and ConversionReview.java generated.
  4. Add test for basic serialization, deserialization of ConversionReview

@MUzairS15
Copy link
Contributor

Pls assign me

@manusa
Copy link
Member

manusa commented Aug 11, 2021

There's no clear path to use these new types from CustomResourceDefinitionSpec#conversion ->
CustomResourceConversion#webhook -> WebhookConversion#conversionReviewVersions -> ...

Go structs: WebhookConversion#ConversionReviewVersions -> ?? -> ConversionReviewVersions

Do you have any example @rohanKanojia ?

@rohanKanojia
Copy link
Member Author

rohanKanojia commented Aug 11, 2021

Conversion webhooks for CRDs are launched in the cluster and put behind a Service object, and that service object is referenced by the conversion webhook specification in the CRD manifest.

I found these by a quick search on the web(written using client-go):

https://github.com/programming-kubernetes/pizza-crd
https://github.com/madorn/crd-conversion-webhook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment