mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Merge pull request #9155 from cjcullen/mig
Use Node IP Address instead of Node.Name in minion.ResourceLocation.
This commit is contained in:
@@ -33,6 +33,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
|
||||
@@ -141,13 +142,16 @@ 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.
|
||||
|
||||
if portReq != "" {
|
||||
return &url.URL{Host: net.JoinHostPort(host, portReq)}, nil, nil
|
||||
hostIP, err := nodeutil.GetNodeHostIP(node)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
scheme, port, transport, err := connection.GetConnectionInfo(host)
|
||||
if portReq != "" {
|
||||
return &url.URL{Host: net.JoinHostPort(hostIP.String(), portReq)}, nil, nil
|
||||
}
|
||||
|
||||
scheme, port, transport, err := connection.GetConnectionInfo(hostIP.String())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -155,7 +159,7 @@ func ResourceLocation(getter ResourceGetter, connection client.ConnectionInfoGet
|
||||
return &url.URL{
|
||||
Scheme: scheme,
|
||||
Host: net.JoinHostPort(
|
||||
host,
|
||||
hostIP.String(),
|
||||
strconv.FormatUint(uint64(port), 10),
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user