To keep depecrate k8s node NodeLegacyHostIP as local constant to keep compatibility for older k8s version

Signed-off-by: jojohappy <sarahdj0917@gmail.com>
This commit is contained in:
jojohappy 2018-07-03 20:04:27 +08:00
parent f3735d0ead
commit e81785d1a3

View File

@ -29,6 +29,10 @@ import (
"k8s.io/client-go/util/workqueue"
)
const (
NodeLegacyHostIP = "LegacyHostIP"
)
// Node discovers Kubernetes nodes.
type Node struct {
logger log.Logger
@ -203,6 +207,9 @@ func nodeAddress(node *apiv1.Node) (string, map[apiv1.NodeAddressType][]string,
if addresses, ok := m[apiv1.NodeExternalIP]; ok {
return addresses[0], m, nil
}
if addresses, ok := m[apiv1.NodeAddressType(NodeLegacyHostIP)]; ok {
return addresses[0], m, nil
}
if addresses, ok := m[apiv1.NodeHostName]; ok {
return addresses[0], m, nil
}