Merge pull request #96251 from ravens/nodeport_udp_conntrack_fix

Correctly fix clearing conntrack entry on endpoint changes (nodeport)
This commit is contained in:
Kubernetes Prow Robot 2020-11-06 14:25:37 -08:00 committed by GitHub
commit 48a2bca893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -768,9 +768,11 @@ func (proxier *Proxier) deleteEndpointConnections(connectionMap []proxy.ServiceE
var err error
if nodePort != 0 {
err = conntrack.ClearEntriesForPortNAT(proxier.exec, endpointIP, nodePort, svcProto)
} else {
err = conntrack.ClearEntriesForNAT(proxier.exec, svcInfo.ClusterIP().String(), endpointIP, svcProto)
if err != nil {
klog.Errorf("Failed to delete nodeport-related %s endpoint connections, error: %v", epSvcPair.ServicePortName.String(), err)
}
}
err = conntrack.ClearEntriesForNAT(proxier.exec, svcInfo.ClusterIP().String(), endpointIP, svcProto)
if err != nil {
klog.Errorf("Failed to delete %s endpoint connections, error: %v", epSvcPair.ServicePortName.String(), err)
}