[prometheus_sd/kubernetes]add new node address types for discover (#5902)
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
This commit is contained in:
parent
48b2c9c8ea
commit
f0a5f88b95
|
@ -196,9 +196,11 @@ func (n *Node) buildNode(node *apiv1.Node) *targetgroup.Group {
|
|||
|
||||
// nodeAddresses returns the provided node's address, based on the priority:
|
||||
// 1. NodeInternalIP
|
||||
// 2. NodeExternalIP
|
||||
// 3. NodeLegacyHostIP
|
||||
// 3. NodeHostName
|
||||
// 2. NodeInternalDNS
|
||||
// 3. NodeExternalIP
|
||||
// 4. NodeExternalDNS
|
||||
// 5. NodeLegacyHostIP
|
||||
// 6. NodeHostName
|
||||
//
|
||||
// Derived from k8s.io/kubernetes/pkg/util/node/node.go
|
||||
func nodeAddress(node *apiv1.Node) (string, map[apiv1.NodeAddressType][]string, error) {
|
||||
|
@ -210,9 +212,15 @@ func nodeAddress(node *apiv1.Node) (string, map[apiv1.NodeAddressType][]string,
|
|||
if addresses, ok := m[apiv1.NodeInternalIP]; ok {
|
||||
return addresses[0], m, nil
|
||||
}
|
||||
if addresses, ok := m[apiv1.NodeInternalDNS]; ok {
|
||||
return addresses[0], m, nil
|
||||
}
|
||||
if addresses, ok := m[apiv1.NodeExternalIP]; ok {
|
||||
return addresses[0], m, nil
|
||||
}
|
||||
if addresses, ok := m[apiv1.NodeExternalDNS]; ok {
|
||||
return addresses[0], m, nil
|
||||
}
|
||||
if addresses, ok := m[apiv1.NodeAddressType(NodeLegacyHostIP)]; ok {
|
||||
return addresses[0], m, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue