Skip to content

Commit

Permalink
add enable multicast snoop to 1.12 (#4105)
Browse files Browse the repository at this point in the history
Signed-off-by: clyi <clyi@alauda.io>
  • Loading branch information
changluyi committed May 30, 2024
1 parent 2286ffa commit 7b4ff3a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/kube-ovn/templates/kube-ovn-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,8 @@ spec:
type: boolean
enableEcmp:
type: boolean
enableMulticastSnoop:
type: boolean
routeTable:
type: string
scope: Cluster
Expand Down
2 changes: 2 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,8 @@ spec:
type: boolean
enableEcmp:
type: boolean
enableMulticastSnoop:
type: boolean
routeTable:
type: string
scope: Cluster
Expand Down
28 changes: 28 additions & 0 deletions mocks/pkg/ovs/interface.go

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

1 change: 1 addition & 0 deletions pkg/apis/kubeovn/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ type SubnetSpec struct {
U2OInterconnection bool `json:"u2oInterconnection,omitempty"`
EnableLb *bool `json:"enableLb,omitempty"`
EnableEcmp bool `json:"enableEcmp,omitempty"`
EnableMulicastSnoop bool `json:"enableMulticastSnoop,omitempty"`

RouteTable string `json:"routeTable,omitempty"`
}
Expand Down
14 changes: 14 additions & 0 deletions pkg/controller/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func (c *Controller) enqueueUpdateSubnet(oldObj, newObj interface{}) {
oldSubnet.Spec.RouteTable != newSubnet.Spec.RouteTable ||
oldSubnet.Spec.Vpc != newSubnet.Spec.Vpc ||
oldSubnet.Spec.NatOutgoing != newSubnet.Spec.NatOutgoing ||
oldSubnet.Spec.EnableMulicastSnoop != newSubnet.Spec.EnableMulicastSnoop ||
!reflect.DeepEqual(oldSubnet.Spec.NatOutgoingPolicyRules, newSubnet.Spec.NatOutgoingPolicyRules) ||
(newSubnet.Spec.U2OInterconnection && newSubnet.Spec.U2OInterconnectionIP != "" && oldSubnet.Spec.U2OInterconnectionIP != newSubnet.Spec.U2OInterconnectionIP) {

Expand Down Expand Up @@ -786,6 +787,19 @@ func (c *Controller) handleAddOrUpdateSubnet(key string) error {
return err
}

multicastSnoopFlag := map[string]string{"mcast_snoop": "true", "mcast_querier": "false"}
if subnet.Spec.EnableMulicastSnoop {
if err := c.OVNNbClient.LogicalSwitchUpdateOtherConfig(subnet.Name, ovsdb.MutateOperationInsert, multicastSnoopFlag); err != nil {
klog.Errorf("enable logical switch multicast snoop %s: %v", subnet.Name, err)
return err
}
} else {
if err := c.OVNNbClient.LogicalSwitchUpdateOtherConfig(subnet.Name, ovsdb.MutateOperationDelete, multicastSnoopFlag); err != nil {
klog.Errorf("disable logical switch multicast snoop %s: %v", subnet.Name, err)
return err
}
}

subnet.Status.EnsureStandardConditions()

if err := c.updateSubnetDHCPOption(subnet, needRouter); err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/ovs/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type LogicalSwitch interface {
CreateLogicalSwitch(lsName, lrName, cidrBlock, gateway string, needRouter, randomAllocateGW bool) error
CreateBareLogicalSwitch(lsName string) error
LogicalSwitchUpdateLoadBalancers(lsName string, op ovsdb.Mutator, lbNames ...string) error
LogicalSwitchUpdateOtherConfig(lsName string, op ovsdb.Mutator, otherConfig map[string]string) error
DeleteLogicalSwitch(lsName string) error
ListLogicalSwitch(needVendorFilter bool, filter func(ls *ovnnb.LogicalSwitch) bool) ([]ovnnb.LogicalSwitch, error)
LogicalSwitchExists(lsName string) (bool, error)
Expand Down
2 changes: 2 additions & 0 deletions yamls/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,8 @@ spec:
type: boolean
enableEcmp:
type: boolean
enableMulticastSnoop:
type: boolean
scope: Cluster
names:
plural: subnets
Expand Down

0 comments on commit 7b4ff3a

Please sign in to comment.