Skip to content

Commit

Permalink
Merge pull request #686 from silenceper/master
Browse files Browse the repository at this point in the history
Ignore NetNS path errors on delete
  • Loading branch information
matthewdupre authored Jan 19, 2022
2 parents 135eb1d + 67110e0 commit de5cffe
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 1 deletion.
7 changes: 7 additions & 0 deletions plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,13 @@ func cmdDel(args *skel.CmdArgs) error {
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

Expand Down
11 changes: 11 additions & 0 deletions plugins/main/ipvlan/ipvlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,17 @@ func cmdDel(args *skel.CmdArgs) error {
return nil
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

return err
}

Expand Down
9 changes: 8 additions & 1 deletion plugins/main/loopback/loopback.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ func cmdDel(args *skel.CmdArgs) error {
return nil
})
if err != nil {
return err // not tested
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

return nil
Expand Down
11 changes: 11 additions & 0 deletions plugins/main/macvlan/macvlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ func cmdDel(args *skel.CmdArgs) error {
return nil
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

return err
}

Expand Down
7 changes: 7 additions & 0 deletions plugins/main/ptp/ptp.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ func cmdDel(args *skel.CmdArgs) error {
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

Expand Down
11 changes: 11 additions & 0 deletions plugins/main/vlan/vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@ func cmdDel(args *skel.CmdArgs) error {
return err
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

return err
}

Expand Down
11 changes: 11 additions & 0 deletions plugins/meta/vrf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ func cmdDel(args *skel.CmdArgs) error {
return nil
})

if err != nil {
// if NetNs is passed down by the Cloud Orchestration Engine, or if it called multiple times
// so don't return an error if the device is already removed.
// https://github.com/kubernetes/kubernetes/issues/43014#issuecomment-287164444
_, ok := err.(ns.NSPathNotExistErr)
if ok {
return nil
}
return err
}

if err != nil {
return fmt.Errorf("cmdDel failed: %v", err)
}
Expand Down

0 comments on commit de5cffe

Please sign in to comment.