@@ -1190,13 +1190,13 @@ func (c *Controller) reconcileNamespaces(subnet *kubeovnv1.Subnet) error {
1190
1190
func (c * Controller ) reconcileCustomVpcBfdStaticRoute (vpcName , subnetName string ) error {
1191
1191
// vpc enable bfd and subnet enable ecmp
1192
1192
// use static ecmp route with bfd
1193
- ovnEips , err := c .ovnEipsLister .List (labels .SelectorFromSet (labels.Set {util .OvnEipTypeLabel : util .NodeExtGwUsingEip }))
1193
+ ovnEips , err := c .ovnEipsLister .List (labels .SelectorFromSet (labels.Set {util .OvnEipTypeLabel : util .Lsp }))
1194
1194
if err != nil {
1195
1195
klog .Errorf ("failed to list node external ovn eip, %v" , err )
1196
1196
return err
1197
1197
}
1198
1198
if len (ovnEips ) < 2 {
1199
- err := fmt .Errorf ("ecmp route with bfd for HA, which need two %s type eips at least, has %d" , util .NodeExtGwUsingEip , len (ovnEips ))
1199
+ err := fmt .Errorf ("ecmp route with bfd for HA, which need two %s type eips at least, has %d" , util .Lsp , len (ovnEips ))
1200
1200
klog .Error (err )
1201
1201
return err
1202
1202
}
@@ -1266,17 +1266,15 @@ func (c *Controller) reconcileCustomVpcBfdStaticRoute(vpcName, subnetName string
1266
1266
}
1267
1267
}
1268
1268
if needUpdate {
1269
- if _ , err = c .config .KubeOvnClient .KubeovnV1 ().Vpcs ().Update (context .Background (), vpc , metav1.UpdateOptions {}); err != nil {
1269
+ if vpc , err = c .config .KubeOvnClient .KubeovnV1 ().Vpcs ().Update (context .Background (), vpc , metav1.UpdateOptions {}); err != nil {
1270
1270
klog .Errorf ("failed to update vpc spec static route %s, %v" , vpc .Name , err )
1271
1271
return err
1272
1272
}
1273
+ if err = c .patchVpcBfdStatus (vpc .Name ); err != nil {
1274
+ klog .Errorf ("failed to patch vpc %s, %v" , vpc .Name , err )
1275
+ return err
1276
+ }
1273
1277
}
1274
-
1275
- if err = c .patchVpcBfdStatus (vpc .Name ); err != nil {
1276
- klog .Errorf ("failed to patch vpc %s, %v" , vpc .Name , err )
1277
- return err
1278
- }
1279
-
1280
1278
return nil
1281
1279
}
1282
1280
@@ -1292,15 +1290,15 @@ func (c *Controller) reconcileCustomVpcAddNormalStaticRoute(vpcName string) erro
1292
1290
return err
1293
1291
}
1294
1292
gatewayV4 , gatewayV6 := util .SplitStringIP (defualtExternalSubnet .Spec .Gateway )
1295
- vpc , err := c .vpcsLister .Get (vpcName )
1293
+ cachedVpc , err := c .vpcsLister .Get (vpcName )
1296
1294
if err != nil {
1297
1295
if k8serrors .IsNotFound (err ) {
1298
1296
return nil
1299
1297
}
1300
1298
klog .Errorf ("failed to get vpc %s, %v" , vpcName , err )
1301
1299
return err
1302
1300
}
1303
-
1301
+ vpc := cachedVpc . DeepCopy ()
1304
1302
rtbs := c .getRouteTablesByVpc (vpc )
1305
1303
routeTotal := len (vpc .Spec .StaticRoutes ) + len (rtbs )* 2
1306
1304
routes := make ([]* kubeovnv1.StaticRoute , 0 , routeTotal )
@@ -1351,17 +1349,15 @@ func (c *Controller) reconcileCustomVpcAddNormalStaticRoute(vpcName string) erro
1351
1349
1352
1350
if needUpdate {
1353
1351
vpc .Spec .StaticRoutes = routes
1354
- if _ , err = c .config .KubeOvnClient .KubeovnV1 ().Vpcs ().Update (context .Background (), vpc , metav1.UpdateOptions {}); err != nil {
1352
+ if vpc , err = c .config .KubeOvnClient .KubeovnV1 ().Vpcs ().Update (context .Background (), vpc , metav1.UpdateOptions {}); err != nil {
1355
1353
klog .Errorf ("failed to update vpc spec static route %s, %v" , vpc .Name , err )
1356
1354
return err
1357
1355
}
1356
+ if err = c .patchVpcBfdStatus (vpc .Name ); err != nil {
1357
+ klog .Errorf ("failed to patch vpc %s, %v" , vpc .Name , err )
1358
+ return err
1359
+ }
1358
1360
}
1359
-
1360
- if err = c .patchVpcBfdStatus (vpc .Name ); err != nil {
1361
- klog .Errorf ("failed to patch vpc %s, %v" , vpc .Name , err )
1362
- return err
1363
- }
1364
-
1365
1361
return nil
1366
1362
}
1367
1363
0 commit comments