1
0
Fork 0

Fix condition used for serving and fenced endpoints

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
LBF38 2026-01-13 11:38:05 +01:00 committed by GitHub
parent 5a9f3e6999
commit 2e6dfbae57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 94 deletions

View file

@ -662,7 +662,10 @@ func (p *Provider) loadService(client Client, namespace string, backend netv1.In
protocol := getProtocol(portSpec, portName, svcConfig)
for _, endpoint := range endpointSlice.Endpoints {
if !k8s.EndpointServing(endpoint) {
// The Serving condition allows to track if the Pod can receive traffic.
// It is set to true when the Pod is Ready or Terminating.
// From the go documentation, a nil value should be interpreted as "true".
if !ptr.Deref(endpoint.Conditions.Serving, true) {
continue
}
@ -674,7 +677,7 @@ func (p *Provider) loadService(client Client, namespace string, backend netv1.In
addresses[address] = struct{}{}
svc.LoadBalancer.Servers = append(svc.LoadBalancer.Servers, dynamic.Server{
URL: fmt.Sprintf("%s://%s", protocol, net.JoinHostPort(address, strconv.Itoa(int(port)))),
Fenced: ptr.Deref(endpoint.Conditions.Terminating, false) && ptr.Deref(endpoint.Conditions.Serving, false),
Fenced: ptr.Deref(endpoint.Conditions.Terminating, false),
})
}
}