Skip to content

Commit ecb62e1

Browse files
committed
controller: fix setting LR options on initialization (#5444)
Signed-off-by: zhangzujian <[email protected]>
1 parent 8579165 commit ecb62e1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pkg/controller/init.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"maps"
78
"strings"
89
"time"
910

@@ -238,11 +239,16 @@ func (c *Controller) initClusterRouter() error {
238239
return err
239240
}
240241

241-
lr.Options = map[string]string{"always_learn_from_arp_request": "false", "dynamic_neigh_routers": "true", "mac_binding_age_threshold": "300"}
242-
err = c.OVNNbClient.UpdateLogicalRouter(lr, &lr.Options)
243-
if err != nil {
244-
klog.Errorf("update logical router %s failed: %v", c.config.ClusterRouter, err)
245-
return err
242+
lrOptions := make(map[string]string, len(lr.Options))
243+
maps.Copy(lrOptions, lr.Options)
244+
lrOptions["mac_binding_age_threshold"] = "300"
245+
lrOptions["dynamic_neigh_routers"] = "true"
246+
if !maps.Equal(lr.Options, lrOptions) {
247+
lr.Options = lrOptions
248+
if err = c.OVNNbClient.UpdateLogicalRouter(lr, &lr.Options); err != nil {
249+
klog.Errorf("update logical router %s failed: %v", c.config.ClusterRouter, err)
250+
return err
251+
}
246252
}
247253

248254
return nil

0 commit comments

Comments
 (0)