Skip to content

Commit

Permalink
Merge pull request #86720 from hubv/automated-cherry-pick-of-#86001-u…
Browse files Browse the repository at this point in the history
…pstream-release-1.17

Automated cherry pick of #86001: Fix IPv6 addresses lost issue in pure ipv6 vsphere
  • Loading branch information
k8s-ci-robot committed Jan 9, 2020
2 parents 67041ad + 60c9a83 commit 4fe584a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4fe584a

Please sign in to comment.