@@ -42,7 +42,6 @@ import (
4242 "antrea.io/antrea/pkg/ovs/ovsconfig"
4343 utilip "antrea.io/antrea/pkg/util/ip"
4444 "antrea.io/antrea/pkg/util/k8s"
45- "antrea.io/antrea/pkg/util/runtime"
4645)
4746
4847const (
@@ -72,7 +71,6 @@ type Controller struct {
7271 nodeInformer coreinformers.NodeInformer
7372 nodeLister corelisters.NodeLister
7473 nodeListerSynced cache.InformerSynced
75- svcLister corelisters.ServiceLister
7674 queue workqueue.RateLimitingInterface
7775 // installedNodes records routes and flows installation states of Nodes.
7876 // The key is the host name of the Node, the value is the nodeRouteInfo of the Node.
@@ -102,7 +100,6 @@ func NewNodeRouteController(
102100 ipsecCertificateManager ipseccertificate.Manager ,
103101) * Controller {
104102 nodeInformer := informerFactory .Core ().V1 ().Nodes ()
105- svcLister := informerFactory .Core ().V1 ().Services ()
106103 controller := & Controller {
107104 kubeClient : kubeClient ,
108105 ovsBridgeClient : ovsBridgeClient ,
@@ -114,7 +111,6 @@ func NewNodeRouteController(
114111 nodeInformer : nodeInformer ,
115112 nodeLister : nodeInformer .Lister (),
116113 nodeListerSynced : nodeInformer .Informer ().HasSynced ,
117- svcLister : svcLister .Lister (),
118114 queue : workqueue .NewNamedRateLimitingQueue (workqueue .NewItemExponentialFailureRateLimiter (minRetryDelay , maxRetryDelay ), "noderoute" ),
119115 installedNodes : cache .NewIndexer (nodeRouteInfoKeyFunc , cache.Indexers {nodeRouteInfoPodCIDRIndexName : nodeRouteInfoPodCIDRIndexFunc }),
120116 wireGuardClient : wireguardClient ,
@@ -203,27 +199,10 @@ func (c *Controller) removeStaleGatewayRoutes() error {
203199 desiredPodCIDRs = append (desiredPodCIDRs , podCIDRs ... )
204200 }
205201
206- // TODO: This is not the best place to keep the ClusterIP Service routes.
207- desiredClusterIPSvcIPs := map [string ]bool {}
208- if c .proxyAll && runtime .IsWindowsPlatform () {
209- // The route for virtual IP -> antrea-gw0 should be always kept.
210- desiredClusterIPSvcIPs [config .VirtualServiceIPv4 .String ()] = true
211-
212- svcs , err := c .svcLister .List (labels .Everything ())
213- for _ , svc := range svcs {
214- for _ , ip := range svc .Spec .ClusterIPs {
215- desiredClusterIPSvcIPs [ip ] = true
216- }
217- }
218- if err != nil {
219- return fmt .Errorf ("error when listing ClusterIP Service IPs: %v" , err )
220- }
221- }
222-
223202 // routeClient will remove orphaned routes whose destinations are not in desiredPodCIDRs.
224203 // If proxyAll enabled, it will also remove routes that are for Windows ClusterIP Services
225- // which no longer exist .
226- if err := c .routeClient .Reconcile (desiredPodCIDRs , desiredClusterIPSvcIPs ); err != nil {
204+ // which no longer exists .
205+ if err := c .routeClient .Reconcile (desiredPodCIDRs ); err != nil {
227206 return err
228207 }
229208 return nil
0 commit comments