fix review

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
This commit is contained in:
Patrik Cyvoct
2020-10-30 09:20:43 +01:00
parent 88330eafef
commit 7bdf2af648
4 changed files with 6 additions and 5 deletions

View File

@@ -166,16 +166,17 @@ func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, servic
// Obtain Load Balancer Ingress IPs
var allIncorrectIPs []string
for _, ing := range service.Status.LoadBalancer.Ingress {
// []string{ing.IP} have a len of 1, so len(correctIPs) + len(incorrectIPs) == 1
correctIPs, incorrectIPs := utilproxy.FilterIncorrectIPVersion([]string{ing.IP}, sct.ipFamily)
// len is either 1 or 0
if len(correctIPs) == 1 {
// Update the LoadBalancerStatus with the filtered IPs
// Update the LoadBalancerStatus with the filtered IP
info.loadBalancerStatus.Ingress = append(info.loadBalancerStatus.Ingress, ing)
continue
}
// here len(incorrectIPs) == 1
// here len(incorrectIPs) == 1 since len(correctIPs) == 0
allIncorrectIPs = append(allIncorrectIPs, incorrectIPs[0])
}