Skip to content

Commit

Permalink
modeprobe br-netfilter to fix issue #568 (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyjhtangtang authored Nov 12, 2021
1 parent 4e3abd5 commit cee6b42
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/yurtctl/util/system/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ package system
import (
"fmt"
"io/ioutil"
"os/exec"

"k8s.io/klog"

"github.com/opencontainers/selinux/go-selinux"
"github.com/openyurtio/openyurt/pkg/yurtctl/constants"
"github.com/openyurtio/openyurt/pkg/yurtctl/util/edgenode"
)

const (
Expand Down Expand Up @@ -51,6 +53,13 @@ func SetBridgeSetting() error {
if err := ioutil.WriteFile(constants.Sysctl_k8s_config, []byte(kubernetsBridgeSetting), 0644); err != nil {
return fmt.Errorf("Write file %s fail: %v ", constants.Sysctl_k8s_config, err)
}

if exist, _ := edgenode.FileExists(bridgenf); !exist {
cmd := exec.Command("bash", "-c", "modprobe br-netfilter")
if err := edgenode.Exec(cmd); err != nil {
return err
}
}
if err := ioutil.WriteFile(bridgenf, []byte("1"), 0644); err != nil {
return fmt.Errorf("Write file %s fail: %v ", bridgenf, err)
}
Expand Down

0 comments on commit cee6b42

Please sign in to comment.