From 9e7575c99705bc88444047a40b23d678edb8e0b8 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Wed, 29 Jan 2020 14:19:44 -0800 Subject: [PATCH 1/2] dont fail on modprob netfilter --- pkg/minikube/cruntime/cruntime.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/minikube/cruntime/cruntime.go b/pkg/minikube/cruntime/cruntime.go index 2705a012ce70..7341d2436a52 100644 --- a/pkg/minikube/cruntime/cruntime.go +++ b/pkg/minikube/cruntime/cruntime.go @@ -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. output=%q error=%v", rr.Command(), rr.Output(), err) + c = exec.Command("sudo", "modprobe", "br_netfilter") + if rr, err := cr.RunCmd(c); err != nil { + return errors.Wrapf(err, "br_netfilter. output: %s", rr.Output()) + } } - 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") From dddb8a7440c4cb47afb60b7cdbb8c1dcdff77432 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Wed, 29 Jan 2020 14:44:50 -0800 Subject: [PATCH 2/2] simplify kic runner else logic --- pkg/minikube/command/kic_runner.go | 11 +++++------ pkg/minikube/cruntime/cruntime.go | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pkg/minikube/command/kic_runner.go b/pkg/minikube/command/kic_runner.go index cc58035fd15f..3fe57bb17d08 100644 --- a/pkg/minikube/command/kic_runner.go +++ b/pkg/minikube/command/kic_runner.go @@ -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()) } diff --git a/pkg/minikube/cruntime/cruntime.go b/pkg/minikube/cruntime/cruntime.go index 7341d2436a52..812d469000cc 100644 --- a/pkg/minikube/cruntime/cruntime.go +++ b/pkg/minikube/cruntime/cruntime.go @@ -169,10 +169,10 @@ func disableOthers(me Manager, cr CommandRunner) error { func enableIPForwarding(cr CommandRunner) error { 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. output=%q error=%v", rr.Command(), rr.Output(), err) + 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 rr, err := cr.RunCmd(c); err != nil { - return errors.Wrapf(err, "br_netfilter. output: %s", rr.Output()) + 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")