From e81785d1a3778d620a2c41cdda1e942bb03eb14b Mon Sep 17 00:00:00 2001 From: jojohappy Date: Tue, 3 Jul 2018 20:04:27 +0800 Subject: [PATCH] To keep depecrate k8s node NodeLegacyHostIP as local constant to keep compatibility for older k8s version Signed-off-by: jojohappy --- discovery/kubernetes/node.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discovery/kubernetes/node.go b/discovery/kubernetes/node.go index ec6733734..c541f3946 100644 --- a/discovery/kubernetes/node.go +++ b/discovery/kubernetes/node.go @@ -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 }