Skip to content

Commit

Permalink
cmd/entrypoint: add new env var to control interval for sending updates
Browse files Browse the repository at this point in the history
AMBASSADOR_RECONFIG_MAX_DELAY controls the interval to wait before sending snapshot updates when listening for K8s resources, especially when many resources are updated in quick succession.

Signed-off-by: Hamzah Qudsi <[email protected]>
  • Loading branch information
Hamzah Qudsi committed Sep 14, 2022
1 parent 89dce76 commit 361e1f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/entrypoint/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (
"encoding/json"
"fmt"
"os"
"strconv"
"sync"
"sync/atomic"
"time"

gw "sigs.k8s.io/gateway-api/apis/v1alpha1"

Expand All @@ -33,6 +35,16 @@ func WatchAllTheThings(
if err != nil {
return err
}
intv, err := strconv.Atoi(env("AMBASSADOR_RECONFIG_MAX_DELAY", "1"))
if err != nil {
return err
}
maxInterval := time.Duration(intv) * time.Second
err = client.MaxAccumulatorInterval(maxInterval)
if err != nil {
return err
}
dlog.Infof(ctx, "AMBASSADOR_RECONFIG_MAX_DELAY set to %d", intv)

serverTypeList, err := client.ServerResources()
if err != nil {
Expand Down

0 comments on commit 361e1f9

Please sign in to comment.