Skip to content

Cleaningup empty parents resulted in all data being deleted #855

@adelmoradian

Description

@adelmoradian

What happened: if subDir is set to something like foo/${pvc.metadata.namespace}/${pvc.metadata.name}/ and if there are no more PVCs left in a given namespace, all data under /foo will be deleted.

What you expected to happen: This is arguably caused by bad config since something like subDir=${pvc.metadata.namespace}/${pvc.metadata.name}/ would prevent the issue. But still, would be nice to have this highlighted in the docs at least.

I think the issue is caused here specifically by getRootDir.

How to reproduce it:

  • Create a default storage class with subDir=foo/${pvc.metadata.namespace}/${pvc.metadata.name}
  • Create something with a PVC (a database for example) in two different namespaces
  • Deleting PVCs in one namespace should delete all data

Anything else we need to know?:

Environment:

  • CSI Driver version: 4.10
  • Kubernetes version (use kubectl version): v1.31.2+rke2r1
  • OS (e.g. from /etc/os-release): Ubuntu 24.04 LTS
  • Kernel (e.g. uname -a): 6.8.0-31-generic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions