Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hongliangl committed Jun 21, 2022
1 parent 58c9cc3 commit 50c1db6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/route/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Interface interface {
// It should be idempotent and can be safely called on every startup.
Initialize(nodeConfig *config.NodeConfig, done func()) error

// Reconcile should remove orphaned routes and related configuration based on the desired podCIDRs and Service IPs.
// Reconcile should remove orphaned routes and related configuration based on the desired podCIDRs.
// If IPv6 is enabled in the cluster, Reconcile should also remove the orphaned IPv6 neighbors.
Reconcile(podCIDRs []string) error

Expand Down
10 changes: 2 additions & 8 deletions pkg/agent/route/route_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type Client struct {
nodeConfig *config.NodeConfig
networkConfig *config.NetworkConfig
nodeRoutes *sync.Map
serviceRoutes *sync.Map
fwClient *winfirewall.Client
bridgeInfIndex int
noSNAT bool
Expand All @@ -66,7 +65,6 @@ func NewClient(networkConfig *config.NetworkConfig, noSNAT, proxyAll, connectUpl
return &Client{
networkConfig: networkConfig,
nodeRoutes: &sync.Map{},
serviceRoutes: &sync.Map{},
fwClient: winfirewall.NewClient(),
noSNAT: noSNAT,
proxyAll: proxyAll,
Expand Down Expand Up @@ -232,7 +230,6 @@ func (c *Client) addVirtualServiceIPRoute(isIPv6 bool) error {
if err := util.ReplaceNetRoute(route); err != nil {
return fmt.Errorf("failed to install route for virtual Service IP %s: %w", svcIP.String(), err)
}
c.serviceRoutes.Store(svcIP.String(), route)
klog.InfoS("Added virtual Service IP route", "route", route)

return nil
Expand Down Expand Up @@ -321,7 +318,6 @@ func (c *Client) addVirtualNodePortDNATIPRoute(isIPv6 bool) error {
if err := util.ReplaceNetRoute(route); err != nil {
return fmt.Errorf("failed to install route for virtual Service IP %s: %w", vIP.String(), err)
}
c.serviceRoutes.Store(vIP.String(), route)
klog.InfoS("Added virtual Service IP route", "route", route)

// For NodePort Service, a new NetNat for NetNatStaticMapping is needed.
Expand All @@ -347,8 +343,8 @@ func (c *Client) Run(stopCh <-chan struct{}) {
}

func (c *Client) isServiceRoute(route *util.Route) bool {
// If the destination IP or gateway IP is virtual Service IP , then it is a route which is added by AntreaProxy.
if route.DestinationSubnet.IP.Equal(config.VirtualServiceIPv4) || route.GatewayAddress.Equal(config.VirtualServiceIPv4) {
// If the gateway IP is the virtual Service IP , then it is a route which is added by AntreaProxy.
if route.GatewayAddress.Equal(config.VirtualServiceIPv4) {
return true
}
return false
Expand Down Expand Up @@ -429,7 +425,6 @@ func (c *Client) addLoadBalancerIngressIPRoute(svcIPStr string) error {
return fmt.Errorf("failed to install routing entry for LoadBalancer ingress IP %s: %w", svcIPStr, err)
}
klog.V(4).InfoS("Added LoadBalancer ingress IP route", "route", route)
c.serviceRoutes.Store(svcIPStr, route)

return nil
}
Expand All @@ -451,7 +446,6 @@ func (c *Client) deleteLoadBalancerIngressIPRoute(svcIPStr string) error {
}
}
klog.V(4).InfoS("Uninstalled stale ClusterIP route successfully", "stale route", route)
c.serviceRoutes.Delete(svcIPStr)

return nil
}
Expand Down

0 comments on commit 50c1db6

Please sign in to comment.