From 02749de984b5456de0f45c7409d621213dfbe022 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Wed, 3 Jun 2020 14:39:34 -0700 Subject: [PATCH] detect wsl and add port forward --- pkg/minikube/driver/driver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index f4e6e53697..43d1736b6c 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -131,7 +131,12 @@ func NeedsRoot(name string) bool { // NeedsPortForward returns true if driver is unable provide direct IP connectivity func NeedsPortForward(name string) bool { // Docker for Desktop - return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows") + return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows" || isMicrosoftWSL()) +} + +// isMicrosoftWSL will return true if process is running in WSL in windows +func isMicrosoftWSL() bool { + return os.Getenv("WSL_DISTRO_NAME") != "" } // HasResourceLimits returns true if driver can set resource limits such as memory size or CPU count.