Custom Syncers
It would be nice to have some documentation or an example on how to go about making a custom syncer.
A use-case would be for CRDs like cert-manager. The host cluster would have the issuer and credentials to issue certificates while the vcluster doesn't. In the vcluster we would create a certificate resource and a custom syncer that syncs it to and from the host cluster.
@rmb938 thanks for creating this issue! Yes we are working on this and want to provide some sort of SDK for people to write their own custom syncers for CRDs
I think if we can create something like in jsPolicy, it would be incredibly easy to write some kind of "transformer/translate" functions for custom sync logic. That would be very powerful and yet easy at the same time. If it was a CRD like JsPolicy in the underlying cluster, it would be very easy to create custom sync logic for a vcluster or reference a couple of these transformer/translate objects from a vcluster to use it if needed.
I think anything that requires building an image (plus access to a registry) would make it x times harder to extend vcluster.
Oh I like that idea. Being able to create or change the translate functions without having to build a whole image and controller would be awesome.
The idea of writing "plugins" for the syncher is great i think. It will keep configuration simple and transparent and at the same time allow us to write custom syncers for all those different crd's we want to share with the underlying cluster. (Api gateways are a great example for those since most do not come with a good ingress ressource management)
FYI. Now vcluster have support for plugins https://www.vcluster.com/docs/plugins/overview and here is even case example for CRD sync https://github.com/loft-sh/vcluster-sdk/tree/main/examples/crd-sync
Also based on discussion on https://github.com/loft-sh/vcluster/issues/443#issuecomment-1110694323 it probably would be possible to get those code and hosted here as same repo with vcluster it selves.
We have a doc with a plugin development tutorial here - https://www.vcluster.com/docs/plugins/tutorial Also, we have an initial version of a plugin that can sync resources based on yaml configuration, so no coding is required. Here is documentation for that - https://www.vcluster.com/docs/plugins/generic-crd-sync and we also have example configuration for cert-manager and a few more in the plugin repo.
I think these existing solutions satisfy what was originally requested in this issue, so I'll close it. But we would be happy to receive feedback on how we could further improve in this area.