Merge pull request #221 from forselli-stratio/fix-delete

Fix onDelete option for subdirectories
This commit is contained in:
Kubernetes Prow Robot 2022-11-24 05:42:05 -08:00 committed by GitHub
commit 4c82f69eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume) error { func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume) error {
path := volume.Spec.PersistentVolumeSource.NFS.Path path := volume.Spec.PersistentVolumeSource.NFS.Path
basePath := filepath.Base(path) basePath := filepath.Base(path)
oldPath := filepath.Join(mountPath, basePath) oldPath := strings.Replace(path, p.path, mountPath, 1)
if _, err := os.Stat(oldPath); os.IsNotExist(err) { if _, err := os.Stat(oldPath); os.IsNotExist(err) {
glog.Warningf("path %s does not exist, deletion skipped", oldPath) glog.Warningf("path %s does not exist, deletion skipped", oldPath)