Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion go-controller/pkg/node/default_node_network_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1474,13 +1474,24 @@ func (nc *DefaultNodeNetworkController) reconcileConntrackUponEndpointSliceEvent
klog.Errorf("Failed to get service port for endpoint %s: %v", oldIPStr, err)
continue
}
// upon update and delete events, flush conntrack only for UDP
// upon update and delete events, flush UDP conntrack for Service port
klog.V(5).Infof("Deleting conntrack entry for endpoint %s, port %d, protocol %s", oldIPStr, servicePort.Port, *oldPort.Protocol)
if err := util.DeleteConntrackServicePort(oldIPStr, servicePort.Port, *oldPort.Protocol,
netlink.ConntrackReplyAnyIP, nil); err != nil {
klog.Errorf("Failed to delete conntrack entry for %s port %d: %v", oldIPStr, servicePort.Port, err)
errors = append(errors, err)
}

// Flush UDP conntrack entries for NodePort (and LoadBalancer services that allocate NodePorts)
// TODO: Once vishvananda/netlink support ConntrackFilterType '--reply-port-src', we can use one DeleteConntrackServicePort() call
// conntrack entries for both ClusterIP and NodePort.
if util.ServiceTypeHasNodePort(svc) && servicePort.NodePort > 0 {
if err := util.DeleteConntrackServicePort(oldIPStr, servicePort.NodePort, *oldPort.Protocol,
netlink.ConntrackReplyAnyIP, nil); err != nil {
klog.Errorf("Failed to delete conntrack entry for %s NodePort %d: %v", oldIPStr, servicePort.NodePort, err)
errors = append(errors, err)
}
}
}
}
}
Expand Down
Loading