Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPv6 addresses lost issue in pure ipv6 vsphere environment #86001

Merged
merged 1 commit into from Dec 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere.go
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