Skip to content

Commit cc7257b

Browse files
committed
Kubenet can't fail fast on teardown
1 parent c1e3d37 commit cc7257b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pkg/kubelet/dockershim/network/kubenet/kubenet_linux.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,20 +512,23 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
512512
// Loopback network deletion failure should not be fatal on teardown
513513
if err := plugin.delContainerFromNetwork(plugin.loConfig, "lo", namespace, name, id); err != nil {
514514
klog.Warningf("Failed to delete loopback network: %v", err)
515-
}
515+
errList = append(errList, err)
516516

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
522517
}
523518

524519
// no ip dependent actions
525520
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)
526522
errList = append(errList, err)
527523
}
528524

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+
529532
// get the list of port mappings
530533
portMappings, err := plugin.host.GetPodPortMappings(id.ID)
531534
if err != nil {

0 commit comments

Comments
 (0)