[Issue:#115501] Fix for issue with Loadbalancer policy creation for IPV6 endpoints in Dualstack mode.

This commit is contained in:
Prince Pereira 2023-02-03 11:14:20 +05:30
parent fc7b25cf72
commit 5eb6f82c1a

View File

@ -112,8 +112,28 @@ func (hns hns) getAllEndpointsByNetwork(networkName string) (map[string]*(endpoi
terminating: false, terminating: false,
} }
endpointInfos[ep.IpConfigurations[0].IpAddress] = endpointInfos[ep.Id] endpointInfos[ep.IpConfigurations[0].IpAddress] = endpointInfos[ep.Id]
if len(ep.IpConfigurations) == 1 {
continue
}
// If ipFamilyPolicy is RequireDualStack or PreferDualStack, then there will be 2 IPS (iPV4 and IPV6)
// in the endpoint list
endpointDualstack := &endpointsInfo{
ip: ep.IpConfigurations[1].IpAddress,
isLocal: uint32(ep.Flags&hcn.EndpointFlagsRemoteEndpoint) == 0,
macAddress: ep.MacAddress,
hnsID: ep.Id,
hns: hns,
// only ready and not terminating endpoints were added to HNS
ready: true,
serving: true,
terminating: false,
}
endpointInfos[ep.IpConfigurations[1].IpAddress] = endpointDualstack
} }
klog.V(3).InfoS("Queried endpoints from network", "network", networkName) klog.V(3).InfoS("Queried endpoints from network", "network", networkName)
klog.V(5).InfoS("Queried endpoints details", "network", networkName, "endpointInfos", endpointInfos)
return endpointInfos, nil return endpointInfos, nil
} }