Pick a more universal hostname, add comment about docker

pull/7360/head
Thomas Stromberg 2020-04-01 14:38:46 -07:00
parent 0432095115
commit 1dcd5cd310
2 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ import (
"testing" "testing"
) )
func TestCertOptionFlags(t *testing.T) { func TestCertOptions(t *testing.T) {
if NoneDriver() { if NoneDriver() {
t.Skip("skipping: none driver does not support ssh or bundle docker") t.Skip("skipping: none driver does not support ssh or bundle docker")
} }
@ -37,10 +37,9 @@ func TestCertOptionFlags(t *testing.T) {
// Use the most verbose logging for the simplest test. If it fails, something is very wrong. // Use the most verbose logging for the simplest test. If it fails, something is very wrong.
args := append([]string{"start", "-p", profile, "--apiserver-ips=127.0.0.1,192.168.15.15", "--apiserver-names=localhost,www.google.com", "--apiserver-port=8555"}, StartArgs()...) args := append([]string{"start", "-p", profile, "--apiserver-ips=127.0.0.1,192.168.15.15", "--apiserver-names=localhost,www.google.com", "--apiserver-port=8555"}, StartArgs()...)
// We can safely override --apiserver-name with unique that works // We can safely override --apiserver-name with
if NeedsPortForward() { if NeedsPortForward() {
args = append(args, "--apiserver-name=kubernetes.docker.internal") args = append(args, "--apiserver-name=localhost")
} }
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))

View File

@ -74,7 +74,8 @@ func KicDriver() bool {
return strings.Contains(*startArgs, "--driver=docker") || strings.Contains(*startArgs, "--vm-driver=docker") || strings.Contains(*startArgs, "--vm-driver=podman") || strings.Contains(*startArgs, "driver=podman") return strings.Contains(*startArgs, "--driver=docker") || strings.Contains(*startArgs, "--vm-driver=docker") || strings.Contains(*startArgs, "--vm-driver=podman") || strings.Contains(*startArgs, "driver=podman")
} }
// NeedsPortForward requires whether or not this host 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)
func NeedsPortForward() bool { func NeedsPortForward() bool {
return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin") return KicDriver() && (runtime.GOOS == "windows" || runtime.GOOS == "darwin")
} }