Fix condition used for serving and fenced endpoints
Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
parent
5a9f3e6999
commit
2e6dfbae57
5 changed files with 15 additions and 94 deletions
|
|
@ -14,7 +14,6 @@ import (
|
|||
"github.com/traefik/traefik/v3/pkg/observability/logs"
|
||||
"github.com/traefik/traefik/v3/pkg/provider"
|
||||
traefikv1alpha1 "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
|
||||
"github.com/traefik/traefik/v3/pkg/provider/kubernetes/k8s"
|
||||
"github.com/traefik/traefik/v3/pkg/tls"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
|
@ -642,7 +641,10 @@ func (c configBuilder) loadServers(parentNamespace string, svc traefikv1alpha1.L
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -654,7 +656,7 @@ func (c configBuilder) loadServers(parentNamespace string, svc traefikv1alpha1.L
|
|||
addresses[address] = struct{}{}
|
||||
servers = append(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),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue