Merge pull request #86001 from hubv/hubv-patch-1

Fix IPv6 addresses lost issue in pure ipv6 vsphere environment
This commit is contained in:
Kubernetes Prow Robot 2019-12-09 01:05:10 -08:00 committed by GitHub
commit ed8a260fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -572,7 +572,7 @@ func getLocalIP() ([]v1.NodeAddress, error) {
} else {
for _, addr := range localAddrs {
if ipnet, ok := addr.(*net.IPNet); ok {
if ipnet.IP.To4() != nil {
if !ipnet.IP.IsLinkLocalUnicast() {
// Filter external IP by MAC address OUIs from vCenter and from ESX
vmMACAddr := strings.ToLower(i.HardwareAddr.String())
// Making sure that the MAC address is long enough
@ -683,7 +683,7 @@ func (vs *VSphere) NodeAddresses(ctx context.Context, nodeName k8stypes.NodeName
for _, v := range vmMoList[0].Guest.Net {
if vs.cfg.Network.PublicNetwork == v.Network {
for _, ip := range v.IpAddress {
if net.ParseIP(ip).To4() != nil {
if !net.ParseIP(ip).IsLinkLocalUnicast() {
nodehelpers.AddToNodeAddresses(&addrs,
v1.NodeAddress{
Type: v1.NodeExternalIP,