diff --git a/.changelog/12350.txt b/.changelog/12350.txt new file mode 100644 index 000000000000..a70ffae56a25 --- /dev/null +++ b/.changelog/12350.txt @@ -0,0 +1,3 @@ +```release-note:bug +csi: Fixed a bug where garbage collected nodes would block releasing a volume +``` diff --git a/nomad/csi_endpoint.go b/nomad/csi_endpoint.go index e46351bbfa08..add9c3cd8b80 100644 --- a/nomad/csi_endpoint.go +++ b/nomad/csi_endpoint.go @@ -1,9 +1,9 @@ package nomad import ( - "errors" "fmt" "net/http" + "strings" "time" metrics "github.com/armon/go-metrics" @@ -741,7 +741,9 @@ func (v *CSIVolume) nodeUnpublishVolumeImpl(vol *structs.CSIVolume, claim *struc // we should only get this error if the Nomad node disconnects and // is garbage-collected, so at this point we don't have any reason // to operate as though the volume is attached to it. - if !errors.Is(err, structs.ErrUnknownNode) { + // note: errors.Is cannot be used because the RPC call breaks + // error wrapping. + if !strings.Contains(err.Error(), structs.ErrUnknownNode.Error()) { return fmt.Errorf("could not detach from node: %w", err) } }