Expose metadata of VolumeContentSource(VS/PVC) to SP plugin
jeffyjf opened this issue · 4 comments
Is your feature request related to a problem?/Why is this needed
Some SPs cannot delete VolumeSnapshot before the Volume that based on the VolumeSnapshot be deleted, Such as openstack cinder. This is our bug description: kubernetes/cloud-provider-openstack#2294.
Describe the solution you'd like in detail
I want to synchronously add finalizer to VolumeSnapshot when create PersistentVolume based on this VolumeSnapshot to resolve above issue. But I can't get enough informations (such as name and namespace) about the VolumeSnapshot in CreateVolume function, CreateVolumeRequest just provide VolumeContentSource kind and the changed name.
Describe alternatives you've considered
I tried to register a watcher to wath the creation event of PersistentVolume, I add a finalizer to VolumeSnapshot when I receive the event, But it is asynchronous, It seem like is unsafety. I also tried to implement a admission webhook to do this, duo to it is kind of complexity and it complicate the deployment, I don't like it.
Additional context
We also support create PersistentVolumeCliam base on anthor PersistentVolumeCliam, maybe it will have the same issue with other SPs. So, I propose that add csi.storage.k8s.io/vsc/name
and csi.storage.k8s.io/vsc/namespace
to CreateVolumeRequest parameters when flag --extra-create-metadata
be set to make it more general.