Skip to content

Commit

Permalink
Merge pull request #13300 from spowelljr/supportHostnames
Browse files Browse the repository at this point in the history
Support DOCKER_HOST not being numeric IP
  • Loading branch information
spowelljr authored Jan 5, 2022
2 parents 3acd6d6 + e3b7887 commit 5641f9a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/minikube/driver/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName
}
hostname := oci.DaemonHost(driverName)

ip := net.ParseIP(hostname)
if ip == nil {
return hostname, ip, port, fmt.Errorf("failed to parse ip for %q", hostname)
ips, err := net.LookupIP(hostname)
if err != nil || len(ips) == 0 {
return hostname, nil, port, fmt.Errorf("failed to lookup ip for %q", hostname)
}

// https://github.com/kubernetes/minikube/issues/3878
if cc.KubernetesConfig.APIServerName != constants.APIServerName {
hostname = cc.KubernetesConfig.APIServerName
}
return hostname, ip, port, err
return hostname, ips[0], port, err
}

// https://github.com/kubernetes/minikube/issues/3878
hostname := cp.IP
if cc.KubernetesConfig.APIServerName != constants.APIServerName {
hostname = cc.KubernetesConfig.APIServerName
}
ip := net.ParseIP(cp.IP)
if ip == nil {
return hostname, ip, cp.Port, fmt.Errorf("failed to parse ip for %q", cp.IP)
ips, err := net.LookupIP(cp.IP)
if err != nil || len(ips) == 0 {
return hostname, nil, cp.Port, fmt.Errorf("failed to lookup ip for %q", cp.IP)
}
return hostname, ip, cp.Port, nil
return hostname, ips[0], cp.Port, nil
}

// AutoPauseProxyEndpoint returns the endpoint for the auto-pause (reverse proxy to api-sever)
Expand Down

0 comments on commit 5641f9a

Please sign in to comment.