Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore NetNS path errors on delete #686

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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