@@ -13,7 +13,7 @@ import (
13
13
"google.golang.org/grpc/codes"
14
14
"google.golang.org/grpc/status"
15
15
kubeAPI "k8s.io/api/core/v1"
16
- "k8s.io/apimachinery/pkg/api/errors"
16
+ errors "k8s.io/apimachinery/pkg/api/errors"
17
17
18
18
"github.com/oracle/oci-cloud-controller-manager/pkg/metrics"
19
19
"github.com/oracle/oci-cloud-controller-manager/pkg/oci/client"
@@ -399,9 +399,15 @@ func (d *ControllerDriver) ControllerUnpublishVolume(ctx context.Context, req *c
399
399
400
400
compartmentID , err := util .LookupNodeCompartment (d .KubeClient , req .NodeId )
401
401
if err != nil {
402
+ if errors .IsNotFound (err ) {
403
+ log .Infof ("Node with nodeID %s is not found, volume is likely already detached" , req .NodeId )
404
+ // https://jira.oci.oraclecorp.com/browse/OKE-13873 : Cleanup of dangling volumeAttachments is deferred.
405
+ metrics .SendMetricData (d .metricPusher , metrics .PVDetachSuccess , time .Since (startTime ).Seconds (), csiDriver , req .VolumeId )
406
+ return & csi.ControllerUnpublishVolumeResponse {}, nil
407
+ }
402
408
log .With (zap .Error (err )).Errorf ("failed to get compartmentID from node annotation: %s" , util .CompartmentIDAnnotation )
403
409
metrics .SendMetricData (d .metricPusher , metrics .PVDetachFailure , time .Since (startTime ).Seconds (), csiDriver , req .VolumeId )
404
- return nil , status .Errorf (codes .Unknown , "failed to get compartmentID from node annotation:. error : %s" , err )
410
+ return nil , status .Errorf (codes .Unknown , "failed to get compartmentID from node annotation:: error : %s" , err )
405
411
}
406
412
407
413
attachedVolume , err := d .client .Compute ().FindVolumeAttachment (context .Background (), compartmentID , req .VolumeId )
0 commit comments