From c22a92f9bfb4e03d7318cb27f154d2ee56d25641 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sat, 23 May 2020 18:49:50 +0200 Subject: [PATCH] Add HostIP implementation for parallels driver --- pkg/minikube/cluster/ip.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/minikube/cluster/ip.go b/pkg/minikube/cluster/ip.go index aa14e4cf71..e44416426f 100644 --- a/pkg/minikube/cluster/ip.go +++ b/pkg/minikube/cluster/ip.go @@ -72,6 +72,25 @@ func HostIP(host *host.Host) (net.IP, error) { re = regexp.MustCompile(`(?s)Name:\s*` + iface + `.+IPAddress:\s*(\S+)`) ip := re.FindStringSubmatch(string(ipList))[1] return net.ParseIP(ip), nil + case driver.Parallels: + cmd := "prlsrvctl" + var cmdPath string + if fullPath, err := exec.LookPath(cmd); err != nil { + cmdPath = fullPath + } else { + cmdPath = cmd + } + out, err := exec.Command(cmdPath, "net", "info", "Shared").Output() + if err != nil { + return []byte{}, errors.Wrap(err, "Error reading the info of Parallels Shared network interface") + } + re := regexp.MustCompile(`IPv4 address: (.*)`) + ipMatch := re.FindStringSubmatch(string(out)) + if len(ipMatch) < 2 { + return []byte{}, errors.Wrap(err, "Error getting the IP address of Parallels Shared network interface") + } + ip := ipMatch[1] + return net.ParseIP(ip), nil case driver.HyperKit: return net.ParseIP("192.168.64.1"), nil case driver.VMware: