Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions libbeat/autodiscover/providers/kubernetes/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,28 @@ func (n *node) emit(node *kubernetes.Node, flag string) {
},
}
n.publish(event)

}

// getAddress returns an IP address from a kubernetes node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Kubernetes

//
// It will use external IP if existing, falling back to Internal IP if not,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: either InternalIP or internal IP

// hostname and DNS entries are not taken into account.
func getAddress(node *kubernetes.Node) string {
nodeAddress := ""
for _, address := range node.Status.Addresses {
if address.Type == v1.NodeExternalIP && address.Address != "" {
return address.Address
if address.Address == "" {
continue
}
if address.Type == v1.NodeExternalIP {
nodeAddress = address.Address
break
}
if address.Type == v1.NodeInternalIP {
nodeAddress = address.Address
}
}

return ""
return nodeAddress
}

func isNodeReady(node *kubernetes.Node) bool {
Expand Down