pkg/proxy: remove equal method from endpoint interface

Signed-off-by: Daman Arora <aroradaman@gmail.com>
This commit is contained in:
Daman Arora 2023-08-27 18:16:44 +05:30
parent c4f4e3bc43
commit 01df59a73b
3 changed files with 3 additions and 23 deletions

View File

@ -117,13 +117,6 @@ func (info *BaseEndpointInfo) Port() (int, error) {
return proxyutil.PortPart(info.Endpoint)
}
// Equal is part of proxy.Endpoint interface.
func (info *BaseEndpointInfo) Equal(other Endpoint) bool {
return info.String() == other.String() &&
info.GetIsLocal() == other.GetIsLocal() &&
info.IsReady() == other.IsReady()
}
// GetNodeName returns the NodeName for this endpoint.
func (info *BaseEndpointInfo) GetNodeName() string {
return info.NodeName
@ -425,7 +418,9 @@ func detectStaleConntrackEntries(oldEndpointsMap, newEndpointsMap EndpointsMap,
// ready to not ready. If it did change stale entries for the old
// endpoint have to be cleared.
for i := range newEndpointsMap[svcPortName] {
if newEndpointsMap[svcPortName][i].Equal(ep) {
if newEndpointsMap[svcPortName][i].String() == ep.String() &&
newEndpointsMap[svcPortName][i].IsReady() == ep.IsReady() &&
newEndpointsMap[svcPortName][i].GetIsLocal() == ep.GetIsLocal() {
deleted = false
break
}

View File

@ -136,19 +136,6 @@ func newEndpointInfo(baseInfo *proxy.BaseEndpointInfo, svcPortName *proxy.Servic
}
}
// Equal overrides the Equal() function implemented by proxy.BaseEndpointInfo.
func (e *endpointsInfo) Equal(other proxy.Endpoint) bool {
o, ok := other.(*endpointsInfo)
if !ok {
klog.ErrorS(nil, "Failed to cast endpointsInfo")
return false
}
return e.Endpoint == o.Endpoint &&
e.IsLocal == o.IsLocal &&
e.ChainName == o.ChainName &&
e.Ready == o.Ready
}
// Proxier is an iptables based proxy for connections between a localhost:lport
// and services that provide the actual backends.
type Proxier struct {

View File

@ -131,8 +131,6 @@ type Endpoint interface {
IP() string
// Port returns the Port part of the endpoint.
Port() (int, error)
// Equal checks if two endpoints are equal.
Equal(Endpoint) bool
// GetNodeName returns the node name for the endpoint
GetNodeName() string
// GetZone returns the zone for the endpoint