@@ -1085,6 +1085,11 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
10851085 logger .Error ("Get Endpoint State API returned error" , zap .String ("containerID" , args .ContainerID ), zap .Error (err ))
10861086 return plugin .RetriableError (fmt .Errorf ("failed to delete endpoint: %w" , err ))
10871087 }
1088+ } else {
1089+ for i , epInfo := range epInfos {
1090+ logger .Info ("Found endpoint to delete" , zap .String ("IfName" , epInfo .IfName ), zap .String ("EndpointID" , epInfo .EndpointID ), zap .Any ("NICType" , epInfo .NICType ))
1091+ epInfos [i ].NetNsPath = args .Netns // in case DelegatedNIC need to be moved to host namespace
1092+ }
10881093 }
10891094 } else {
10901095 epInfos = plugin .nm .GetEndpointInfosFromContainerID (args .ContainerID )
@@ -1101,16 +1106,8 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error {
11011106
11021107 logger .Warn ("Release ip by ContainerID (endpoint not found)" ,
11031108 zap .String ("containerID" , args .ContainerID ))
1104- if plugin .nm .IsStatelessCNIMode () {
1105- options := make (map [string ]interface {})
1106- options ["asyncDeleteFileID" ] = args .ContainerID
1107- if err = plugin .ipamInvoker .Delete (nil , nwCfg , args , options ); err != nil {
1108- return plugin .RetriableError (fmt .Errorf ("failed to release address(no endpoint): %w" , err ))
1109- }
1110- } else {
1111- if err = plugin .ipamInvoker .Delete (nil , nwCfg , args , nwInfo .Options ); err != nil {
1112- return plugin .RetriableError (fmt .Errorf ("failed to release address(no endpoint): %w" , err ))
1113- }
1109+ if err = plugin .ipamInvoker .Delete (nil , nwCfg , args , nwInfo .Options ); err != nil {
1110+ return plugin .RetriableError (fmt .Errorf ("failed to release address(no endpoint): %w" , err ))
11141111 }
11151112 }
11161113 // Log the error but return success if the endpoint being deleted is not found.
0 commit comments