Skip to content

Commit

Permalink
Make maximum delay of prober in its backoff configurable (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaSchwarze0 authored Dec 13, 2024
1 parent bf671a6 commit 8b69a35
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import (
"net"
"net/http"
"net/url"
"os"
"path"
"reflect"
"strconv"
"sync"
"time"

Expand Down Expand Up @@ -56,6 +58,19 @@ const (
initialDelay = 200 * time.Millisecond
)

var (
// probeMaxRetryDelay defines the maximum delay between retries in the backoff of probing
probeMaxRetryDelay = 30 * time.Second
)

func init() {
if val, ok := os.LookupEnv("PROBE_MAX_RETRY_DELAY_SECONDS"); ok {
if durationSeconds, err := strconv.Atoi(val); err == nil && durationSeconds > 0 {
probeMaxRetryDelay = time.Duration(durationSeconds) * time.Second
}
}
}

var dialContext = (&net.Dialer{Timeout: probeTimeout}).DialContext

// ingressState represents the probing state of an Ingress
Expand Down Expand Up @@ -144,7 +159,7 @@ func NewProber(
workQueue: workqueue.NewNamedRateLimitingQueue(
workqueue.NewMaxOfRateLimiter(
// Per item exponential backoff
workqueue.NewItemExponentialFailureRateLimiter(50*time.Millisecond, 30*time.Second),
workqueue.NewItemExponentialFailureRateLimiter(50*time.Millisecond, probeMaxRetryDelay),
// Global rate limiter
&workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(50), 100)},
),
Expand Down

0 comments on commit 8b69a35

Please sign in to comment.