Skip to content

Commit

Permalink
support to set NB_Global option mcast_privileged
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Nov 24, 2021
1 parent b102f1a commit 743502c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 561 deletions.
1 change: 1 addition & 0 deletions dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN dpkg -i /usr/src/python3-openvswitch*.deb /usr/src/libopenvswitch*.deb
RUN cd /usr/src/ && git clone -b branch-21.06 --depth=1 https://github.com/ovn-org/ovn.git && \
cd ovn && \
curl -s https://github.com/kubeovn/ovn/commit/e24734913d25c0bffdf1cfd79e14ef43d01e1019.patch | git apply && \
curl -s https://github.com/kubeovn/ovn/commit/eee4ace8a3dd00f0a067fed0f0cabee46a29aa54.patch | git apply && \
sed -i 's/OVN/ovn/g' debian/changelog && \
rm -rf .git && \
./boot.sh && \
Expand Down
2 changes: 2 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ HW_OFFLOAD=${HW_OFFLOAD:-false}
ENABLE_LB=${ENABLE_LB:-true}
ENABLE_NP=${ENABLE_NP:-true}
ENABLE_EXTERNAL_VPC=${ENABLE_EXTERNAL_VPC:-true}
MULTICAST_PRIVILEGED=${MULTICAST_PRIVILEGED:-false}
# The nic to support container network can be a nic name or a group of regex
# separated by comma, if empty will use the nic that the default route use
IFACE=${IFACE:-}
Expand Down Expand Up @@ -1885,6 +1886,7 @@ spec:
- --enable-lb=$ENABLE_LB
- --enable-np=$ENABLE_NP
- --enable-external-vpc=$ENABLE_EXTERNAL_VPC
- --multicast-privileged=$MULTICAST_PRIVILEGED
- --logtostderr=false
- --alsologtostderr=true
- --log_file=/var/log/kube-ovn/kube-ovn-controller.log
Expand Down
5 changes: 5 additions & 0 deletions pkg/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ type Configuration struct {
EnableLb bool
EnableNP bool
EnableExternalVpc bool

MulticastPrivileged bool
}

// ParseFlags parses cmd args then init kubeclient and conf
Expand Down Expand Up @@ -111,6 +113,8 @@ func ParseFlags() (*Configuration, error) {
argEnableLb = pflag.Bool("enable-lb", true, "Enable load balancer, default: true")
argEnableNP = pflag.Bool("enable-np", true, "Enable network policy support, default: true")
argEnableExternalVpc = pflag.Bool("enable-external-vpc", true, "Enable external vpc support, default: true")

argMulticastPrivileged = pflag.Bool("multicast-privileged", false, "Move broadcast/multicast flows to table ls_in_pre_lb in logical switches' ingress pipeline to improve broadcast/multicast performace, default: false")
)

klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
Expand Down Expand Up @@ -164,6 +168,7 @@ func ParseFlags() (*Configuration, error) {
EnableLb: *argEnableLb,
EnableNP: *argEnableNP,
EnableExternalVpc: *argEnableExternalVpc,
MulticastPrivileged: *argMulticastPrivileged,
}

if config.NetworkType == util.NetworkTypeVlan && config.DefaultHostInterface == "" {
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (
)

func (c *Controller) InitOVN() error {
if err := c.ovnClient.SetMulticastPrivileged(c.config.MulticastPrivileged); err != nil {
return err
}

if err := c.initClusterRouter(); err != nil {
klog.Errorf("init cluster router failed: %v", err)
return err
Expand Down
7 changes: 7 additions & 0 deletions pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ func (c Client) SetUseCtInvMatch() error {
return nil
}

func (c Client) SetMulticastPrivileged(enabled bool) error {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", fmt.Sprintf("options:mcast_privileged=%v", enabled)); err != nil {
return fmt.Errorf("failed to set NB_Global option mcast_privileged to %v: %v", enabled, err)
}
return nil
}

func (c Client) SetICAutoRoute(enable bool, blackList []string) error {
if enable {
if _, err := c.ovnNbCommand("set", "NB_Global", ".", "options:ic-route-adv=true", "options:ic-route-learn=true", fmt.Sprintf("options:ic-route-blacklist=%s", strings.Join(blackList, ","))); err != nil {
Expand Down
Loading

0 comments on commit 743502c

Please sign in to comment.