address review comments
parent
9e004d6417
commit
6b29b784f2
|
@ -131,13 +131,13 @@ func NeedsRoot(name string) bool {
|
||||||
// NeedsPortForward returns true if driver is unable provide direct IP connectivity
|
// NeedsPortForward returns true if driver is unable provide direct IP connectivity
|
||||||
func NeedsPortForward(name string) bool {
|
func NeedsPortForward(name string) bool {
|
||||||
// Docker for Desktop
|
// Docker for Desktop
|
||||||
return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows" || isMicrosoftWSL())
|
return IsKIC(name) && (runtime.GOOS == "darwin" || runtime.GOOS == "windows" || IsMicrosoftWSL())
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMicrosoftWSL will return true if process is running in WSL in windows
|
// IsMicrosoftWSL will return true if process is running in WSL in windows
|
||||||
// checking for WSL env var based on this https://github.com/microsoft/WSL/issues/423#issuecomment-608237689
|
// checking for WSL env var based on this https://github.com/microsoft/WSL/issues/423#issuecomment-608237689
|
||||||
// also based on https://github.com/microsoft/vscode/blob/90a39ba0d49d75e9a4d7e62a6121ad946ecebc58/resources/win32/bin/code.sh#L24
|
// also based on https://github.com/microsoft/vscode/blob/90a39ba0d49d75e9a4d7e62a6121ad946ecebc58/resources/win32/bin/code.sh#L24
|
||||||
func isMicrosoftWSL() bool {
|
func IsMicrosoftWSL() bool {
|
||||||
return os.Getenv("WSL_DISTRO_NAME") != "" || os.Getenv("WSLPATH") != "" || os.Getenv("WSLENV") != ""
|
return os.Getenv("WSL_DISTRO_NAME") != "" || os.Getenv("WSLPATH") != "" || os.Getenv("WSLENV") != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/minikube/pkg/minikube/driver"
|
||||||
)
|
)
|
||||||
|
|
||||||
// General configuration: used to set the VM Driver
|
// General configuration: used to set the VM Driver
|
||||||
|
@ -93,14 +95,7 @@ func KicDriver() bool {
|
||||||
// NeedsPortForward returns access to endpoints with this driver needs port forwarding
|
// NeedsPortForward returns access to endpoints with this driver needs port forwarding
|
||||||
// (Docker on non-Linux platforms requires ports to be forwarded to 127.0.0.1)
|
// (Docker on non-Linux platforms requires ports to be forwarded to 127.0.0.1)
|
||||||
func NeedsPortForward() bool {
|
func NeedsPortForward() bool {
|
||||||
return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") || isMicrosoftWSL()
|
return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") || driver.IsMicrosoftWSL()
|
||||||
}
|
|
||||||
|
|
||||||
// isMicrosoftWSL will return true if process is running in WSL in windows
|
|
||||||
// checking for WSL env var based on this https://github.com/microsoft/WSL/issues/423#issuecomment-608237689
|
|
||||||
// also based on https://github.com/microsoft/vscode/blob/90a39ba0d49d75e9a4d7e62a6121ad946ecebc58/resources/win32/bin/code.sh#L24
|
|
||||||
func isMicrosoftWSL() bool {
|
|
||||||
return os.Getenv("WSL_DISTRO_NAME") != "" || os.Getenv("WSLPATH") != "" || os.Getenv("WSLENV") != ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanCleanup returns if cleanup is allowed
|
// CanCleanup returns if cleanup is allowed
|
||||||
|
|
Loading…
Reference in New Issue