@@ -512,20 +512,23 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
512
512
// Loopback network deletion failure should not be fatal on teardown
513
513
if err := plugin .delContainerFromNetwork (plugin .loConfig , "lo" , namespace , name , id ); err != nil {
514
514
klog .Warningf ("Failed to delete loopback network: %v" , err )
515
- }
515
+ errList = append ( errList , err )
516
516
517
- // fail fast if there is no IP registered
518
- iplist , exists := plugin .getCachedPodIPs (id )
519
- if ! exists || len (iplist ) == 0 {
520
- klog .V (5 ).Infof ("container %s (%s/%s) does not have recorded. ignoring teardown call" , id , name , namespace )
521
- return nil
522
517
}
523
518
524
519
// no ip dependent actions
525
520
if err := plugin .delContainerFromNetwork (plugin .netConfig , network .DefaultInterfaceName , namespace , name , id ); err != nil {
521
+ klog .Warningf ("Failed to delete %q network: %v" , network .DefaultInterfaceName , err )
526
522
errList = append (errList , err )
527
523
}
528
524
525
+ // If there are no IPs registered we can't teardown pod's IP dependencies
526
+ iplist , exists := plugin .getCachedPodIPs (id )
527
+ if ! exists || len (iplist ) == 0 {
528
+ klog .V (5 ).Infof ("container %s (%s/%s) does not have recorded. ignoring teardown call" , id , name , namespace )
529
+ return nil
530
+ }
531
+
529
532
// get the list of port mappings
530
533
portMappings , err := plugin .host .GetPodPortMappings (id .ID )
531
534
if err != nil {
0 commit comments