Use Node IP Address instead of Node.Name in minion.ResourceLocation.

Refactor GetNodeHostIP into pkg/util/node (instead of pkg/util to break import cycle).

Include internalIP in gce NodeAddresses.
This commit is contained in:
CJ Cullen
2015-05-26 16:13:00 -07:00
parent b2449746b4
commit 2d85e4a094
5 changed files with 47 additions and 25 deletions

View File

@@ -34,6 +34,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors"
nodeutil "github.com/GoogleCloudPlatform/kubernetes/pkg/util/node"
)
// nodeStrategy implements behavior for nodes
@@ -142,7 +143,11 @@ func ResourceLocation(getter ResourceGetter, connection client.ConnectionInfoGet
return nil, nil, err
}
node := nodeObj.(*api.Node)
host := node.Name // TODO: use node's IP, don't expect the name to resolve.
hostIP, err := nodeutil.GetNodeHostIP(node)
if err != nil {
return nil, nil, err
}
host := hostIP.String()
if portReq == "" || strconv.Itoa(ports.KubeletPort) == portReq {
scheme, port, transport, err := connection.GetConnectionInfo(host)