mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 13:42:02 +00:00
Kubenet can't fail fast on teardown
This commit is contained in:
@@ -512,20 +512,23 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
|
|||||||
// Loopback network deletion failure should not be fatal on teardown
|
// Loopback network deletion failure should not be fatal on teardown
|
||||||
if err := plugin.delContainerFromNetwork(plugin.loConfig, "lo", namespace, name, id); err != nil {
|
if err := plugin.delContainerFromNetwork(plugin.loConfig, "lo", namespace, name, id); err != nil {
|
||||||
klog.Warningf("Failed to delete loopback network: %v", err)
|
klog.Warningf("Failed to delete loopback network: %v", err)
|
||||||
}
|
errList = append(errList, err)
|
||||||
|
|
||||||
// fail fast if there is no IP registered
|
|
||||||
iplist, exists := plugin.getCachedPodIPs(id)
|
|
||||||
if !exists || len(iplist) == 0 {
|
|
||||||
klog.V(5).Infof("container %s (%s/%s) does not have recorded. ignoring teardown call", id, name, namespace)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no ip dependent actions
|
// no ip dependent actions
|
||||||
if err := plugin.delContainerFromNetwork(plugin.netConfig, network.DefaultInterfaceName, namespace, name, id); err != nil {
|
if err := plugin.delContainerFromNetwork(plugin.netConfig, network.DefaultInterfaceName, namespace, name, id); err != nil {
|
||||||
|
klog.Warningf("Failed to delete %q network: %v", network.DefaultInterfaceName, err)
|
||||||
errList = append(errList, err)
|
errList = append(errList, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there are no IPs registered we can't teardown pod's IP dependencies
|
||||||
|
iplist, exists := plugin.getCachedPodIPs(id)
|
||||||
|
if !exists || len(iplist) == 0 {
|
||||||
|
klog.V(5).Infof("container %s (%s/%s) does not have recorded. ignoring teardown call", id, name, namespace)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// get the list of port mappings
|
// get the list of port mappings
|
||||||
portMappings, err := plugin.host.GetPodPortMappings(id.ID)
|
portMappings, err := plugin.host.GetPodPortMappings(id.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user