Updating after merging with a conflicting commit

This commit is contained in:
Basant Amarkhed
2020-11-13 23:17:30 +00:00
parent 85cd7c530b
commit 8fb895f3f1
6 changed files with 82 additions and 51 deletions

View File

@@ -156,15 +156,25 @@ func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, servic
// services, this is actually expected. Hence we downgraded from reporting by events
// to just log lines with high verbosity
var incorrectIPs []string
info.externalIPs, incorrectIPs = utilproxy.FilterIncorrectIPVersion(service.Spec.ExternalIPs, sct.ipFamily)
if len(incorrectIPs) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following external IPs(%s) for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(incorrectIPs, ","), service.Namespace, service.Name)
isCIDR := false
ipFamilyIPMap := utilproxy.MapIPsToIPFamily(service.Spec.ExternalIPs, isCIDR)
info.externalIPs = ipFamilyIPMap[sct.ipFamily]
for ipFam, ips := range ipFamilyIPMap {
// Log the IPs not matching the ipFamily
if ipFam != sct.ipFamily && len(ips) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following external IPs(%s) for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(ips, ","), service.Namespace, service.Name)
}
}
info.loadBalancerSourceRanges, incorrectIPs = utilproxy.FilterIncorrectCIDRVersion(loadBalancerSourceRanges, sct.ipFamily)
if len(incorrectIPs) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following load balancer source ranges(%s) for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(incorrectIPs, ","), service.Namespace, service.Name)
isCIDR = true
ipFamilyCIDRMap := utilproxy.MapIPsToIPFamily(loadBalancerSourceRanges, isCIDR)
info.loadBalancerSourceRanges = ipFamilyCIDRMap[sct.ipFamily]
for ipFam, cidrs := range ipFamilyCIDRMap {
// Log the CIDRs not matching the ipFamily
if ipFam != sct.ipFamily && len(cidrs) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following load balancer source ranges(%s) for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(cidrs, ","), service.Namespace, service.Name)
}
}
// Obtain Load Balancer Ingress IPs
@@ -174,14 +184,17 @@ func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, servic
}
if len(ips) > 0 {
correctIPs, incorrectIPs := utilproxy.FilterIncorrectIPVersion(ips, sct.ipFamily)
isCIDR := false
ipFamilyIPMap := utilproxy.MapIPsToIPFamily(ips, isCIDR)
if len(incorrectIPs) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following load balancer(%s) ingress ips for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(incorrectIPs, ","), service.Namespace, service.Name)
for ipFam, ipList := range ipFamilyIPMap {
if ipFam != sct.ipFamily && len(ipList) > 0 {
klog.V(4).Infof("service change tracker(%v) ignored the following load balancer(%s) ingress ips for service %v/%v as they don't match IPFamily", sct.ipFamily, strings.Join(ipList, ","), service.Namespace, service.Name)
}
}
// Create the LoadBalancerStatus with the filtered IPs
for _, ip := range correctIPs {
for _, ip := range ipFamilyIPMap[sct.ipFamily] {
info.loadBalancerStatus.Ingress = append(info.loadBalancerStatus.Ingress, v1.LoadBalancerIngress{IP: ip})
}
}