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