Skip to content

Commit c12006e

Browse files
authored
Merge pull request kubernetes#130742 from gauravkghildiyal/kep-2433-ga
Promote TopologyAwareHints feature-gate to GA
2 parents 8de738e + 9aeeb53 commit c12006e

File tree

7 files changed

+57
-160
lines changed

7 files changed

+57
-160
lines changed

pkg/features/versioned_kube_features.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
791791
{Version: version.MustParse("1.21"), Default: false, PreRelease: featuregate.Alpha},
792792
{Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Beta},
793793
{Version: version.MustParse("1.24"), Default: true, PreRelease: featuregate.Beta},
794+
{Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
794795
},
795796

796797
TopologyManagerPolicyAlphaOptions: {

pkg/proxy/endpointslicecache.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import (
2525
discovery "k8s.io/api/discovery/v1"
2626
"k8s.io/apimachinery/pkg/types"
2727
"k8s.io/apimachinery/pkg/util/sets"
28-
utilfeature "k8s.io/apiserver/pkg/util/feature"
2928
"k8s.io/klog/v2"
30-
"k8s.io/kubernetes/pkg/features"
3129
utilnet "k8s.io/utils/net"
3230
)
3331

@@ -213,12 +211,10 @@ func (cache *EndpointSliceCache) addEndpoints(svcPortName *ServicePortName, port
213211
terminating := endpoint.Conditions.Terminating != nil && *endpoint.Conditions.Terminating
214212

215213
var zoneHints sets.Set[string]
216-
if utilfeature.DefaultFeatureGate.Enabled(features.TopologyAwareHints) {
217-
if endpoint.Hints != nil && len(endpoint.Hints.ForZones) > 0 {
218-
zoneHints = sets.New[string]()
219-
for _, zone := range endpoint.Hints.ForZones {
220-
zoneHints.Insert(zone.Name)
221-
}
214+
if endpoint.Hints != nil && len(endpoint.Hints.ForZones) > 0 {
215+
zoneHints = sets.New[string]()
216+
for _, zone := range endpoint.Hints.ForZones {
217+
zoneHints.Insert(zone.Name)
222218
}
223219
}
224220

pkg/proxy/serviceport.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ type ServicePort interface {
5656
ExternalPolicyLocal() bool
5757
// InternalPolicyLocal returns if a service has only node local endpoints for internal traffic.
5858
InternalPolicyLocal() bool
59-
// HintsAnnotation returns the value of the v1.DeprecatedAnnotationTopologyAwareHints annotation.
60-
HintsAnnotation() string
6159
// ExternallyAccessible returns true if the service port is reachable via something
6260
// other than ClusterIP (NodePort/ExternalIP/LoadBalancer)
6361
ExternallyAccessible() bool
@@ -86,7 +84,6 @@ type BaseServicePortInfo struct {
8684
healthCheckNodePort int
8785
externalPolicyLocal bool
8886
internalPolicyLocal bool
89-
hintsAnnotation string
9087
}
9188

9289
var _ ServicePort = &BaseServicePortInfo{}
@@ -156,11 +153,6 @@ func (bsvcPortInfo *BaseServicePortInfo) InternalPolicyLocal() bool {
156153
return bsvcPortInfo.internalPolicyLocal
157154
}
158155

159-
// HintsAnnotation is part of ServicePort interface.
160-
func (bsvcPortInfo *BaseServicePortInfo) HintsAnnotation() string {
161-
return bsvcPortInfo.hintsAnnotation
162-
}
163-
164156
// ExternallyAccessible is part of ServicePort interface.
165157
func (bsvcPortInfo *BaseServicePortInfo) ExternallyAccessible() bool {
166158
return bsvcPortInfo.nodePort != 0 || len(bsvcPortInfo.loadBalancerVIPs) != 0 || len(bsvcPortInfo.externalIPs) != 0
@@ -201,13 +193,6 @@ func newBaseServiceInfo(service *v1.Service, ipFamily v1.IPFamily, port *v1.Serv
201193
internalPolicyLocal: internalPolicyLocal,
202194
}
203195

204-
// v1.DeprecatedAnnotationTopologyAwareHints has precedence over v1.AnnotationTopologyMode.
205-
var exists bool
206-
info.hintsAnnotation, exists = service.Annotations[v1.DeprecatedAnnotationTopologyAwareHints]
207-
if !exists {
208-
info.hintsAnnotation = service.Annotations[v1.AnnotationTopologyMode]
209-
}
210-
211196
// Filter ExternalIPs to correct IP family
212197
ipFamilyMap := proxyutil.MapIPsByIPFamily(service.Spec.ExternalIPs)
213198
info.externalIPs = ipFamilyMap[ipFamily]

pkg/proxy/topology.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func CategorizeEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeLabels m
135135
return
136136
}
137137

138-
// canUseTopology returns true if all of the following is true:
138+
// canUseTopology returns true if all of the following are true:
139139
// - The node's labels include "topology.kubernetes.io/zone".
140140
// - All of the endpoints for this Service have a topology hint.
141141
// - At least one endpoint for this Service is hinted for this node's zone.

pkg/proxy/topology_test.go

Lines changed: 40 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import (
2323
v1 "k8s.io/api/core/v1"
2424
kerrors "k8s.io/apimachinery/pkg/util/errors"
2525
"k8s.io/apimachinery/pkg/util/sets"
26-
utilfeature "k8s.io/apiserver/pkg/util/feature"
27-
featuregatetesting "k8s.io/component-base/featuregate/testing"
28-
"k8s.io/kubernetes/pkg/features"
2926
)
3027

3128
func checkExpectedEndpoints(expected sets.Set[string], actual []Endpoint) error {
@@ -47,12 +44,11 @@ func checkExpectedEndpoints(expected sets.Set[string], actual []Endpoint) error
4744

4845
func TestCategorizeEndpoints(t *testing.T) {
4946
testCases := []struct {
50-
name string
51-
hintsEnabled bool
52-
pteEnabled bool
53-
nodeLabels map[string]string
54-
serviceInfo ServicePort
55-
endpoints []Endpoint
47+
name string
48+
pteEnabled bool
49+
nodeLabels map[string]string
50+
serviceInfo ServicePort
51+
endpoints []Endpoint
5652

5753
// We distinguish `nil` ("service doesn't use this kind of endpoints") from
5854
// `sets.Set[string]()` ("service uses this kind of endpoints but has no endpoints").
@@ -65,63 +61,9 @@ func TestCategorizeEndpoints(t *testing.T) {
6561
allEndpoints sets.Set[string]
6662
onlyRemoteEndpoints bool
6763
}{{
68-
name: "hints enabled, hints annotation == auto",
69-
hintsEnabled: true,
70-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
71-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
72-
endpoints: []Endpoint{
73-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
74-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
75-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
76-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
77-
},
78-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
79-
localEndpoints: nil,
80-
}, {
81-
name: "hints, hints annotation == disabled, but endpointslice hints are not ignored since trafficDist feature-gate is always enabled by default",
82-
hintsEnabled: true,
83-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
84-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "disabled"},
85-
endpoints: []Endpoint{
86-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
87-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
88-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
89-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
90-
},
91-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
92-
localEndpoints: nil,
93-
}, {
94-
95-
name: "hints, hints annotation == aUto (wrong capitalization), hints no longer ignored",
96-
hintsEnabled: true,
97-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
98-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "aUto"},
99-
endpoints: []Endpoint{
100-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
101-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
102-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
103-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
104-
},
105-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
106-
localEndpoints: nil,
107-
}, {
108-
name: "hints, hints annotation empty but endpointslice hints are not ignored since trafficDist feature-gate is always enabled by default",
109-
hintsEnabled: true,
110-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
111-
serviceInfo: &BaseServicePortInfo{ /* hints annotation empty */ },
112-
endpoints: []Endpoint{
113-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
114-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
115-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
116-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
117-
},
118-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
119-
localEndpoints: nil,
120-
}, {
121-
name: "hints feature-gate disabled but endpointslice hints are not ignored since trafficDist feature-gate is always enabled by default",
122-
hintsEnabled: false,
123-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
124-
serviceInfo: &BaseServicePortInfo{},
64+
name: "should use topology since all endpoints have hints, node has a zone label and and there are endpoints for the node's zone",
65+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
66+
serviceInfo: &BaseServicePortInfo{},
12567
endpoints: []Endpoint{
12668
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
12769
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
@@ -131,10 +73,9 @@ func TestCategorizeEndpoints(t *testing.T) {
13173
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
13274
localEndpoints: nil,
13375
}, {
134-
name: "externalTrafficPolicy: Local, topology ignored for Local endpoints",
135-
hintsEnabled: true,
136-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
137-
serviceInfo: &BaseServicePortInfo{externalPolicyLocal: true, nodePort: 8080, hintsAnnotation: "auto"},
76+
name: "externalTrafficPolicy: Local, topology ignored for Local endpoints",
77+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
78+
serviceInfo: &BaseServicePortInfo{externalPolicyLocal: true, nodePort: 8080},
13879
endpoints: []Endpoint{
13980
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
14081
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
@@ -145,10 +86,9 @@ func TestCategorizeEndpoints(t *testing.T) {
14586
localEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80"),
14687
allEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.6:80"),
14788
}, {
148-
name: "internalTrafficPolicy: Local, topology ignored for Local endpoints",
149-
hintsEnabled: true,
150-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
151-
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, hintsAnnotation: "auto", externalPolicyLocal: false, nodePort: 8080},
89+
name: "internalTrafficPolicy: Local, topology ignored for Local endpoints",
90+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
91+
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: true, externalPolicyLocal: false, nodePort: 8080},
15292
endpoints: []Endpoint{
15393
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
15494
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
@@ -159,66 +99,48 @@ func TestCategorizeEndpoints(t *testing.T) {
15999
localEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80"),
160100
allEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.6:80"),
161101
}, {
162-
name: "empty node labels",
163-
hintsEnabled: true,
164-
nodeLabels: map[string]string{},
165-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
102+
name: "empty node labels",
103+
nodeLabels: map[string]string{},
104+
serviceInfo: &BaseServicePortInfo{},
166105
endpoints: []Endpoint{
167106
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
168107
},
169108
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
170109
localEndpoints: nil,
171110
}, {
172-
name: "empty zone label",
173-
hintsEnabled: true,
174-
nodeLabels: map[string]string{v1.LabelTopologyZone: ""},
175-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
111+
name: "empty zone label",
112+
nodeLabels: map[string]string{v1.LabelTopologyZone: ""},
113+
serviceInfo: &BaseServicePortInfo{},
176114
endpoints: []Endpoint{
177115
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
178116
},
179117
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
180118
localEndpoints: nil,
181119
}, {
182-
name: "node in different zone, no endpoint filtering",
183-
hintsEnabled: true,
184-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-b"},
185-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
120+
name: "node in different zone, no endpoint filtering",
121+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-b"},
122+
serviceInfo: &BaseServicePortInfo{},
186123
endpoints: []Endpoint{
187124
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
188125
},
189126
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
190127
localEndpoints: nil,
191128
}, {
192-
name: "normal endpoint filtering, auto annotation",
193-
hintsEnabled: true,
194-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
195-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
196-
endpoints: []Endpoint{
197-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
198-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
199-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
200-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
201-
},
202-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
203-
localEndpoints: nil,
204-
}, {
205-
name: "unready endpoint",
206-
hintsEnabled: true,
207-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
208-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
129+
name: "unready endpoint",
130+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
131+
serviceInfo: &BaseServicePortInfo{},
209132
endpoints: []Endpoint{
210133
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
211134
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
212135
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
213-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: false},
136+
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: false}, // unready
214137
},
215138
clusterEndpoints: sets.New[string]("10.1.2.3:80"),
216139
localEndpoints: nil,
217140
}, {
218-
name: "only unready endpoints in same zone (should not filter)",
219-
hintsEnabled: true,
220-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
221-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
141+
name: "only unready endpoints in same zone (should not filter)",
142+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
143+
serviceInfo: &BaseServicePortInfo{},
222144
endpoints: []Endpoint{
223145
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: false},
224146
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
@@ -228,36 +150,21 @@ func TestCategorizeEndpoints(t *testing.T) {
228150
clusterEndpoints: sets.New[string]("10.1.2.4:80", "10.1.2.5:80"),
229151
localEndpoints: nil,
230152
}, {
231-
name: "normal endpoint filtering, Auto annotation",
232-
hintsEnabled: true,
233-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
234-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "Auto"},
235-
endpoints: []Endpoint{
236-
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
237-
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
238-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: sets.New[string]("zone-c"), ready: true},
239-
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
240-
},
241-
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.6:80"),
242-
localEndpoints: nil,
243-
}, {
244-
name: "missing hints, no filtering applied",
245-
hintsEnabled: true,
246-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
247-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
153+
name: "missing hints, no filtering applied",
154+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
155+
serviceInfo: &BaseServicePortInfo{},
248156
endpoints: []Endpoint{
249157
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a"), ready: true},
250158
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b"), ready: true},
251-
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: nil, ready: true},
159+
&BaseEndpointInfo{endpoint: "10.1.2.5:80", zoneHints: nil, ready: true}, // Endpoint is missing hint.
252160
&BaseEndpointInfo{endpoint: "10.1.2.6:80", zoneHints: sets.New[string]("zone-a"), ready: true},
253161
},
254162
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.5:80", "10.1.2.6:80"),
255163
localEndpoints: nil,
256164
}, {
257-
name: "multiple hints per endpoint, filtering includes any endpoint with zone included",
258-
hintsEnabled: true,
259-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-c"},
260-
serviceInfo: &BaseServicePortInfo{hintsAnnotation: "auto"},
165+
name: "multiple hints per endpoint, filtering includes any endpoint with zone included",
166+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-c"},
167+
serviceInfo: &BaseServicePortInfo{},
261168
endpoints: []Endpoint{
262169
&BaseEndpointInfo{endpoint: "10.1.2.3:80", zoneHints: sets.New[string]("zone-a", "zone-b", "zone-c"), ready: true},
263170
&BaseEndpointInfo{endpoint: "10.1.2.4:80", zoneHints: sets.New[string]("zone-b", "zone-c"), ready: true},
@@ -267,10 +174,9 @@ func TestCategorizeEndpoints(t *testing.T) {
267174
clusterEndpoints: sets.New[string]("10.1.2.3:80", "10.1.2.4:80", "10.1.2.6:80"),
268175
localEndpoints: nil,
269176
}, {
270-
name: "conflicting topology and localness require merging allEndpoints",
271-
hintsEnabled: true,
272-
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
273-
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: false, externalPolicyLocal: true, nodePort: 8080, hintsAnnotation: "auto"},
177+
name: "conflicting topology and localness require merging allEndpoints",
178+
nodeLabels: map[string]string{v1.LabelTopologyZone: "zone-a"},
179+
serviceInfo: &BaseServicePortInfo{internalPolicyLocal: false, externalPolicyLocal: true, nodePort: 8080},
274180
endpoints: []Endpoint{
275181
&BaseEndpointInfo{endpoint: "10.0.0.0:80", zoneHints: sets.New[string]("zone-a"), ready: true, isLocal: true},
276182
&BaseEndpointInfo{endpoint: "10.0.0.1:80", zoneHints: sets.New[string]("zone-b"), ready: true, isLocal: true},
@@ -431,8 +337,6 @@ func TestCategorizeEndpoints(t *testing.T) {
431337

432338
for _, tc := range testCases {
433339
t.Run(tc.name, func(t *testing.T) {
434-
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.TopologyAwareHints, tc.hintsEnabled)
435-
436340
clusterEndpoints, localEndpoints, allEndpoints, hasAnyEndpoints := CategorizeEndpoints(tc.endpoints, tc.serviceInfo, tc.nodeLabels)
437341

438342
if tc.clusterEndpoints == nil && clusterEndpoints != nil {

0 commit comments

Comments
 (0)