Fix for validating kubeconfig's hosts

URL's Host field is "host" or "host:port". (see https://golang.org/pkg/net/url/#URL )
"host:port" can't be used as net.LookupHost's parameter.
I recommend using URL.Hostname() instead of URL.Host.
This commit is contained in:
Brad Kim 2018-05-03 11:47:46 +09:00
parent 7ff94b6f6a
commit 967f1e86c6
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ func hasPlaceHolderIP(clusterName string) (bool, error) {
return true, fmt.Errorf("unable to parse Kubernetes cluster API URL: %v", err)
}
hostAddrs, err := net.LookupHost(apiAddr.Host)
hostAddrs, err := net.LookupHost(apiAddr.Hostname())
if err != nil {
return true, fmt.Errorf("unable to resolve Kubernetes cluster API URL dns: %v", err)
}