Skip to content

Commit

Permalink
manage ovn bfd with libovsdb (#2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian authored May 25, 2023
1 parent d9a038c commit a94fb0b
Show file tree
Hide file tree
Showing 12 changed files with 472 additions and 173 deletions.
173 changes: 141 additions & 32 deletions mocks/pkg/ovs/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ func (c *Controller) reconcileVpcUseBfdStaticRoute(vpcName, subnetName string) e
klog.Error(err)
return err
}
bfdId, err := c.ovnLegacyClient.CreateBfd(lrpEipName, eip.Status.V4Ip, c.config.BfdMinTx, c.config.BfdMinRx, c.config.BfdDetectMult)
bfd, err := c.ovnClient.CreateBFD(lrpEipName, eip.Status.V4Ip, c.config.BfdMinRx, c.config.BfdMinTx, c.config.BfdDetectMult)
if err != nil {
klog.Error(err)
return err
Expand All @@ -1161,7 +1161,7 @@ func (c *Controller) reconcileVpcUseBfdStaticRoute(vpcName, subnetName string) e
CIDR: subnet.Spec.CIDRBlock,
NextHopIP: eip.Status.V4Ip,
ECMPMode: util.StaicRouteBfdEcmp,
BfdId: bfdId,
BfdId: bfd.UUID,
RouteTable: subnet.Spec.RouteTable,
}
klog.V(3).Infof("add ecmp bfd static route %v", route)
Expand Down Expand Up @@ -2495,10 +2495,9 @@ func (c *Controller) reconcileRouteTableForSubnet(subnet *kubeovnv1.Subnet) erro
return nil
}

if err := c.ovnLegacyClient.UpdateRouterPortRouteTable(
subnet.Name, subnet.Spec.Vpc, subnet.Spec.RouteTable); err != nil {
klog.Errorf("failed to update route table %s for router port %s-%s, %v",
subnet.Spec.RouteTable, subnet.Spec.Vpc, subnet.Name, err)
opt := map[string]string{"route_table": subnet.Spec.RouteTable}
if err = c.ovnClient.UpdateLogicalRouterPortOptions(routerPortName, opt); err != nil {
klog.Errorf("failed to set route table of logical router port %s to %s: %v", routerPortName, subnet.Spec.RouteTable, err)
return err
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Controller) handleDelVpc(vpc *kubeovnv1.Vpc) error {
}
if vpc.Spec.EnableBfd || vpc.Status.EnableBfd {
lrpEipName := fmt.Sprintf("%s-%s", vpc.Name, c.config.ExternalGatewaySwitch)
if err := c.ovnLegacyClient.DeleteBfd(lrpEipName, ""); err != nil {
if err := c.ovnClient.DeleteBFD(lrpEipName, ""); err != nil {
klog.Error(err)
return err
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func (c *Controller) handleAddOrUpdateVpc(key string) error {

if !cachedVpc.Spec.EnableBfd && cachedVpc.Status.EnableBfd {
lrpEipName := fmt.Sprintf("%s-%s", key, c.config.ExternalGatewaySwitch)
if err := c.ovnLegacyClient.DeleteBfd(lrpEipName, ""); err != nil {
if err := c.ovnClient.DeleteBFD(lrpEipName, ""); err != nil {
klog.Error(err)
return err
}
Expand Down Expand Up @@ -924,7 +924,7 @@ func (c *Controller) handleDelVpcExternal(key string) error {
}

// del all vpc bfds
if err := c.ovnLegacyClient.DeleteBfd(lrpName, ""); err != nil {
if err := c.ovnClient.DeleteBFD(lrpName, ""); err != nil {
klog.Error(err)
return err
}
Expand Down
Loading

0 comments on commit a94fb0b

Please sign in to comment.