kubernetes-csi / csi-driver-smb

This driver allows Kubernetes to access SMB Server on both Linux and Windows nodes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directory on share is not deleted after PV is removed

rabejens opened this issue · comments

What happened:

When deleting a PV provisioned with the CSI driver, the accompanying directory on the share still stays there, including all files and folders in it

What you expected to happen:

The directory should be deleted.

How to reproduce it:

Create a storageclass like this:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: deletion-bug
provisioner: smb.csi.k8s.io
parameters:
  source: "//your-server/your-share"
  csi.storage.k8s.io/provisioner-secret-name: "smbcreds"
  csi.storage.k8s.io/provisioner-secret-namespace: "somewhere"
  csi.storage.k8s.io/node-stage-secret-name: "smbcreds"
  csi.storage.k8s.io/node-stage-secret-namespace: "somewhere"
reclaimPolicy: Delete  # available values: Delete, Retain
volumeBindingMode: Immediate
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=1000
  - gid=1000

Apply it.

Then, create a PVC:

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: deletion-bug
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Gi
  storageClassName: deletion-bug

Take note of the name of the PV that is created.

Then, delete the PVC, and after the PV is gone, look in the share.

You will still see the directory there.

Anything else we need to know?:

Environment:

  • CSI Driver version: 1.12.0
  • Kubernetes version (use kubectl version): 1.25.6
  • OS, Kernel etc.: Windows Server 2022 Standard, Ubuntu 22.04.3 Kernel 5.15.0-82-generic

Actually, it just started working. I think it has to do with the share not having had SMB 3.0 enabled, which also caused shares to fail to mount on Windows.

After enabling SMB 3.0, they mount on Windows and now they are correctly deleted, too.