This commit is contained in:
Chris O'Haver 2018-10-10 15:28:45 -04:00 committed by John Belamaric
parent 8432f14207
commit 974ed086f2
13 changed files with 291 additions and 380 deletions

View file

@ -28,14 +28,18 @@ func (k *Kubernetes) localNodeName() string {
}
// Find endpoint matching localIP
for _, ep := range k.APIConn.EpIndexReverse(localIP.String()) {
for _, eps := range ep.Subsets {
for _, addr := range eps.Addresses {
if localIP.Equal(net.ParseIP(addr.IP)) {
return addr.NodeName
}
ep := k.APIConn.EpIndexReverse(localIP.String())
if ep == nil {
return ""
}
for _, eps := range ep.Subsets {
for _, addr := range eps.Addresses {
if localIP.Equal(net.ParseIP(addr.IP)) {
return addr.NodeName
}
}
}
return ""
}