Skip to content

Commit

Permalink
improve checking modprob netfilter (#6427)
Browse files Browse the repository at this point in the history
  • Loading branch information
medyagh authored Jan 29, 2020
1 parent 541c67d commit e725104
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 5 additions & 6 deletions pkg/minikube/command/kic_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,12 @@ func (k *kicRunner) RunCmd(cmd *exec.Cmd) (*RunResult, error) {
if elapsed > (1 * time.Second) {
glog.Infof("Done: %v: (%s)", oc.Args, elapsed)
}
} else {
if exitError, ok := err.(*exec.ExitError); ok {
rr.ExitCode = exitError.ExitCode()
}
err = fmt.Errorf("%s: %v\nstdout:\n%s\nstderr:\n%s", rr.Command(), err, rr.Stdout.String(), rr.Stderr.String())
return rr, nil
}
if exitError, ok := err.(*exec.ExitError); ok {
rr.ExitCode = exitError.ExitCode()
}
return rr, err
return rr, fmt.Errorf("%s: %v\nstdout:\n%s\nstderr:\n%s", rr.Command(), err, rr.Stdout.String(), rr.Stderr.String())

}

Expand Down
11 changes: 7 additions & 4 deletions pkg/minikube/cruntime/cruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,14 @@ func disableOthers(me Manager, cr CommandRunner) error {
// enableIPForwarding configures IP forwarding, which is handled normally by Docker
// Context: https://github.com/kubernetes/kubeadm/issues/1062
func enableIPForwarding(cr CommandRunner) error {
c := exec.Command("sudo", "modprobe", "br_netfilter")
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrap(err, "br_netfilter")
c := exec.Command("sudo", "sysctl", "net.netfilter.nf_conntrack_count")
if rr, err := cr.RunCmd(c); err != nil {
glog.Infof("couldn't verify netfilter by %q which might be okay. error: %v", rr.Command(), err)
c = exec.Command("sudo", "modprobe", "br_netfilter")
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrapf(err, "br_netfilter")
}
}

c = exec.Command("sudo", "sh", "-c", "echo 1 > /proc/sys/net/ipv4/ip_forward")
if _, err := cr.RunCmd(c); err != nil {
return errors.Wrapf(err, "ip_forward")
Expand Down

0 comments on commit e725104

Please sign in to comment.