k3s/pkg/agent/syssetup/setup.go

25 lines
596 B
Go
Raw Normal View History

2019-01-01 08:23:01 +00:00
package syssetup
import (
"io/ioutil"
"os/exec"
2019-01-01 08:23:01 +00:00
"github.com/sirupsen/logrus"
)
var (
callIPTablesFile = "/proc/sys/net/bridge/bridge-nf-call-iptables"
forward = "/proc/sys/net/ipv4/ip_forward"
2019-01-01 08:23:01 +00:00
)
func Configure() error {
exec.Command("modprobe", "br_netfilter").Run()
2019-01-01 08:23:01 +00:00
if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil {
logrus.Warnf("failed to write value 1 at %s: %v", callIPTablesFile, err)
}
if err := ioutil.WriteFile(forward, []byte("1"), 0640); err != nil {
logrus.Warnf("failed to write value 1 at %s: %v", forward, err)
}
2019-01-01 08:23:01 +00:00
return nil
}