diff --git a/plugins/main/bridge/bridge.go b/plugins/main/bridge/bridge.go index dbce4244..ebb58982 100644 --- a/plugins/main/bridge/bridge.go +++ b/plugins/main/bridge/bridge.go @@ -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 } diff --git a/plugins/main/ipvlan/ipvlan.go b/plugins/main/ipvlan/ipvlan.go index 06b5117d..667395b7 100644 --- a/plugins/main/ipvlan/ipvlan.go +++ b/plugins/main/ipvlan/ipvlan.go @@ -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 } diff --git a/plugins/main/loopback/loopback.go b/plugins/main/loopback/loopback.go index 2c003af9..cae4aa4c 100644 --- a/plugins/main/loopback/loopback.go +++ b/plugins/main/loopback/loopback.go @@ -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 diff --git a/plugins/main/macvlan/macvlan.go b/plugins/main/macvlan/macvlan.go index 99044a33..16d250eb 100644 --- a/plugins/main/macvlan/macvlan.go +++ b/plugins/main/macvlan/macvlan.go @@ -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 } diff --git a/plugins/main/ptp/ptp.go b/plugins/main/ptp/ptp.go index 6eb121e1..31974b75 100644 --- a/plugins/main/ptp/ptp.go +++ b/plugins/main/ptp/ptp.go @@ -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 } diff --git a/plugins/main/vlan/vlan.go b/plugins/main/vlan/vlan.go index 99b3b3d7..98f273eb 100644 --- a/plugins/main/vlan/vlan.go +++ b/plugins/main/vlan/vlan.go @@ -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 } diff --git a/plugins/meta/vrf/main.go b/plugins/meta/vrf/main.go index 0a1de8e7..e69abac7 100644 --- a/plugins/meta/vrf/main.go +++ b/plugins/meta/vrf/main.go @@ -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) }