add for port forwarding as well

pull/13300/head
Steven Powell 2022-01-05 15:09:05 -08:00
parent 807c056ea7
commit e3b7887d7c
1 changed files with 5 additions and 7 deletions

View File

@ -35,16 +35,16 @@ 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
@ -56,9 +56,7 @@ func ControlPlaneEndpoint(cc *config.ClusterConfig, cp *config.Node, driverName
if err != nil || len(ips) == 0 {
return hostname, nil, cp.Port, fmt.Errorf("failed to lookup ip for %q", cp.IP)
}
// get last IP as it's IPv4
ip := ips[len(ips)-1]
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)