mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Skip legacy features (hostport, bwshaping)
This commit is contained in:
		@@ -334,6 +334,9 @@ func (plugin *kubenetNetworkPlugin) Capabilities() utilsets.Int {
 | 
			
		||||
	return utilsets.NewInt(network.NET_PLUGIN_CAPABILITY_SHAPING)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setup sets up networking through CNI using the given ns/name and sandbox ID.
 | 
			
		||||
// TODO: Don't pass the pod to this method, it only needs it for bandwidth
 | 
			
		||||
// shaping and hostport management.
 | 
			
		||||
func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kubecontainer.ContainerID, pod *api.Pod) error {
 | 
			
		||||
	// Bring up container loopback interface
 | 
			
		||||
	if _, err := plugin.addContainerToNetwork(plugin.loConfig, "lo", namespace, name, id); err != nil {
 | 
			
		||||
@@ -384,6 +387,14 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
 | 
			
		||||
		plugin.syncEbtablesDedupRules(macAddr)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	plugin.podIPs[id] = ip4.String()
 | 
			
		||||
 | 
			
		||||
	// The host can choose to not support "legacy" features. The remote
 | 
			
		||||
	// shim doesn't support it (#35457), but the kubelet does.
 | 
			
		||||
	if !plugin.host.SupportsLegacyFeatures() {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// The first SetUpPod call creates the bridge; get a shaper for the sake of
 | 
			
		||||
	// initialization
 | 
			
		||||
	shaper := plugin.shaper()
 | 
			
		||||
@@ -398,8 +409,6 @@ func (plugin *kubenetNetworkPlugin) setup(namespace string, name string, id kube
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	plugin.podIPs[id] = ip4.String()
 | 
			
		||||
 | 
			
		||||
	// Open any hostports the pod's containers want
 | 
			
		||||
	activePods, err := plugin.getActivePods()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -423,6 +432,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
 | 
			
		||||
		glog.V(4).Infof("SetUpPod took %v for %s/%s", time.Since(start), namespace, name)
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	// TODO: Entire pod object only required for bw shaping and hostport.
 | 
			
		||||
	pod, ok := plugin.host.GetPodByName(namespace, name)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return fmt.Errorf("pod %q cannot be found", name)
 | 
			
		||||
@@ -440,6 +450,11 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
 | 
			
		||||
			glog.V(4).Infof("Failed to clean up %s/%s after SetUpPod failure: %v", namespace, name, err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// TODO(#34278): Figure out if we need IP GC through the cri.
 | 
			
		||||
		// The cri should always send us teardown events for stale sandboxes,
 | 
			
		||||
		// this obviates the need for GC in the common case, for kubenet.
 | 
			
		||||
		if plugin.host.SupportsLegacyFeatures() {
 | 
			
		||||
 | 
			
		||||
			// TODO: Remove this hack once we've figured out how to retrieve the netns
 | 
			
		||||
			// of an exited container. Currently, restarting docker will leak a bunch of
 | 
			
		||||
			// ips. This will exhaust available ip space unless we cleanup old ips. At the
 | 
			
		||||
@@ -448,7 +463,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
 | 
			
		||||
			// GC on the assumption that the kubelet is going to retry pod creation, and
 | 
			
		||||
			// when it does, there will be ips.
 | 
			
		||||
			plugin.ipamGarbageCollection()
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -485,6 +500,12 @@ func (plugin *kubenetNetworkPlugin) teardown(namespace string, name string, id k
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// The host can choose to not support "legacy" features. The remote
 | 
			
		||||
	// shim doesn't support it (#35457), but the kubelet does.
 | 
			
		||||
	if !plugin.host.SupportsLegacyFeatures() {
 | 
			
		||||
		return utilerrors.NewAggregate(errList)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	activePods, err := plugin.getActivePods()
 | 
			
		||||
	if err == nil {
 | 
			
		||||
		err = plugin.hostportHandler.SyncHostports(BridgeName, activePods)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user