Is your feature request related to a problem?/Why is this needed
Yes.
In Azure File CSI driver, when a dynamically provisioned PV is deleted with StorageClass.reclaimPolicy=Delete, users currently cannot configure a CSI-level deletion behavior (for example an onDelete-like policy used by some other NFS/SMB CSI drivers).
As a result, there is no built-in way to keep the underlying Azure File share for data preservation scenarios while still using the Delete reclaim workflow for Kubernetes resources.
This is needed for:
- safer production operations (avoid unintended data loss),
- migration/rollback workflows,
- better parity with user expectations from other file CSI ecosystems.
Describe the solution you'd like in detail
Add support for a StorageClass parameter (name can follow project conventions, e.g. onDelete) to control backend share behavior when PV deletion is triggered.
Suggested behavior:
onDelete: delete (default, backward-compatible with current behavior)
onDelete: retain (do not delete underlying Azure File share; only remove Kubernetes-side objects/attachments)
Implementation direction (high-level):
- Parse the new parameter from StorageClass.
- In controller
DeleteVolume flow, branch deletion logic based on this parameter.
- Keep default behavior unchanged when parameter is not set.
- Add tests:
- default path remains unchanged
- retain path keeps the backend Azure File share after PV deletion
- Document parameter usage and examples in driver docs.
Describe alternatives you've considered
-
Use reclaimPolicy: Retain at StorageClass/PV level.
- This retains PV object semantics but does not provide CSI-level fine-grained delete behavior under
Delete policy path.
-
Manual out-of-band protection (scripts/runbooks to snapshot or recreate shares).
- Operationally complex, error-prone, and hard to standardize.
-
Admission/policy controls to block PVC/PV deletion in some namespaces.
- Helps reduce accidents but does not solve storage-driver-level lifecycle control.
Additional context
- Repository:
kubernetes-sigs/azurefile-csi-driver
- I can help validate behavior in AKS/Azure Kubernetes environments if a design/PR is proposed.
- If maintainers prefer a different parameter name/value convention, I’m happy to align and help test.
Is your feature request related to a problem?/Why is this needed
Yes.
In Azure File CSI driver, when a dynamically provisioned PV is deleted with
StorageClass.reclaimPolicy=Delete, users currently cannot configure a CSI-level deletion behavior (for example anonDelete-like policy used by some other NFS/SMB CSI drivers).As a result, there is no built-in way to keep the underlying Azure File share for data preservation scenarios while still using the
Deletereclaim workflow for Kubernetes resources.This is needed for:
Describe the solution you'd like in detail
Add support for a StorageClass parameter (name can follow project conventions, e.g.
onDelete) to control backend share behavior when PV deletion is triggered.Suggested behavior:
onDelete: delete(default, backward-compatible with current behavior)onDelete: retain(do not delete underlying Azure File share; only remove Kubernetes-side objects/attachments)Implementation direction (high-level):
DeleteVolumeflow, branch deletion logic based on this parameter.Describe alternatives you've considered
Use
reclaimPolicy: Retainat StorageClass/PV level.Deletepolicy path.Manual out-of-band protection (scripts/runbooks to snapshot or recreate shares).
Admission/policy controls to block PVC/PV deletion in some namespaces.
Additional context
kubernetes-sigs/azurefile-csi-driver