Skip to content

Commit 5153394

Browse files
committed
add case for delete when there is a 404
1 parent e5efd11 commit 5153394

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/controller/direct/logging/link_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ func (a *LoggingLinkAdapter) Delete(ctx context.Context, deleteOp *directbase.De
248248
req := &loggingpb.DeleteLinkRequest{Name: a.id.String()}
249249
op, err := a.gcpClient.DeleteLink(ctx, req)
250250
if err != nil {
251+
if direct.IsNotFound(err) {
252+
// Return success if not found (assume it was already deleted).
253+
log.V(2).Info("skipping delete for non-existent LoggingLink, assuming it was already deleted", "name", a.id.String())
254+
return true, nil
255+
}
251256
return false, fmt.Errorf("deleting Link %s: %w", a.id, err)
252257
}
253258
log.V(2).Info("successfully deleted Link", "name", a.id)

0 commit comments

Comments
 (0)