Skip to content

Commit d6e7b6b

Browse files
committed
BUG/MINOR: EndpointSlices: ignore non ready endpoints
A possible option would be to let controller configure haproxy with non ready endpoints/servers and rely on haproxy not to use them via haproxy health checks. However they will still be used during the time that takes haproxy to detect unhealthy servers (this time depends on haproxy health check configuration). Thus it is more accurate to only receive ready endpoints from kubernetes.
1 parent 051a639 commit d6e7b6b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

controller/kubernetes.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ func (k *K8s) convertToEndpoints(obj interface{}, status store.Status) (*store.E
261261
}
262262
addresses := make(map[string]struct{})
263263
for _, endpoints := range data.Endpoints {
264+
if endpoints.Conditions.Ready == nil || !*endpoints.Conditions.Ready {
265+
continue
266+
}
264267
for _, address := range endpoints.Addresses {
265268
addresses[address] = struct{}{}
266269
}
@@ -285,6 +288,9 @@ func (k *K8s) convertToEndpoints(obj interface{}, status store.Status) (*store.E
285288
}
286289
addresses := make(map[string]struct{})
287290
for _, endpoints := range data.Endpoints {
291+
if endpoints.Conditions.Ready == nil || !*endpoints.Conditions.Ready {
292+
continue
293+
}
288294
for _, address := range endpoints.Addresses {
289295
addresses[address] = struct{}{}
290296
}

0 commit comments

Comments
 (0)