Skip to content

Commit

Permalink
we should first see if a condition is not going to be met
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyd1988 committed Jan 19, 2022
1 parent cb9e475 commit f40e26a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,9 @@ func (c *Controller) deleteEcmpRouteForNode(subnet *kubeovnv1.Subnet) error {
continue
}

if subnet.Status.ActivateGateway != "" && subnet.Status.ActivateGateway == gw {
continue
}
ipStr := node.Annotations[util.IpAddressAnnotation]
for _, ip := range strings.Split(ipStr, ",") {
var cidrBlock string
Expand All @@ -1382,10 +1385,6 @@ func (c *Controller) deleteEcmpRouteForNode(subnet *kubeovnv1.Subnet) error {
}

if exist {
if subnet.Status.ActivateGateway != "" && subnet.Status.ActivateGateway == gw {
continue
}

klog.Infof("subnet %v changed to active-standby mode, delete ecmp route for node %s, ip %v", subnet.Name, node.Name, ip)
if err := c.ovnClient.DeleteMatchedStaticRoute(cidrBlock, ip, c.config.ClusterRouter); err != nil {
klog.Errorf("failed to delete static route %s for node %s, %v", ip, node.Name, err)
Expand Down

0 comments on commit f40e26a

Please sign in to comment.