mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 19:28:16 +00:00
Unexport BaseEndpointInfo fields, fix getter names
BaseEndpointInfo's fields, unlike BaseServicePortInfo's, were all exported, which then required adding "Get" before some of the function names in Endpoint so they wouldn't conflict. Fix that, now that the iptables and ipvs unit tests don't need to be able to construct BaseEndpointInfos by hand.
This commit is contained in:
@@ -43,77 +43,79 @@ var supportedEndpointSliceAddressTypes = sets.New[string](
|
||||
// or can be used for constructing a more specific EndpointInfo struct
|
||||
// defined by the proxier if needed.
|
||||
type BaseEndpointInfo struct {
|
||||
Endpoint string // TODO: should be an endpointString type
|
||||
// IsLocal indicates whether the endpoint is running in same host as kube-proxy.
|
||||
IsLocal bool
|
||||
endpoint string // TODO: should be an endpointString type
|
||||
|
||||
// ZoneHints represent the zone hints for the endpoint. This is based on
|
||||
// endpoint.hints.forZones[*].name in the EndpointSlice API.
|
||||
ZoneHints sets.Set[string]
|
||||
// Ready indicates whether this endpoint is ready and NOT terminating, unless
|
||||
// isLocal indicates whether the endpoint is running on same host as kube-proxy.
|
||||
isLocal bool
|
||||
|
||||
// ready indicates whether this endpoint is ready and NOT terminating, unless
|
||||
// PublishNotReadyAddresses is set on the service, in which case it will just
|
||||
// always be true.
|
||||
Ready bool
|
||||
// Serving indicates whether this endpoint is ready regardless of its terminating state.
|
||||
ready bool
|
||||
// serving indicates whether this endpoint is ready regardless of its terminating state.
|
||||
// For pods this is true if it has a ready status regardless of its deletion timestamp.
|
||||
Serving bool
|
||||
// Terminating indicates whether this endpoint is terminating.
|
||||
serving bool
|
||||
// terminating indicates whether this endpoint is terminating.
|
||||
// For pods this is true if it has a non-nil deletion timestamp.
|
||||
Terminating bool
|
||||
terminating bool
|
||||
|
||||
// zoneHints represent the zone hints for the endpoint. This is based on
|
||||
// endpoint.hints.forZones[*].name in the EndpointSlice API.
|
||||
zoneHints sets.Set[string]
|
||||
}
|
||||
|
||||
var _ Endpoint = &BaseEndpointInfo{}
|
||||
|
||||
// String is part of proxy.Endpoint interface.
|
||||
func (info *BaseEndpointInfo) String() string {
|
||||
return info.Endpoint
|
||||
return info.endpoint
|
||||
}
|
||||
|
||||
// GetIsLocal is part of proxy.Endpoint interface.
|
||||
func (info *BaseEndpointInfo) GetIsLocal() bool {
|
||||
return info.IsLocal
|
||||
// IP returns just the IP part of the endpoint, it's a part of proxy.Endpoint interface.
|
||||
func (info *BaseEndpointInfo) IP() string {
|
||||
return proxyutil.IPPart(info.endpoint)
|
||||
}
|
||||
|
||||
// Port returns just the Port part of the endpoint.
|
||||
func (info *BaseEndpointInfo) Port() (int, error) {
|
||||
return proxyutil.PortPart(info.endpoint)
|
||||
}
|
||||
|
||||
// IsLocal is part of proxy.Endpoint interface.
|
||||
func (info *BaseEndpointInfo) IsLocal() bool {
|
||||
return info.isLocal
|
||||
}
|
||||
|
||||
// IsReady returns true if an endpoint is ready and not terminating.
|
||||
func (info *BaseEndpointInfo) IsReady() bool {
|
||||
return info.Ready
|
||||
return info.ready
|
||||
}
|
||||
|
||||
// IsServing returns true if an endpoint is ready, regardless of if the
|
||||
// endpoint is terminating.
|
||||
func (info *BaseEndpointInfo) IsServing() bool {
|
||||
return info.Serving
|
||||
return info.serving
|
||||
}
|
||||
|
||||
// IsTerminating retruns true if an endpoint is terminating. For pods,
|
||||
// that is any pod with a deletion timestamp.
|
||||
func (info *BaseEndpointInfo) IsTerminating() bool {
|
||||
return info.Terminating
|
||||
return info.terminating
|
||||
}
|
||||
|
||||
// GetZoneHints returns the zone hint for the endpoint.
|
||||
func (info *BaseEndpointInfo) GetZoneHints() sets.Set[string] {
|
||||
return info.ZoneHints
|
||||
// ZoneHints returns the zone hint for the endpoint.
|
||||
func (info *BaseEndpointInfo) ZoneHints() sets.Set[string] {
|
||||
return info.zoneHints
|
||||
}
|
||||
|
||||
// IP returns just the IP part of the endpoint, it's a part of proxy.Endpoint interface.
|
||||
func (info *BaseEndpointInfo) IP() string {
|
||||
return proxyutil.IPPart(info.Endpoint)
|
||||
}
|
||||
|
||||
// Port returns just the Port part of the endpoint.
|
||||
func (info *BaseEndpointInfo) Port() (int, error) {
|
||||
return proxyutil.PortPart(info.Endpoint)
|
||||
}
|
||||
|
||||
func newBaseEndpointInfo(IP string, port int, isLocal, ready, serving, terminating bool, zoneHints sets.Set[string]) *BaseEndpointInfo {
|
||||
func newBaseEndpointInfo(ip string, port int, isLocal, ready, serving, terminating bool, zoneHints sets.Set[string]) *BaseEndpointInfo {
|
||||
return &BaseEndpointInfo{
|
||||
Endpoint: net.JoinHostPort(IP, strconv.Itoa(port)),
|
||||
IsLocal: isLocal,
|
||||
Ready: ready,
|
||||
Serving: serving,
|
||||
Terminating: terminating,
|
||||
ZoneHints: zoneHints,
|
||||
endpoint: net.JoinHostPort(ip, strconv.Itoa(port)),
|
||||
isLocal: isLocal,
|
||||
ready: ready,
|
||||
serving: serving,
|
||||
terminating: terminating,
|
||||
zoneHints: zoneHints,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +342,7 @@ func (em EndpointsMap) getLocalReadyEndpointIPs() map[types.NamespacedName]sets.
|
||||
continue
|
||||
}
|
||||
|
||||
if ep.GetIsLocal() {
|
||||
if ep.IsLocal() {
|
||||
nsn := svcPortName.NamespacedName
|
||||
if localIPs[nsn] == nil {
|
||||
localIPs[nsn] = sets.New[string]()
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[1]: unnamed port
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expected: map[types.NamespacedName]sets.Set[string]{},
|
||||
@@ -62,7 +62,7 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[2]: unnamed port local
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expected: map[types.NamespacedName]sets.Set[string]{
|
||||
@@ -72,12 +72,12 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[3]: named local and non-local ports for the same IP.
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.2:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.2:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expected: map[types.NamespacedName]sets.Set[string]{
|
||||
@@ -87,21 +87,21 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[4]: named local and non-local ports for different IPs.
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.22:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.2:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.22:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p23", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.3:23", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.3:23", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p44", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.4:44", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.5:44", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.4:44", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.5:44", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p45", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.6:45", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.6:45", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expected: map[types.NamespacedName]sets.Set[string]{
|
||||
@@ -112,21 +112,21 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[5]: named local and non-local ports for different IPs, some not ready.
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.22:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.2:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.22:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p23", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.3:23", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.3:23", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p44", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.4:44", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.5:44", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.4:44", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.5:44", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p45", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.6:45", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.6:45", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expected: map[types.NamespacedName]sets.Set[string]{
|
||||
@@ -137,21 +137,21 @@ func TestGetLocalEndpointIPs(t *testing.T) {
|
||||
// Case[6]: all endpoints are terminating,, so getLocalReadyEndpointIPs should return 0 ready endpoints
|
||||
endpointsMap: EndpointsMap{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "1.1.1.1:11", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.22:22", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.2:22", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.22:22", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p23", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "2.2.2.3:23", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "2.2.2.3:23", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p44", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.4:44", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.5:44", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.4:44", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.5:44", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p45", v1.ProtocolTCP): []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "4.4.4.6:45", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "4.4.4.6:45", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
},
|
||||
expected: make(map[types.NamespacedName]sets.Set[string], 0),
|
||||
@@ -555,12 +555,12 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -577,12 +577,12 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -603,18 +603,18 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -633,24 +633,24 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p13", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:13", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:13", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p13", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:13", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:13", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -673,54 +673,54 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p13", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:13", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.4:13", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:13", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.4:13", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p14", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:14", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.4:14", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:14", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.4:14", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p21", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.1:21", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "2.2.2.2:21", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.1:21", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "2.2.2.2:21", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.1:22", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.1:22", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "2.2.2.2:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p13", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:13", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.4:13", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:13", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.4:13", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p14", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.3:14", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.4:14", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.3:14", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.4:14", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p21", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.1:21", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "2.2.2.2:21", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.1:21", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "2.2.2.2:21", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.1:22", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.1:22", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "2.2.2.2:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -741,7 +741,7 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -762,7 +762,7 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{},
|
||||
@@ -783,17 +783,17 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -814,17 +814,17 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:11", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:11", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{{
|
||||
@@ -852,15 +852,15 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -883,15 +883,15 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{{
|
||||
@@ -911,12 +911,12 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11-2", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{{
|
||||
@@ -938,12 +938,12 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:22", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:22", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{{
|
||||
@@ -983,39 +983,39 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p22", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.22:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "2.2.2.2:22", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.22:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "2.2.2.2:22", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns2", "ep2", "p23", v1.ProtocolUDP): {
|
||||
{Endpoint: "2.2.2.3:23", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "2.2.2.3:23", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p44", v1.ProtocolUDP): {
|
||||
{Endpoint: "4.4.4.4:44", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "4.4.4.5:44", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "4.4.4.4:44", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "4.4.4.5:44", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p45", v1.ProtocolUDP): {
|
||||
{Endpoint: "4.4.4.6:45", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "4.4.4.6:45", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "p11", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.11:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.11:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p12", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:12", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:12", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "ep1", "p122", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.2:122", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.2:122", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns3", "ep3", "p33", v1.ProtocolUDP): {
|
||||
{Endpoint: "3.3.3.3:33", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "3.3.3.3:33", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns4", "ep4", "p44", v1.ProtocolUDP): {
|
||||
{Endpoint: "4.4.4.4:44", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "4.4.4.4:44", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{{
|
||||
@@ -1054,7 +1054,7 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -1073,12 +1073,12 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
},
|
||||
expectedDeletedUDPEndpoints: []ServiceEndpoint{},
|
||||
@@ -1095,7 +1095,7 @@ func TestUpdateEndpointsMap(t *testing.T) {
|
||||
},
|
||||
previousEndpointsMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "ep1", "", v1.ProtocolUDP): {
|
||||
{Endpoint: "1.1.1.1:11", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
{endpoint: "1.1.1.1:11", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
},
|
||||
},
|
||||
expectedResult: map[ServicePortName][]*BaseEndpointInfo{},
|
||||
@@ -1358,14 +1358,14 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1409,22 +1409,22 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1442,20 +1442,20 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1473,12 +1473,12 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1509,14 +1509,14 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1533,12 +1533,12 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1556,18 +1556,18 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1585,18 +1585,18 @@ func TestEndpointSliceUpdate(t *testing.T) {
|
||||
expectedReturnVal: true,
|
||||
expectedCurrentChange: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: true, Ready: false, Serving: false, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: true, ready: false, serving: false, terminating: true},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: true, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:443", IsLocal: true, Ready: false, Serving: false, Terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: true, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:443", isLocal: true, ready: false, serving: false, terminating: true},
|
||||
},
|
||||
},
|
||||
expectedChangedEndpoints: sets.New[string]("ns1/svc1"),
|
||||
@@ -1655,9 +1655,9 @@ func TestCheckoutChanges(t *testing.T) {
|
||||
previous: EndpointsMap{},
|
||||
current: EndpointsMap{
|
||||
svcPortName0: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -1671,21 +1671,21 @@ func TestCheckoutChanges(t *testing.T) {
|
||||
expectedChanges: []*endpointsChange{{
|
||||
previous: EndpointsMap{
|
||||
svcPortName0: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", ready: false, serving: false, terminating: false},
|
||||
},
|
||||
svcPortName1: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
current: EndpointsMap{
|
||||
svcPortName0: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
}},
|
||||
@@ -1736,7 +1736,7 @@ func compareEndpointsMapsStr(t *testing.T, newMap EndpointsMap, expected map[Ser
|
||||
t.Fatalf("expected %d results, got %d: %v", len(expected), len(newMap), newMap)
|
||||
}
|
||||
endpointEqual := func(a, b *BaseEndpointInfo) bool {
|
||||
return a.Endpoint == b.Endpoint && a.IsLocal == b.IsLocal && a.Ready == b.Ready && a.Serving == b.Serving && a.Terminating == b.Terminating
|
||||
return a.endpoint == b.endpoint && a.isLocal == b.isLocal && a.ready == b.ready && a.serving == b.serving && a.terminating == b.terminating
|
||||
}
|
||||
for x := range expected {
|
||||
if len(newMap[x]) != len(expected[x]) {
|
||||
@@ -1751,8 +1751,8 @@ func compareEndpointsMapsStr(t *testing.T, newMap EndpointsMap, expected map[Ser
|
||||
if !endpointEqual(newEp, expected[x][i]) {
|
||||
t.Fatalf("expected new[%v][%d] to be %v, got %v"+
|
||||
"(IsLocal expected %v, got %v) (Ready expected %v, got %v) (Serving expected %v, got %v) (Terminating expected %v got %v)",
|
||||
x, i, expected[x][i], newEp, expected[x][i].IsLocal, newEp.IsLocal, expected[x][i].Ready, newEp.Ready,
|
||||
expected[x][i].Serving, newEp.Serving, expected[x][i].Terminating, newEp.Terminating)
|
||||
x, i, expected[x][i], newEp, expected[x][i].isLocal, newEp.isLocal, expected[x][i].ready, newEp.ready,
|
||||
expected[x][i].serving, newEp.serving, expected[x][i].terminating, newEp.terminating)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
makeServicePortName("ns1", "svc1", "port-1", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:443", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:443", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:443", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:443", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -63,12 +63,12 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.2.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.2.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -82,10 +82,10 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -101,16 +101,16 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.10:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.6:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.7:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.8:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.9:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.10:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.6:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.7:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.8:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.9:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -123,16 +123,16 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.10:80", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:80", IsLocal: false, Ready: false, Serving: true, Terminating: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.6:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.7:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.8:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.9:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.10:80", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:80", isLocal: false, ready: false, serving: true, terminating: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.6:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.7:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.8:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.9:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -144,16 +144,16 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.10:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.4:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.5:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.6:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.7:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.8:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.9:80", IsLocal: false, Ready: false, Serving: false, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.10:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.4:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.5:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.6:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.7:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.8:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.9:80", isLocal: false, ready: false, serving: false, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -166,9 +166,9 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.3:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.3:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -193,10 +193,10 @@ func TestEndpointsMapFromESC(t *testing.T) {
|
||||
},
|
||||
expectedMap: map[ServicePortName][]*BaseEndpointInfo{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:80", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.1:8080", IsLocal: false, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:80", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.1.2:8080", IsLocal: true, Ready: true, Serving: true, Terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:80", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.1:8080", isLocal: false, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:80", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.1.2:8080", isLocal: true, ready: true, serving: true, terminating: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -233,25 +233,25 @@ func TestEndpointInfoByServicePort(t *testing.T) {
|
||||
expectedMap: spToEndpointMap{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
"10.0.1.1:80": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.1:80",
|
||||
IsLocal: false,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.1:80",
|
||||
isLocal: false,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
"10.0.1.2:80": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.2:80",
|
||||
IsLocal: true,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.2:80",
|
||||
isLocal: true,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
"10.0.1.3:80": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.3:80",
|
||||
IsLocal: false,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.3:80",
|
||||
isLocal: false,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -266,32 +266,32 @@ func TestEndpointInfoByServicePort(t *testing.T) {
|
||||
expectedMap: spToEndpointMap{
|
||||
makeServicePortName("ns1", "svc1", "port-0", v1.ProtocolTCP): {
|
||||
"10.0.1.1:80": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.1:80",
|
||||
IsLocal: false,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.1:80",
|
||||
isLocal: false,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
"10.0.1.2:80": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.2:80",
|
||||
IsLocal: true,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.2:80",
|
||||
isLocal: true,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
"10.0.1.1:8080": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.1:8080",
|
||||
IsLocal: false,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.1:8080",
|
||||
isLocal: false,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
"10.0.1.2:8080": &BaseEndpointInfo{
|
||||
Endpoint: "10.0.1.2:8080",
|
||||
IsLocal: true,
|
||||
Ready: true,
|
||||
Serving: true,
|
||||
Terminating: false,
|
||||
endpoint: "10.0.1.2:8080",
|
||||
isLocal: true,
|
||||
ready: true,
|
||||
serving: true,
|
||||
terminating: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -132,7 +132,7 @@ type endpointInfo struct {
|
||||
func newEndpointInfo(baseInfo *proxy.BaseEndpointInfo, svcPortName *proxy.ServicePortName) proxy.Endpoint {
|
||||
return &endpointInfo{
|
||||
BaseEndpointInfo: baseInfo,
|
||||
ChainName: servicePortEndpointChainName(svcPortName.String(), strings.ToLower(string(svcPortName.Protocol)), baseInfo.Endpoint),
|
||||
ChainName: servicePortEndpointChainName(svcPortName.String(), strings.ToLower(string(svcPortName.Protocol)), baseInfo.String()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
args = append(args, "-m", "recent", "--name", string(endpointChain), "--set")
|
||||
}
|
||||
// DNAT to final destination.
|
||||
args = append(args, "-m", protocol, "-p", protocol, "-j", "DNAT", "--to-destination", epInfo.Endpoint)
|
||||
args = append(args, "-m", protocol, "-p", protocol, "-j", "DNAT", "--to-destination", epInfo.String())
|
||||
natRules.Write(args)
|
||||
}
|
||||
}
|
||||
@@ -1564,7 +1564,7 @@ func (proxier *Proxier) writeServiceToEndpointRules(natRules proxyutil.LineBuffe
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
comment := fmt.Sprintf(`"%s -> %s"`, svcPortNameString, epInfo.Endpoint)
|
||||
comment := fmt.Sprintf(`"%s -> %s"`, svcPortNameString, epInfo.String())
|
||||
|
||||
args = append(args[:0],
|
||||
"-A", string(svcChain),
|
||||
@@ -1586,7 +1586,7 @@ func (proxier *Proxier) writeServiceToEndpointRules(natRules proxyutil.LineBuffe
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
comment := fmt.Sprintf(`"%s -> %s"`, svcPortNameString, epInfo.Endpoint)
|
||||
comment := fmt.Sprintf(`"%s -> %s"`, svcPortNameString, epInfo.String())
|
||||
|
||||
args = append(args[:0], "-A", string(svcChain))
|
||||
args = proxier.appendServiceCommentLocked(args, comment)
|
||||
|
||||
@@ -3387,7 +3387,7 @@ func checkEndpointExpectations(t *testing.T, tci int, newMap proxy.EndpointsMap,
|
||||
for i := range expected[x] {
|
||||
newEp := newMap[x][i]
|
||||
if newEp.String() != expected[x][i].endpoint ||
|
||||
newEp.GetIsLocal() != expected[x][i].isLocal {
|
||||
newEp.IsLocal() != expected[x][i].isLocal {
|
||||
t.Errorf("[%d] expected new[%v][%d] to be %v, got %v", tci, x, i, expected[x][i], newEp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,7 +1052,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
klog.ErrorS(nil, "Failed to cast BaseEndpointInfo", "endpoint", e)
|
||||
continue
|
||||
}
|
||||
if !ep.IsLocal {
|
||||
if !ep.IsLocal() {
|
||||
continue
|
||||
}
|
||||
epIP := ep.IP()
|
||||
|
||||
@@ -3666,7 +3666,7 @@ func checkEndpointExpectations(t *testing.T, tci int, newMap proxy.EndpointsMap,
|
||||
for i := range expected[x] {
|
||||
newEp := newMap[x][i]
|
||||
if newEp.String() != expected[x][i].endpoint ||
|
||||
newEp.GetIsLocal() != expected[x][i].isLocal {
|
||||
newEp.IsLocal() != expected[x][i].isLocal {
|
||||
t.Errorf("[%d] expected new[%v][%d] to be %v, got %v", tci, x, i, expected[x][i], newEp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ func CategorizeEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeLabels m
|
||||
for _, ep := range endpoints {
|
||||
if ep.IsReady() {
|
||||
hasAnyEndpoints = true
|
||||
if ep.GetIsLocal() {
|
||||
if ep.IsLocal() {
|
||||
hasLocalReadyEndpoints = true
|
||||
}
|
||||
} else if ep.IsServing() && ep.IsTerminating() {
|
||||
hasAnyEndpoints = true
|
||||
if ep.GetIsLocal() {
|
||||
if ep.IsLocal() {
|
||||
hasLocalServingTerminatingEndpoints = true
|
||||
}
|
||||
}
|
||||
@@ -97,12 +97,12 @@ func CategorizeEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeLabels m
|
||||
|
||||
if hasLocalReadyEndpoints {
|
||||
localEndpoints = filterEndpoints(endpoints, func(ep Endpoint) bool {
|
||||
return ep.GetIsLocal() && ep.IsReady()
|
||||
return ep.IsLocal() && ep.IsReady()
|
||||
})
|
||||
} else if hasLocalServingTerminatingEndpoints {
|
||||
useServingTerminatingEndpoints = true
|
||||
localEndpoints = filterEndpoints(endpoints, func(ep Endpoint) bool {
|
||||
return ep.GetIsLocal() && ep.IsServing() && ep.IsTerminating()
|
||||
return ep.IsLocal() && ep.IsServing() && ep.IsTerminating()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -165,12 +165,12 @@ func canUseTopology(endpoints []Endpoint, svcInfo ServicePort, nodeLabels map[st
|
||||
if !endpoint.IsReady() {
|
||||
continue
|
||||
}
|
||||
if endpoint.GetZoneHints().Len() == 0 {
|
||||
if endpoint.ZoneHints().Len() == 0 {
|
||||
klog.InfoS("Skipping topology aware endpoint filtering since one or more endpoints is missing a zone hint", "endpoint", endpoint)
|
||||
return false
|
||||
}
|
||||
|
||||
if endpoint.GetZoneHints().Has(zone) {
|
||||
if endpoint.ZoneHints().Has(zone) {
|
||||
hasEndpointForZone = true
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ func canUseTopology(endpoints []Endpoint, svcInfo ServicePort, nodeLabels map[st
|
||||
// topology constraints. (It assumes that canUseTopology() returned true.)
|
||||
func availableForTopology(endpoint Endpoint, nodeLabels map[string]string) bool {
|
||||
zone := nodeLabels[v1.LabelTopologyZone]
|
||||
return endpoint.GetZoneHints().Has(zone)
|
||||
return endpoint.ZoneHints().Has(zone)
|
||||
}
|
||||
|
||||
// filterEndpoints filters endpoints according to predicate
|
||||
|
||||
@@ -70,10 +70,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -83,10 +83,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "disabled"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -96,10 +96,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -110,10 +110,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "aUto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -123,10 +123,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -136,10 +136,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{externalPolicyLocal: true, nodePort: 8080, hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80"),
|
||||
@@ -150,10 +150,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, hintsAnnotation: "auto", externalPolicyLocal: false, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80"),
|
||||
@@ -164,7 +164,7 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -174,7 +174,7 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: ""},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -184,7 +184,7 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-b"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -194,10 +194,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -207,10 +207,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -220,10 +220,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.4:80", "10.1.2.5:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -233,10 +233,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "Auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -246,10 +246,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: ""},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -259,10 +259,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "disabled"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -272,10 +272,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: nil, Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-a"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: nil, ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -285,10 +285,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-c"},
|
||||
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.3:80", ZoneHints: sets.New[string]("zone-a", "zone-b", "zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.4:80", ZoneHints: sets.New[string]("zone-b", "zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.5:80", ZoneHints: sets.New[string]("zone-b", "zone-d"), Ready: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.1.2.6:80", ZoneHints: sets.New[string]("zone-c"), Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a", "zone-b", "zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b", "zone-c"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-b", "zone-d"), ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-c"), ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.6:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -298,10 +298,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: false, externalPolicyLocal: true, nodePort: 8080, hintsAnnotation: "auto"},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", ZoneHints: sets.New[string]("zone-a"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", ZoneHints: sets.New[string]("zone-b"), Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.2:80", ZoneHints: sets.New[string]("zone-a"), Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.3:80", ZoneHints: sets.New[string]("zone-b"), Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.2:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.3:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.2:80"),
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
@@ -316,8 +316,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "internalTrafficPolicy: Local, but all endpoints are remote",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: nil,
|
||||
localEndpoints: sets.New[string](),
|
||||
@@ -326,8 +326,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "internalTrafficPolicy: Local, all endpoints are local",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: true},
|
||||
},
|
||||
clusterEndpoints: nil,
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
@@ -335,8 +335,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "internalTrafficPolicy: Local, some endpoints are local",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: nil,
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80"),
|
||||
@@ -344,8 +344,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "Cluster traffic policy, endpoints not Ready",
|
||||
serviceInfo: &BaseServicePortInfo{},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string](),
|
||||
localEndpoints: nil,
|
||||
@@ -353,8 +353,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "Cluster traffic policy, some endpoints are Ready",
|
||||
serviceInfo: &BaseServicePortInfo{},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.1:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -363,8 +363,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
pteEnabled: true,
|
||||
serviceInfo: &BaseServicePortInfo{},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: false, Serving: true, Terminating: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: false, Serving: true, Terminating: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: false, serving: true, terminating: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: false, serving: true, terminating: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -372,8 +372,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "iTP: Local, eTP: Cluster, some endpoints local",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, externalPolicyLocal: false, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80"),
|
||||
@@ -382,8 +382,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "iTP: Cluster, eTP: Local, some endpoints local",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: false, externalPolicyLocal: true, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80"),
|
||||
@@ -392,8 +392,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "iTP: Local, eTP: Local, some endpoints local",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, externalPolicyLocal: true, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: sets.New[string]("10.0.0.0:80"),
|
||||
@@ -402,8 +402,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "iTP: Local, eTP: Local, all endpoints remote",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, externalPolicyLocal: true, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: sets.New[string](),
|
||||
@@ -413,8 +413,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
pteEnabled: true,
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, externalPolicyLocal: true, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: false, Serving: true, Terminating: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: false, Serving: true, Terminating: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: false, serving: true, terminating: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: false, serving: true, terminating: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: sets.New[string](),
|
||||
@@ -425,10 +425,10 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
pteEnabled: true,
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: false, externalPolicyLocal: true, nodePort: 8080},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: false, Serving: false, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.2:80", Ready: false, Serving: true, Terminating: true, IsLocal: true},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.3:80", Ready: false, Serving: true, Terminating: true, IsLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: false, serving: false, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.2:80", ready: false, serving: true, terminating: true, isLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.3:80", ready: false, serving: true, terminating: true, isLocal: false},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80"),
|
||||
localEndpoints: sets.New[string]("10.0.0.2:80"),
|
||||
@@ -437,8 +437,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "externalTrafficPolicy ignored if not externally accessible",
|
||||
serviceInfo: &BaseServicePortInfo{externalPolicyLocal: true},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: true},
|
||||
},
|
||||
clusterEndpoints: sets.New[string]("10.0.0.0:80", "10.0.0.1:80"),
|
||||
localEndpoints: nil,
|
||||
@@ -447,8 +447,8 @@ func TestCategorizeEndpoints(t *testing.T) {
|
||||
name: "no cluster endpoints for iTP:Local internal-only service",
|
||||
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true},
|
||||
endpoints: []Endpoint{
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.0:80", Ready: true, IsLocal: false},
|
||||
&BaseEndpointInfo{Endpoint: "10.0.0.1:80", Ready: true, IsLocal: true},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.0:80", ready: true, isLocal: false},
|
||||
&BaseEndpointInfo{endpoint: "10.0.0.1:80", ready: true, isLocal: true},
|
||||
},
|
||||
clusterEndpoints: nil,
|
||||
localEndpoints: sets.New[string]("10.0.0.1:80"),
|
||||
|
||||
@@ -108,8 +108,13 @@ type Endpoint interface {
|
||||
// String returns endpoint string. An example format can be: `IP:Port`.
|
||||
// We take the returned value as ServiceEndpoint.Endpoint.
|
||||
String() string
|
||||
// GetIsLocal returns true if the endpoint is running in same host as kube-proxy, otherwise returns false.
|
||||
GetIsLocal() bool
|
||||
// IP returns IP part of the endpoint.
|
||||
IP() string
|
||||
// Port returns the Port part of the endpoint.
|
||||
Port() (int, error)
|
||||
|
||||
// IsLocal returns true if the endpoint is running on the same host as kube-proxy.
|
||||
IsLocal() bool
|
||||
// IsReady returns true if an endpoint is ready and not terminating, or
|
||||
// if PublishNotReadyAddresses is set on the service.
|
||||
IsReady() bool
|
||||
@@ -119,13 +124,10 @@ type Endpoint interface {
|
||||
// IsTerminating returns true if an endpoint is terminating. For pods,
|
||||
// that is any pod with a deletion timestamp.
|
||||
IsTerminating() bool
|
||||
// GetZoneHints returns the zone hint for the endpoint. This is based on
|
||||
|
||||
// ZoneHints returns the zone hint for the endpoint. This is based on
|
||||
// endpoint.hints.forZones[0].name in the EndpointSlice API.
|
||||
GetZoneHints() sets.Set[string]
|
||||
// IP returns IP part of the endpoint.
|
||||
IP() string
|
||||
// Port returns the Port part of the endpoint.
|
||||
Port() (int, error)
|
||||
ZoneHints() sets.Set[string]
|
||||
}
|
||||
|
||||
// ServiceEndpoint is used to identify a service and one of its endpoint pair.
|
||||
|
||||
@@ -171,7 +171,7 @@ func logFormattedEndpoints(logMsg string, logLevel klog.Level, svcPortName proxy
|
||||
if klog.V(logLevel).Enabled() {
|
||||
var epInfo string
|
||||
for _, v := range eps {
|
||||
epInfo = epInfo + fmt.Sprintf("\n %s={Ready:%v,Serving:%v,Terminating:%v,IsRemote:%v}", v.String(), v.IsReady(), v.IsServing(), v.IsTerminating(), !v.GetIsLocal())
|
||||
epInfo = epInfo + fmt.Sprintf("\n %s={Ready:%v,Serving:%v,Terminating:%v,IsRemote:%v}", v.String(), v.IsReady(), v.IsServing(), v.IsTerminating(), !v.IsLocal())
|
||||
}
|
||||
klog.V(logLevel).InfoS(logMsg, "svcPortName", svcPortName, "endpoints", epInfo)
|
||||
}
|
||||
@@ -294,8 +294,8 @@ func (info *endpointInfo) String() string {
|
||||
return net.JoinHostPort(info.ip, strconv.Itoa(int(info.port)))
|
||||
}
|
||||
|
||||
// GetIsLocal is part of proxy.Endpoint interface.
|
||||
func (info *endpointInfo) GetIsLocal() bool {
|
||||
// IsLocal is part of proxy.Endpoint interface.
|
||||
func (info *endpointInfo) IsLocal() bool {
|
||||
return info.isLocal
|
||||
}
|
||||
|
||||
@@ -314,8 +314,8 @@ func (info *endpointInfo) IsTerminating() bool {
|
||||
return info.terminating
|
||||
}
|
||||
|
||||
// GetZoneHint returns the zone hint for the endpoint.
|
||||
func (info *endpointInfo) GetZoneHints() sets.Set[string] {
|
||||
// ZoneHints returns the zone hints for the endpoint.
|
||||
func (info *endpointInfo) ZoneHints() sets.Set[string] {
|
||||
return sets.Set[string]{}
|
||||
}
|
||||
|
||||
@@ -445,15 +445,15 @@ func (proxier *Proxier) newEndpointInfo(baseInfo *proxy.BaseEndpointInfo, _ *pro
|
||||
info := &endpointInfo{
|
||||
ip: baseInfo.IP(),
|
||||
port: uint16(portNumber),
|
||||
isLocal: baseInfo.GetIsLocal(),
|
||||
isLocal: baseInfo.IsLocal(),
|
||||
macAddress: conjureMac("02-11", netutils.ParseIPSloppy(baseInfo.IP())),
|
||||
refCount: new(uint16),
|
||||
hnsID: "",
|
||||
hns: proxier.hns,
|
||||
|
||||
ready: baseInfo.Ready,
|
||||
serving: baseInfo.Serving,
|
||||
terminating: baseInfo.Terminating,
|
||||
ready: baseInfo.IsReady(),
|
||||
serving: baseInfo.IsServing(),
|
||||
terminating: baseInfo.IsTerminating(),
|
||||
}
|
||||
|
||||
return info
|
||||
@@ -476,20 +476,20 @@ func newSourceVIP(hns HostNetworkService, network string, ip string, mac string,
|
||||
|
||||
func (ep *endpointInfo) DecrementRefCount() {
|
||||
klog.V(3).InfoS("Decrementing Endpoint RefCount", "endpointInfo", ep)
|
||||
if !ep.GetIsLocal() && ep.refCount != nil && *ep.refCount > 0 {
|
||||
if !ep.IsLocal() && ep.refCount != nil && *ep.refCount > 0 {
|
||||
*ep.refCount--
|
||||
}
|
||||
}
|
||||
|
||||
func (ep *endpointInfo) Cleanup() {
|
||||
klog.V(3).InfoS("Endpoint cleanup", "endpointInfo", ep)
|
||||
if !ep.GetIsLocal() && ep.refCount != nil {
|
||||
if !ep.IsLocal() && ep.refCount != nil {
|
||||
*ep.refCount--
|
||||
|
||||
// Remove the remote hns endpoint, if no service is referring it
|
||||
// Never delete a Local Endpoint. Local Endpoints are already created by other entities.
|
||||
// Remove only remote endpoints created by this service
|
||||
if *ep.refCount <= 0 && !ep.GetIsLocal() {
|
||||
if *ep.refCount <= 0 && !ep.IsLocal() {
|
||||
klog.V(4).InfoS("Removing endpoints, since no one is referencing it", "endpoint", ep)
|
||||
err := ep.hns.deleteEndpoint(ep.hnsID)
|
||||
if err == nil {
|
||||
@@ -1047,7 +1047,7 @@ func (proxier *Proxier) isAllEndpointsTerminating(svcName proxy.ServicePortName,
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if isLocalTrafficDSR && !ep.GetIsLocal() {
|
||||
if isLocalTrafficDSR && !ep.IsLocal() {
|
||||
// KEP-1669: Ignore remote endpoints when the ExternalTrafficPolicy is Local (DSR Mode)
|
||||
continue
|
||||
}
|
||||
@@ -1072,7 +1072,7 @@ func (proxier *Proxier) isAllEndpointsNonServing(svcName proxy.ServicePortName,
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if isLocalTrafficDSR && !ep.GetIsLocal() {
|
||||
if isLocalTrafficDSR && !ep.IsLocal() {
|
||||
continue
|
||||
}
|
||||
if ep.IsServing() {
|
||||
@@ -1236,7 +1236,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
continue
|
||||
}
|
||||
|
||||
if svcInfo.internalTrafficLocal && svcInfo.localTrafficDSR && !ep.GetIsLocal() {
|
||||
if svcInfo.internalTrafficLocal && svcInfo.localTrafficDSR && !ep.IsLocal() {
|
||||
// No need to use or create remote endpoint when internal and external traffic policy is remote
|
||||
klog.V(3).InfoS("Skipping the endpoint. Both internalTraffic and external traffic policies are local", "EpIP", ep.ip, " EpPort", ep.port)
|
||||
continue
|
||||
@@ -1279,7 +1279,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
}
|
||||
|
||||
if newHnsEndpoint == nil {
|
||||
if ep.GetIsLocal() {
|
||||
if ep.IsLocal() {
|
||||
klog.ErrorS(err, "Local endpoint not found: on network", "ip", ep.IP(), "hnsNetworkName", hnsNetworkName)
|
||||
continue
|
||||
}
|
||||
@@ -1340,7 +1340,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
// a) Endpoints are any IP's outside the cluster ==> Choose NodeIP as the SourceVIP
|
||||
// b) Endpoints are IP addresses of a remote node => Choose NodeIP as the SourceVIP
|
||||
// c) Everything else (Local POD's, Remote POD's, Node IP of current node) ==> Choose the configured SourceVIP
|
||||
if strings.EqualFold(proxier.network.networkType, NETWORK_TYPE_OVERLAY) && !ep.GetIsLocal() {
|
||||
if strings.EqualFold(proxier.network.networkType, NETWORK_TYPE_OVERLAY) && !ep.IsLocal() {
|
||||
providerAddress := proxier.network.findRemoteSubnetProviderAddress(ep.IP())
|
||||
|
||||
isNodeIP := (ep.IP() == providerAddress)
|
||||
@@ -1355,7 +1355,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
klog.V(1).InfoS("Hns endpoint resource", "endpointInfo", newHnsEndpoint)
|
||||
|
||||
hnsEndpoints = append(hnsEndpoints, *newHnsEndpoint)
|
||||
if newHnsEndpoint.GetIsLocal() {
|
||||
if newHnsEndpoint.IsLocal() {
|
||||
hnsLocalEndpoints = append(hnsLocalEndpoints, *newHnsEndpoint)
|
||||
} else {
|
||||
// We only share the refCounts for remote endpoints
|
||||
|
||||
Reference in New Issue
Block a user