Skip to content

Commit 7993e35

Browse files
VPC controller: add externalids with static routes across various locations
Signed-off-by: isabelleatkins <[email protected]>
1 parent e21146d commit 7993e35

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pkg/controller/vpc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,15 @@ func (c *Controller) handleAddOrUpdateVpc(key string) error {
480480
if item.BfdID != "" {
481481
klog.Infof("vpc %s add static ecmp route: %+v", vpc.Name, item)
482482
if err = c.OVNNbClient.AddLogicalRouterStaticRoute(
483-
vpc.Name, item.RouteTable, convertPolicy(item.Policy), item.CIDR, &item.BfdID, nil, item.NextHopIP,
483+
vpc.Name, item.RouteTable, convertPolicy(item.Policy), item.CIDR, &item.BfdID, externalIDs, item.NextHopIP,
484484
); err != nil {
485485
klog.Errorf("failed to add bfd static route to vpc %s , %v", vpc.Name, err)
486486
return err
487487
}
488488
} else {
489489
klog.Infof("vpc %s add static route: %+v", vpc.Name, item)
490490
if err = c.OVNNbClient.AddLogicalRouterStaticRoute(
491-
vpc.Name, item.RouteTable, convertPolicy(item.Policy), item.CIDR, nil, nil, item.NextHopIP,
491+
vpc.Name, item.RouteTable, convertPolicy(item.Policy), item.CIDR, nil, externalIDs, item.NextHopIP,
492492
); err != nil {
493493
klog.Errorf("failed to add normal static route to vpc %s , %v", vpc.Name, err)
494494
return err
@@ -961,7 +961,7 @@ func (c *Controller) addStaticRouteToVpc(name string, route *kubeovnv1.StaticRou
961961
} else {
962962
klog.Infof("vpc %s add static route: %+v", name, route)
963963
if err := c.OVNNbClient.AddLogicalRouterStaticRoute(
964-
name, route.RouteTable, convertPolicy(route.Policy), route.CIDR, nil, nil, route.NextHopIP,
964+
name, route.RouteTable, convertPolicy(route.Policy), route.CIDR, nil, externalIDs, route.NextHopIP,
965965
); err != nil {
966966
klog.Errorf("failed to add normal static route to vpc %s , %v", name, err)
967967
return err

pkg/controller/vpc_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ import (
77

88
"github.com/stretchr/testify/require"
99
"go.uber.org/mock/gomock"
10-
1110
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11+
"k8s.io/utils/keymutex"
1212

1313
kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
1414
"github.com/kubeovn/kube-ovn/pkg/ovsdb/ovnnb"
1515
"github.com/kubeovn/kube-ovn/pkg/util"
16-
"k8s.io/utils/keymutex"
1716
)
1817

1918
func Test_handleAddOrUpdateVpc_staticRoutes(t *testing.T) {
@@ -106,7 +105,7 @@ func Test_handleAddOrUpdateVpc_staticRoutes(t *testing.T) {
106105
"dst-ip",
107106
"192.168.0.0/24",
108107
nil,
109-
nil,
108+
externalIDs,
110109
"10.0.0.1",
111110
).Return(nil)
112111
mockOvnClient.EXPECT().ClearLogicalRouterPolicy(vpcName).Return(nil)
@@ -283,7 +282,7 @@ func Test_handleAddOrUpdateVpc_staticRoutes(t *testing.T) {
283282
"dst-ip",
284283
"192.168.0.0/24",
285284
nil,
286-
nil,
285+
externalIDs,
287286
"10.0.0.1",
288287
).Return(nil)
289288
mockOvnClient.EXPECT().ClearLogicalRouterPolicy(vpcName).Return(nil)

0 commit comments

Comments
 (0)