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"
@@ -131,6 +132,11 @@ func (n *nodeService) NodeUnpublishVolume(ctx context.Context, request *csi.Node
vol, err := n.p5x.GetVolumeByName(request.GetVolumeId())
if err != nil {
if errors.Is(err, ErrVolumeNotFound) {
klog.Infof("node.NodeUnpublishVolume: Could not find volume %s - assuming it has already been deleted", request.GetVolumeId())
return &csi.NodeUnpublishVolumeResponse{}, nil
}
return nil, err
}