Skip to content

Commit cc55f39

Browse files
authored
Merge pull request #281 from turkenf/add-jitter
Add jitter to reconcile delay for managed.Reconciler
2 parents a41bb83 + e283b5c commit cc55f39

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/controller/options.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package controller
66

77
import (
88
"crypto/tls"
9+
"time"
910

1011
"github.com/crossplane/crossplane-runtime/pkg/controller"
1112
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -38,6 +39,10 @@ type Options struct {
3839

3940
// ESSOptions for External Secret Stores.
4041
ESSOptions *ESSOptions
42+
43+
// PollJitter adds the specified jitter to the configured reconcile period
44+
// of the up-to-date resources in managed.Reconciler.
45+
PollJitter time.Duration
4146
}
4247

4348
// ESSOptions for External Secret Stores.

pkg/pipeline/templates/controller.go.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error {
5454
managed.WithConnectionPublishers(cps...),
5555
managed.WithPollInterval(o.PollInterval),
5656
}
57+
if o.PollJitter != 0 {
58+
opts = append(opts, managed.WithPollJitterHook(o.PollJitter))
59+
}
5760
{{- if .FeaturesPackageAlias }}
5861
if o.Features.Enabled({{ .FeaturesPackageAlias }}EnableAlphaManagementPolicies) {
5962
opts = append(opts, managed.WithManagementPolicies())

0 commit comments

Comments
 (0)