From 5c7529a6fc3fea72868d5ffd70372d91229ec365 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Sat, 19 Aug 2023 11:28:30 +0000 Subject: [PATCH] kube-proxy service cache don't treat ipMode proxy address as invalid Change-Id: I4f79d4847943862dfd859325cdab075f62ef4707 --- pkg/proxy/service.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/service.go b/pkg/proxy/service.go index 1f84f0bcd1d..1ffa982f327 100644 --- a/pkg/proxy/service.go +++ b/pkg/proxy/service.go @@ -213,7 +213,19 @@ func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, servic if ing.IP == "" { continue } - if ipFamily := proxyutil.GetIPFamilyFromIP(ing.IP); ipFamily == sct.ipFamily && proxyutil.IsVIPMode(ing) { + + // proxy mode load balancers do not need to track the IPs in the service cache + // and they can also implement IP family translation, so no need to check if + // the status ingress.IP and the ClusterIP belong to the same family. + if !proxyutil.IsVIPMode(ing) { + klog.V(4).InfoS("Service change tracker ignored the following load balancer ingress IP for given Service as it using Proxy mode", + "ipFamily", sct.ipFamily, "loadBalancerIngressIP", ing.IP, "service", klog.KObj(service)) + continue + } + + // kube-proxy does not implement IP family translation, skip addresses with + // different IP family + if ipFamily := proxyutil.GetIPFamilyFromIP(ing.IP); ipFamily == sct.ipFamily { info.loadBalancerVIPs = append(info.loadBalancerVIPs, ing.IP) } else { invalidIPs = append(invalidIPs, ing.IP)