Skip to content

Commit

Permalink
feat: verify node internal address
Browse files Browse the repository at this point in the history
  • Loading branch information
askyrie authored and SongZhen0704 committed Feb 28, 2025
1 parent 3cd2f94 commit bfca9bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/controller/cloud/common/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func TidyIPString(ipsString []string) (v4Prefix, v6Prefix []netaddr.IPPrefix, er
ipS = ipS + "/32"
case strings.Contains(ipS, ":"):
ipS = ipS + "/128"
default:
continue
}
}
ipPrefix, prefixErr := netaddr.ParseIPPrefix(ipS)
Expand Down
4 changes: 4 additions & 0 deletions server/controller/cloud/kubernetes_gather/pod_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func (k *KubernetesGather) getPodNodes() (podNodes []model.PodNode, nodeNetwork,
continue
}
nIP := nodeIPitem.Get("address").MustString()
if nIP == "" {
log.Warningf("invalid node internal address (%s)", nIP)
continue
}
nodeIPs = append(nodeIPs, nIP)
}
if len(nodeIPs) == 0 {
Expand Down

0 comments on commit bfca9bc

Please sign in to comment.