loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.35k stars 406 forks source link

Make it possible to use Deployment rather than Stateful set for syncer. #181

Closed GrahamDumpleton closed 2 years ago

GrahamDumpleton commented 2 years ago

As per old discussion at:

https://loft-sh.slack.com/archives/C01N273CF4P/p1633429533205300

it may be beneficial in some cases to use a Deployment for the syncer rather than a StatefulSet. One reason being that the persistent volume will be automatically deleted when deleting the Deployment (if using owner references) but not when using a StatefulSet.

The issue with using a Deployment is the --owning-statefulset option is designed on basis that a StatefulSet is used. To support use of Deployment, this would need to be generalised so could specify a type for the owner of Deployment or StatefulSet. Eg., --owning-resource=deployment/vcluster or --owning-resource=statefulset/vcluster.

FabianKramm commented 2 years ago

@GrahamDumpleton thanks for creating this issue! Yes we should definitely make vcluster statefulset independent and not provide any features that specifically require a statefulset, maybe even just use a flag --set-owner that will find out the owning resource automatically based on the current pod.

FabianKramm commented 2 years ago

This should work now with the new v0.4.4 and up