Skip to content

Commit

Permalink
add flag to disable enhanced address
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyasdf committed Apr 25, 2022
1 parent 189bfe2 commit 767c394
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/daemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ type Configuration struct {
NeighGCThresh1 int
NeighGCThresh2 int
NeighGCThresh3 int

EnableVlanArpEnhancement bool
}

// ParseFlags will parse cmd args then init kubeClient and configuration
Expand All @@ -119,6 +121,7 @@ func ParseFlags() (*Configuration, error) {
argNeighGCThresh2 = pflag.Int("neigh-gc-thresh2", DefaultNeighGCThresh2, "Value to set net.ipv4/ipv6.neigh.default.gc_thresh2")
argNeighGCThresh3 = pflag.Int("neigh-gc-thresh3", DefaultNeighGCThresh3, "Value to set net.ipv4/ipv6.neigh.default.gc_thresh3")
argExtraNodeLocalVxlanIPCidrs = pflag.String("extra-node-local-vxlan-ip-cidrs", "", "The cidr list to select node extra local vxlan ip, e.g., \"192.168.10.0/24,10.2.3.0/24\"")
argEnableVlanArpEnhancement = pflag.Bool("enable-vlan-arp-enhancement", false, "Whether enable arp source enhancement in a vlan environment")
)

// mute info log for ipset lib
Expand Down Expand Up @@ -152,6 +155,7 @@ func ParseFlags() (*Configuration, error) {
NeighGCThresh2: *argNeighGCThresh2,
NeighGCThresh3: *argNeighGCThresh3,
VxlanExpiredNeighCachesClearInterval: *argVxlanExpiredNeighCachesClearInterval,
EnableVlanArpEnhancement: *argEnableVlanArpEnhancement,
}

if *argPreferVlanInterfaces == "" {
Expand Down
6 changes: 4 additions & 2 deletions pkg/daemon/controller/ipinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ func (r *ipInstanceReconciler) Reconcile(ctx context.Context, request reconcile.
}
}

if err := r.ctrlHubRef.addrV4Manager.SyncAddresses(r.ctrlHubRef.getIPInstanceByAddress); err != nil {
return reconcile.Result{Requeue: true}, fmt.Errorf("failed to sync ipv4 addresses: %v", err)
if r.ctrlHubRef.config.EnableVlanArpEnhancement {
if err := r.ctrlHubRef.addrV4Manager.SyncAddresses(r.ctrlHubRef.getIPInstanceByAddress); err != nil {
return reconcile.Result{Requeue: true}, fmt.Errorf("failed to sync ipv4 addresses: %v", err)
}
}

if err := r.ctrlHubRef.bgpManager.SyncIPInfos(); err != nil {
Expand Down

0 comments on commit 767c394

Please sign in to comment.