Add unhealthy Interval to the health check configuration
This commit is contained in:
parent
6c3b099c25
commit
d7d0017545
36 changed files with 701 additions and 295 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
ptypes "github.com/traefik/paerser/types"
|
||||
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
||||
"github.com/traefik/traefik/v3/pkg/logs"
|
||||
"github.com/traefik/traefik/v3/pkg/provider"
|
||||
|
|
@ -373,6 +374,17 @@ func (c configBuilder) buildServersLB(namespace string, svc traefikv1alpha1.Load
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
// If the UnhealthyInterval option is not set, we use the Interval option value,
|
||||
// to check the unhealthy targets as often as the healthy ones.
|
||||
if svc.HealthCheck.UnhealthyInterval == nil {
|
||||
lb.HealthCheck.UnhealthyInterval = &lb.HealthCheck.Interval
|
||||
} else {
|
||||
var unhealthyInterval ptypes.Duration
|
||||
if err := unhealthyInterval.Set(svc.HealthCheck.UnhealthyInterval.String()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lb.HealthCheck.UnhealthyInterval = &unhealthyInterval
|
||||
}
|
||||
if svc.HealthCheck.Timeout != nil {
|
||||
if err := lb.HealthCheck.Timeout.Set(svc.HealthCheck.Timeout.String()); err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue