Skip to content

Commit

Permalink
Enable netfilter for bridge, requirement for all CNI that use bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
murali-reddy committed Aug 29, 2017
1 parent 5951f55 commit ff079d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controllers
import (
"errors"
"fmt"
"io/ioutil"
"net"
"net/url"
"os/exec"
Expand Down Expand Up @@ -94,6 +95,14 @@ func (nrc *NetworkRoutingController) Run(stopCh <-chan struct{}, wg *sync.WaitGr
glog.Errorf("Failed to enable IP forwarding of traffic from pods: %s", err.Error())
}

// enable netfilter for the bridge
if _, err := exec.Command("modprobe", "br_netfilter").CombinedOutput(); err != nil {
glog.Errorf("Failed to enable netfilter for bridge. Network policies and service proxy may not work: %s", err.Error())
}
if err = ioutil.WriteFile("/proc/sys/net/bridge/bridge-nf-call-iptables", []byte(strconv.Itoa(1)), 0640); err != nil {
glog.Errorf("Failed to enable netfilter for bridge. Network policies and service proxy may not work: %s", err.Error())
}

t := time.NewTicker(nrc.syncPeriod)
defer t.Stop()
defer wg.Done()
Expand Down

0 comments on commit ff079d2

Please sign in to comment.