Skip to content

Commit

Permalink
remove: Continue on "not found" errors
Browse files Browse the repository at this point in the history
Some CNIs might return a "not found" error when removing an Endpoint / path,
which means that it was already removed. We can continue in this case; this
will mean that containerd will be able to forcefully remove Pods in this state.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
  • Loading branch information
claudiubelu committed Oct 5, 2021
1 parent fe8eec9 commit eff9f5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ func (c *libcni) Remove(ctx context.Context, id string, path string, opts ...Nam
// https://github.com/containernetworking/plugins/issues/210
// TODO(random-liu): Remove the error handling when the issue is
// fixed and the CNI spec v0.6.0 support is deprecated.
if path == "" && strings.Contains(err.Error(), "no such file or directory") {
// NOTE(claudiub): Some CNIs could return a "not found" error, which could mean that
// it was already deleted.
if (path == "" && strings.Contains(err.Error(), "no such file or directory")) || strings.Contains(err.Error(), "not found") {
continue
}
return err
Expand Down

0 comments on commit eff9f5b

Please sign in to comment.