Skip to content

Commit

Permalink
Merge pull request #180 from cyclinder/cmddel
Browse files Browse the repository at this point in the history
cmdDel: ignore pod'ns has gone
  • Loading branch information
cyclinder authored Jul 7, 2023
2 parents 00af686 + 876756e commit d2c0dcb
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
}
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 {
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 d2c0dcb

Please sign in to comment.