mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 09:57:52 +00:00
Only detecting stale connections for UDP ports in kube-proxy.
The detectStaleConnections function in kube-proxy is very expensive in terms of CPU utilization. The results of this function are only actually used for UDP ports. This adds a protocol attribute to ServicePortName to make it simple to only run this function for UDP connections. For clusters with primarily TCP connections this can improve kube-proxy performance by 2x.
This commit is contained in:
@@ -299,7 +299,7 @@ func (sct *ServiceChangeTracker) serviceToServiceMap(service *v1.Service) Servic
|
||||
serviceMap := make(ServiceMap)
|
||||
for i := range service.Spec.Ports {
|
||||
servicePort := &service.Spec.Ports[i]
|
||||
svcPortName := ServicePortName{NamespacedName: svcName, Port: servicePort.Name}
|
||||
svcPortName := ServicePortName{NamespacedName: svcName, Port: servicePort.Name, Protocol: servicePort.Protocol}
|
||||
baseSvcInfo := sct.newBaseServiceInfo(servicePort, service)
|
||||
if sct.makeServiceInfo != nil {
|
||||
serviceMap[svcPortName] = sct.makeServiceInfo(servicePort, service, baseSvcInfo)
|
||||
|
Reference in New Issue
Block a user