Use KubeletPort reported in NodeStatus instead of cluster-wide master config, take 2.
This commit is contained in:
@@ -26,8 +26,8 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/errors"
|
||||
"k8s.io/kubernetes/pkg/api/validation"
|
||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/kubelet/client"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/master/ports"
|
||||
"k8s.io/kubernetes/pkg/registry/generic"
|
||||
@@ -162,9 +162,16 @@ func ResourceLocation(getter ResourceGetter, connection client.ConnectionInfoGet
|
||||
}
|
||||
host := hostIP.String()
|
||||
|
||||
if portReq == "" || strconv.Itoa(ports.KubeletPort) == portReq {
|
||||
// Ignore requested scheme, use scheme provided by GetConnectionInfo
|
||||
scheme, port, kubeletTransport, err := connection.GetConnectionInfo(host)
|
||||
// We check if we want to get a default Kubelet's transport. It happens if either:
|
||||
// - no port is specified in request (Kubelet's port is default),
|
||||
// - we're using Port stored as a DaemonEndpoint and requested port is a Kubelet's port stored in the DaemonEndpoint,
|
||||
// - there's no information in the API about DaemonEnpoint (legacy cluster) and requested port is equal to ports.KubeletPort (cluster-wide config)
|
||||
kubeletPort := node.Status.DaemonEndpoints.KubeletEndpoint.Port
|
||||
if kubeletPort == 0 {
|
||||
kubeletPort = ports.KubeletPort
|
||||
}
|
||||
if portReq == "" || strconv.Itoa(kubeletPort) == portReq {
|
||||
scheme, port, kubeletTransport, err := connection.GetConnectionInfo(ctx, node.Name)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user