Tuesday, November 3, 2020

Second Part of Tutorial: Coding the Support of Multiple K8s API Groups

In the previous post, I showed you how to create a CRD from scratch along with validators and mutators.

Now it is time to show how to enable multiple versions of the same CRD with different schemas and provide full compatibility across them.

You can see the entire code here that I used kubebuilder to scaffold it.

$ kubebuilder create api --group music --version v1alpha1 --kind RockBand --resource=true --controller=false

$ kubebuilder create webhook --group music --version v1alpha1 --kind RockBand --conversion
The trick is leveraging the annotation struct for the conversion back and forth of the releases, as shown ConvertFrom and ConvertTo functions.




No comments:

kuard on OpenShift

A quick way to onboard the handy "Kubernetes Up and Running"  kuard application on OpenShift: curl https://raw.githubusercontent....