Skip to content

Commit 00236ae

Browse files
authored
Merge pull request kubernetes#126519 from dims/bjhaid-bjhaid-topology-verbosity-take-2
[kube-proxy] add log verbosity to endpoint topology hint loop - Take 2
2 parents dbc2b0a + 4fc6d8d commit 00236ae

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

pkg/proxy/topology.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,23 @@ func canUseTopology(endpoints []Endpoint, svcInfo ServicePort, nodeLabels map[st
160160
}
161161
}
162162

163-
zone, ok := nodeLabels[v1.LabelTopologyZone]
164-
if !ok || zone == "" {
165-
klog.V(2).InfoS("Skipping topology aware endpoint filtering since node is missing label", "label", v1.LabelTopologyZone)
166-
return false
167-
}
168-
163+
zone, foundZone := nodeLabels[v1.LabelTopologyZone]
169164
hasEndpointForZone := false
170165
for _, endpoint := range endpoints {
171166
if !endpoint.IsReady() {
172167
continue
173168
}
169+
170+
// If any of the endpoints do not have zone hints, we bail out
174171
if endpoint.ZoneHints().Len() == 0 {
175-
klog.V(2).InfoS("Skipping topology aware endpoint filtering since one or more endpoints is missing a zone hint", "endpoint", endpoint)
172+
klog.V(7).InfoS("Skipping topology aware endpoint filtering since one or more endpoints is missing a zone hint", "endpoint", endpoint)
173+
return false
174+
}
175+
176+
// If we've made it this far, we have endpoints with hints set. Now we check if there is a
177+
// zone label, if there isn't one we log a warning and bail out
178+
if !foundZone || zone == "" {
179+
klog.V(2).InfoS("Skipping topology aware endpoint filtering since node is missing label", "label", v1.LabelTopologyZone)
176180
return false
177181
}
178182

@@ -182,10 +186,9 @@ func canUseTopology(endpoints []Endpoint, svcInfo ServicePort, nodeLabels map[st
182186
}
183187

184188
if !hasEndpointForZone {
185-
klog.V(2).InfoS("Skipping topology aware endpoint filtering since no hints were provided for zone", "zone", zone)
189+
klog.V(7).InfoS("Skipping topology aware endpoint filtering since no hints were provided for zone", "zone", zone)
186190
return false
187191
}
188-
189192
return true
190193
}
191194

0 commit comments

Comments
 (0)