Nodes returns transport and scheme in spite of port requirements

pull/6/head
Prashanth Balasubramanian 2015-06-03 22:13:59 -07:00
parent 640c40da65
commit b678e2ff9e
1 changed files with 5 additions and 5 deletions

View File

@ -129,7 +129,7 @@ func MatchNode(label labels.Selector, field fields.Selector) generic.Matcher {
}
}
// ResourceLocation returns a URL to which one can send traffic for the specified node.
// ResourceLocation returns an URL and transport which one can use to send traffic for the specified node.
func ResourceLocation(getter ResourceGetter, connection client.ConnectionInfoGetter, ctx api.Context, id string) (*url.URL, http.RoundTripper, error) {
name, portReq, valid := util.SplitPort(id)
if !valid {
@ -143,15 +143,15 @@ func ResourceLocation(getter ResourceGetter, connection client.ConnectionInfoGet
node := nodeObj.(*api.Node)
host := node.Name // TODO: use node's IP, don't expect the name to resolve.
if portReq != "" {
return &url.URL{Host: net.JoinHostPort(host, portReq)}, nil, nil
}
scheme, port, transport, err := connection.GetConnectionInfo(host)
if err != nil {
return nil, nil, err
}
if portReq != "" {
return &url.URL{Scheme: scheme, Host: net.JoinHostPort(host, portReq)}, transport, nil
}
return &url.URL{
Scheme: scheme,
Host: net.JoinHostPort(