mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Remove conntrack entries from loadbalancer ip too.
This commit is contained in:
parent
cd2d33eaa3
commit
24d3ab83dc
@ -619,6 +619,12 @@ func (proxier *Proxier) deleteEndpointConnections(connectionMap []proxy.ServiceE
|
|||||||
klog.Errorf("Failed to delete %s endpoint connections for externalIP %s, error: %v", epSvcPair.ServicePortName.String(), extIP, err)
|
klog.Errorf("Failed to delete %s endpoint connections for externalIP %s, error: %v", epSvcPair.ServicePortName.String(), extIP, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, lbIP := range svcInfo.LoadBalancerIPStrings() {
|
||||||
|
err := conntrack.ClearEntriesForNAT(proxier.exec, lbIP, endpointIP, v1.ProtocolUDP)
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("Failed to delete %s endpoint connections for LoabBalancerIP %s, error: %v", epSvcPair.ServicePortName.String(), lbIP, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1499,6 +1499,12 @@ func (proxier *Proxier) deleteEndpointConnections(connectionMap []proxy.ServiceE
|
|||||||
klog.Errorf("Failed to delete %s endpoint connections for externalIP %s, error: %v", epSvcPair.ServicePortName.String(), extIP, err)
|
klog.Errorf("Failed to delete %s endpoint connections for externalIP %s, error: %v", epSvcPair.ServicePortName.String(), extIP, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, lbIP := range svcInfo.LoadBalancerIPStrings() {
|
||||||
|
err := conntrack.ClearEntriesForNAT(proxier.exec, lbIP, endpointIP, v1.ProtocolUDP)
|
||||||
|
if err != nil {
|
||||||
|
klog.Errorf("Failed to delete %s endpoint connections for LoabBalancerIP %s, error: %v", epSvcPair.ServicePortName.String(), lbIP, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,11 +78,21 @@ func (info *BaseServiceInfo) GetHealthCheckNodePort() int {
|
|||||||
func (info *BaseServiceInfo) GetNodePort() int {
|
func (info *BaseServiceInfo) GetNodePort() int {
|
||||||
return info.NodePort
|
return info.NodePort
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExternalIPStrings is part of ServicePort interface.
|
// ExternalIPStrings is part of ServicePort interface.
|
||||||
func (info *BaseServiceInfo) ExternalIPStrings() []string {
|
func (info *BaseServiceInfo) ExternalIPStrings() []string {
|
||||||
return info.ExternalIPs
|
return info.ExternalIPs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadBalancerIPStrings is part of ServicePort interface.
|
||||||
|
func (info *BaseServiceInfo) LoadBalancerIPStrings() []string {
|
||||||
|
var ips []string
|
||||||
|
for _, ing := range info.LoadBalancerStatus.Ingress {
|
||||||
|
ips = append(ips, ing.IP)
|
||||||
|
}
|
||||||
|
return ips
|
||||||
|
}
|
||||||
|
|
||||||
func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, service *v1.Service) *BaseServiceInfo {
|
func (sct *ServiceChangeTracker) newBaseServiceInfo(port *v1.ServicePort, service *v1.Service) *BaseServiceInfo {
|
||||||
onlyNodeLocalEndpoints := false
|
onlyNodeLocalEndpoints := false
|
||||||
if apiservice.RequestsOnlyLocalTraffic(service) {
|
if apiservice.RequestsOnlyLocalTraffic(service) {
|
||||||
|
@ -52,6 +52,8 @@ type ServicePort interface {
|
|||||||
ClusterIPString() string
|
ClusterIPString() string
|
||||||
// ExternalIPStrings returns service ExternalIPs as a string array.
|
// ExternalIPStrings returns service ExternalIPs as a string array.
|
||||||
ExternalIPStrings() []string
|
ExternalIPStrings() []string
|
||||||
|
// LoadBalancerIPStrings returns service LoadBalancerIPs as a string array.
|
||||||
|
LoadBalancerIPStrings() []string
|
||||||
// GetProtocol returns service protocol.
|
// GetProtocol returns service protocol.
|
||||||
GetProtocol() v1.Protocol
|
GetProtocol() v1.Protocol
|
||||||
// GetHealthCheckNodePort returns service health check node port if present. If return 0, it means not present.
|
// GetHealthCheckNodePort returns service health check node port if present. If return 0, it means not present.
|
||||||
|
Loading…
Reference in New Issue
Block a user