kubernetes-sigs / nfs-subdir-external-provisioner

Dynamic sub-dir volume provisioner on a remote NFS server.
Apache License 2.0
2.59k stars 760 forks source link

"onDelete: delete" doesn't work if "pathPattern" contains folders #347

Open uniit opened 3 months ago

uniit commented 3 months ago

Consider the following example:

➜  ~ helm list -n nfs
NAME                            NAMESPACE   REVISION    UPDATED                                     STATUS      CHART                                   APP VERSION
nfs-subdir-external-provisioner nfs         1           2024-07-24 17:17:58.678176273 +0200 +0200   deployed    nfs-subdir-external-provisioner-4.0.18  4.0.2

Storage Class yaml based on ReadMe:

allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs
parameters:
  onDelete: delete
  pathPattern: /application/dev/${.PVC.annotations.nfs.io/storage-path}
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner
reclaimPolicy: Delete

PVC yaml based on ReadMe:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    nfs.io/storage-path: app-data
  name: nfs
  namespace: nfs
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 5Gi
  storageClassName: nfs

After the PVC removal the nfs provisioner can't find the folder to delete:

W0804 10:43:33.486918       1 provisioner.go:146] path /persistentvolumes/app-data does not exist, deletion skipped

The only way to get OnDelete working is to not use the folder in the path. See an example here.

Question: Can you please fix that issue or add a note that "onDelete: delete" won't work if "pathPattern" contains folders?

k8s-triage-robot commented 2 weeks ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale