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 pullPolicy: IfNotPresent
csiProvisioner: csiProvisioner:
repository: registry.k8s.io/sig-storage/csi-provisioner repository: registry.k8s.io/sig-storage/csi-provisioner
tag: v5.0.1 tag: v5.0.2
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
csiSnapshotter: csiSnapshotter:
repository: registry.k8s.io/sig-storage/csi-snapshotter 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") 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") 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") 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() { func main() {
@ -56,6 +57,7 @@ func handle() {
WorkingMountDir: *workingMountDir, WorkingMountDir: *workingMountDir,
DefaultOnDeletePolicy: *defaultOnDeletePolicy, DefaultOnDeletePolicy: *defaultOnDeletePolicy,
VolStatsCacheExpireInMinutes: *volStatsCacheExpireInMinutes, VolStatsCacheExpireInMinutes: *volStatsCacheExpireInMinutes,
RemoveArchivedVolumePath: *removeArchivedVolumePath,
} }
d := nfs.NewDriver(&driverOptions) d := nfs.NewDriver(&driverOptions)
d.Run(false) d.Run(false)

View File

@ -35,7 +35,7 @@ spec:
effect: "NoSchedule" effect: "NoSchedule"
containers: containers:
- name: csi-provisioner - 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: args:
- "-v=2" - "-v=2"
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"

View File

@ -255,9 +255,13 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
// archive subdirectory under base-dir, remove stale archived copy if exists. // archive subdirectory under base-dir, remove stale archived copy if exists.
klog.V(2).Infof("archiving subdirectory %s --> %s", internalVolumePath, archivedInternalVolumePath) klog.V(2).Infof("archiving subdirectory %s --> %s", internalVolumePath, archivedInternalVolumePath)
if cs.Driver.removeArchivedVolumePath {
klog.V(2).Infof("removing archived subdirectory at %v", archivedInternalVolumePath)
if err = os.RemoveAll(archivedInternalVolumePath); err != nil { if err = os.RemoveAll(archivedInternalVolumePath); err != nil {
return nil, status.Errorf(codes.Internal, "failed to delete archived subdirectory %s: %v", archivedInternalVolumePath, err.Error()) 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 { 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()) return nil, status.Errorf(codes.Internal, "archive subdirectory(%s, %s) failed with %v", internalVolumePath, archivedInternalVolumePath, err.Error())
} }

View File

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