Skip to content
Merged
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
20 changes: 12 additions & 8 deletions cni/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,12 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
// Query the network.
if nwInfo, err = plugin.nm.GetNetworkInfo(networkId); err != nil {

// attempt to release address associated with this Endpoint id
// This is to ensure clean up is done even in failure cases
if err = plugin.DelegateDel(nwCfg.Ipam.Type, nwCfg); err != nil {
log.Printf("Network not found, attempted to release address with error: %v", err)
if !nwCfg.MultiTenancy {
// attempt to release address associated with this Endpoint id
// This is to ensure clean up is done even in failure cases
if err = plugin.DelegateDel(nwCfg.Ipam.Type, nwCfg); err != nil {
log.Printf("Network not found, attempted to release address with error: %v", err)
}
}

// Log the error but return success if the endpoint being deleted is not found.
Expand All @@ -820,10 +822,12 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
// Query the endpoint.
if epInfo, err = plugin.nm.GetEndpointInfo(networkId, endpointId); err != nil {

// attempt to release address associated with this Endpoint id
// This is to ensure clean up is done even in failure cases
if err = plugin.DelegateDel(nwCfg.Ipam.Type, nwCfg); err != nil {
log.Printf("Endpoint not found, attempted to release address with error: %v", err)
if !nwCfg.MultiTenancy {
// attempt to release address associated with this Endpoint id
// This is to ensure clean up is done even in failure cases
if err = plugin.DelegateDel(nwCfg.Ipam.Type, nwCfg); err != nil {
log.Printf("Endpoint not found, attempted to release address with error: %v", err)
}
}

// Log the error but return success if the endpoint being deleted is not found.
Expand Down