Skip to content

Commit

Permalink
cmdDel: ignore pod'ns has gone
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclinder committed Jul 7, 2023
1 parent f69ff27 commit 876756e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions plugins/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ func cmdDel(args *skel.CmdArgs) error {
logger.Debug("Start call CmdDel for Router-plugin", zap.Any("Config", *conf))
netns, err := ns.GetNS(args.Netns)
if err != nil {
if _, ok := err.(ns.NSPathNotExistErr); ok {
return nil
}

Check warning on line 262 in plugins/router/router.go

View check run for this annotation

Codecov / codecov/patch

plugins/router/router.go#L261-L262

Added lines #L261 - L262 were not covered by tests
logger.Error(err.Error())
return fmt.Errorf("failed to open netns %q: %v", args.Netns, err)
}
Expand Down
5 changes: 1 addition & 4 deletions plugins/veth/veth.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func cmdDel(args *skel.CmdArgs) error {
hostVeth := getHostVethName(args.ContainerID)
vethLink, err := netlink.LinkByName(hostVeth)
if err != nil {
if _, ok := err.(*netlink.LinkNotFoundError); ok {
if _, ok := err.(netlink.LinkNotFoundError); ok {

Check warning on line 278 in plugins/veth/veth.go

View check run for this annotation

Codecov / codecov/patch

plugins/veth/veth.go#L278

Added line #L278 was not covered by tests
logger.Debug("Host veth has gone, nothing to do", zap.String("HostVeth", hostVeth))
return nil
}
Expand All @@ -285,12 +285,9 @@ func cmdDel(args *skel.CmdArgs) error {
if err = netlink.LinkDel(vethLink); err != nil {
logger.Error("failed to del hostVeth", zap.Error(err))
return fmt.Errorf("failed to del hostVeth %s: %w", hostVeth, err)
} else {
logger.Error("success to del hostVeth", zap.String("HostVeth", hostVeth))
}

logger.Debug("Success to call veth cmdDel", zap.Any("config", conf))

return nil
}

Expand Down

0 comments on commit 876756e

Please sign in to comment.