Make testing example more complex; improve handling for NodeUnpublishVolume/ControllerUnpublishVolume for volumes that were externally deleted

This commit is contained in:
2024-10-02 00:05:26 -04:00
parent beee5a441d
commit 96956ba7ff
4 changed files with 76 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ package csi
import (
"context"
"errors"
"k8s.io/klog"
"github.com/container-storage-interface/spec/lib/go/csi"
@@ -90,6 +91,11 @@ func (d *controllerService) DeleteVolume(ctx context.Context, request *csi.Delet
vol, err := d.p5x.GetVolumeByName(request.GetVolumeId())
if err != nil {
if errors.Is(err, ErrVolumeNotFound) {
klog.Infof("controller.DeleteVolume: Could not find volume %s -- assuming it has already been deleted", request.GetVolumeId())
return &csi.DeleteVolumeResponse{}, nil
}
return nil, err
}