diff --git a/charts/v1.15.0/csi-driver-smb-v1.15.0.tgz b/charts/v1.15.0/csi-driver-smb-v1.15.0.tgz index 80c35546d50..da32c96bc81 100644 Binary files a/charts/v1.15.0/csi-driver-smb-v1.15.0.tgz and b/charts/v1.15.0/csi-driver-smb-v1.15.0.tgz differ diff --git a/charts/v1.15.0/csi-driver-smb/values.yaml b/charts/v1.15.0/csi-driver-smb/values.yaml index ec54e15180f..1b979f06069 100644 --- a/charts/v1.15.0/csi-driver-smb/values.yaml +++ b/charts/v1.15.0/csi-driver-smb/values.yaml @@ -6,7 +6,7 @@ image: pullPolicy: IfNotPresent csiProvisioner: repository: /csi-provisioner - tag: v5.0.1 + tag: v5.0.2 pullPolicy: IfNotPresent livenessProbe: repository: /livenessprobe diff --git a/cmd/smbplugin/main.go b/cmd/smbplugin/main.go index 3562a653832..50a75a9f48f 100644 --- a/cmd/smbplugin/main.go +++ b/cmd/smbplugin/main.go @@ -48,6 +48,7 @@ var ( krb5CacheDirectory = flag.String("krb5-cache-directory", smb.DefaultKrb5CacheDirectory, "The directory for kerberos cache") krb5Prefix = flag.String("krb5-prefix", smb.DefaultKrb5CCName, "The prefix for kerberos cache") defaultOnDeletePolicy = flag.String("default-ondelete-policy", "", "default policy for deleting subdirectory when deleting a volume") + removeArchivedVolumePath = flag.Bool("remove-archived-volume-path", true, "remove archived volume path in DeleteVolume") ) func main() { @@ -75,6 +76,7 @@ func handle() { DriverName: *driverName, EnableGetVolumeStats: *enableGetVolumeStats, RemoveSMBMappingDuringUnmount: *removeSMBMappingDuringUnmount, + RemoveArchivedVolumePath: *removeArchivedVolumePath, WorkingMountDir: *workingMountDir, VolStatsCacheExpireInMinutes: *volStatsCacheExpireInMinutes, Krb5CacheDirectory: *krb5CacheDirectory, diff --git a/deploy/v1.15.0/csi-smb-controller.yaml b/deploy/v1.15.0/csi-smb-controller.yaml index 1179dd53780..4a1b7ae8b97 100644 --- a/deploy/v1.15.0/csi-smb-controller.yaml +++ b/deploy/v1.15.0/csi-smb-controller.yaml @@ -35,7 +35,7 @@ spec: effect: "NoSchedule" containers: - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.1 + image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.2 args: - "-v=2" - "--csi-address=$(ADDRESS)" diff --git a/pkg/smb/controllerserver.go b/pkg/smb/controllerserver.go index 0786b0d547e..9f9eb6a9cd5 100644 --- a/pkg/smb/controllerserver.go +++ b/pkg/smb/controllerserver.go @@ -191,8 +191,12 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) // archive subdirectory under base-dir. Remove stale archived copy if exists. klog.V(2).Infof("archiving subdirectory %s --> %s", internalVolumePath, archivedInternalVolumePath) - if err = os.RemoveAll(archivedInternalVolumePath); err != nil { - return nil, status.Errorf(codes.Internal, "failed to delete archived subdirectory %s: %v", archivedInternalVolumePath, err.Error()) + if d.removeArchivedVolumePath { + klog.V(2).Infof("removing archived subdirectory at %v", archivedInternalVolumePath) + if err = os.RemoveAll(archivedInternalVolumePath); err != nil { + return nil, status.Errorf(codes.Internal, "failed to delete archived subdirectory %s: %v", archivedInternalVolumePath, err.Error()) + } + klog.V(2).Infof("removed archived subdirectory at %v", archivedInternalVolumePath) } if err = os.Rename(internalVolumePath, archivedInternalVolumePath); err != nil { return nil, status.Errorf(codes.Internal, "archive subdirectory(%s, %s) failed with %v", internalVolumePath, archivedInternalVolumePath, err.Error()) diff --git a/pkg/smb/smb.go b/pkg/smb/smb.go index e2550befe38..d98de18dae2 100644 --- a/pkg/smb/smb.go +++ b/pkg/smb/smb.go @@ -68,6 +68,7 @@ type DriverOptions struct { Krb5CacheDirectory string Krb5Prefix string DefaultOnDeletePolicy string + RemoveArchivedVolumePath bool } // Driver implements all interfaces of CSI drivers @@ -86,6 +87,7 @@ type Driver struct { krb5CacheDirectory string krb5Prefix string defaultOnDeletePolicy string + removeArchivedVolumePath bool } // NewDriver Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & @@ -97,6 +99,7 @@ func NewDriver(options *DriverOptions) *Driver { driver.NodeID = options.NodeID driver.enableGetVolumeStats = options.EnableGetVolumeStats driver.removeSMBMappingDuringUnmount = options.RemoveSMBMappingDuringUnmount + driver.removeArchivedVolumePath = options.RemoveArchivedVolumePath driver.workingMountDir = options.WorkingMountDir driver.volumeLocks = newVolumeLocks()