Merge pull request #750 from andyzhangx/disable-archivedInternalVolumePath

fix: upgrade to csi-provisioner v5.0.2 on v4.8.0 chart
This commit is contained in:
Andy Zhang 2024-08-29 09:43:47 +08:00 committed by GitHub
commit d3d72c732c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 11 deletions

View File

@ -7,7 +7,7 @@ image:
pullPolicy: IfNotPresent
csiProvisioner:
repository: registry.k8s.io/sig-storage/csi-provisioner
tag: v5.0.1
tag: v5.0.2
pullPolicy: IfNotPresent
csiSnapshotter:
repository: registry.k8s.io/sig-storage/csi-snapshotter

View File

@ -33,6 +33,7 @@ var (
workingMountDir = flag.String("working-mount-dir", "/tmp", "working directory for provisioner to mount nfs shares temporarily")
defaultOnDeletePolicy = flag.String("default-ondelete-policy", "", "default policy for deleting subdirectory when deleting a volume")
volStatsCacheExpireInMinutes = flag.Int("vol-stats-cache-expire-in-minutes", 10, "The cache expire time in minutes for volume stats cache")
removeArchivedVolumePath = flag.Bool("remove-archived-volume-path", false, "remove archived volume path in DeleteVolume")
)
func main() {
@ -56,6 +57,7 @@ func handle() {
WorkingMountDir: *workingMountDir,
DefaultOnDeletePolicy: *defaultOnDeletePolicy,
VolStatsCacheExpireInMinutes: *volStatsCacheExpireInMinutes,
RemoveArchivedVolumePath: *removeArchivedVolumePath,
}
d := nfs.NewDriver(&driverOptions)
d.Run(false)

View File

@ -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)"

View File

@ -255,8 +255,12 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
// 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 cs.Driver.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())

View File

@ -37,16 +37,18 @@ type DriverOptions struct {
WorkingMountDir string
DefaultOnDeletePolicy string
VolStatsCacheExpireInMinutes int
RemoveArchivedVolumePath bool
}
type Driver struct {
name string
nodeID string
version string
endpoint string
mountPermissions uint64
workingMountDir string
defaultOnDeletePolicy string
name string
nodeID string
version string
endpoint string
mountPermissions uint64
workingMountDir string
defaultOnDeletePolicy string
removeArchivedVolumePath bool
//ids *identityServer
ns *NodeServer
@ -91,6 +93,7 @@ func NewDriver(options *DriverOptions) *Driver {
mountPermissions: options.MountPermissions,
workingMountDir: options.WorkingMountDir,
volStatsCacheExpireInMinutes: options.VolStatsCacheExpireInMinutes,
removeArchivedVolumePath: options.RemoveArchivedVolumePath,
}
n.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{