Skip to content

Commit

Permalink
Fix that Service routes may get lost when starting on Windows
Browse files Browse the repository at this point in the history
Fix antrea-io#4467

Signed-off-by: Hongliang Liu <lhongliang@vmware.com>
  • Loading branch information
hongliangl committed Dec 13, 2022
1 parent b503a46 commit 27f4914
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/agent/route/route_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"net"
"strings"
"sync"

"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -133,6 +134,8 @@ func (c *Client) Reconcile(podCIDRs []string, svcIPs map[string]bool) error {
c.hostRoutes.Store(dst, rt)
continue
}
// Remove suffix since svcIP in svcIPs doesn't have a suffix.
dst = strings.Split(dst, "/")[0]
if _, ok := svcIPs[dst]; ok {
c.hostRoutes.Store(dst, rt)
continue
Expand Down Expand Up @@ -288,7 +291,7 @@ func (c *Client) addServiceRoute(svcIP net.IP) error {
return err
}

c.hostRoutes.Store(route.DestinationSubnet.String(), route)
c.hostRoutes.Store(svcIP.String(), route)
klog.V(2).InfoS("Added Service route", "ServiceIP", route.DestinationSubnet, "GatewayIP", route.GatewayAddress)
return nil
}
Expand Down

0 comments on commit 27f4914

Please sign in to comment.