diff --git a/pkg/controller/options.go b/pkg/controller/options.go index ae265f4c..32e091fb 100644 --- a/pkg/controller/options.go +++ b/pkg/controller/options.go @@ -6,6 +6,7 @@ package controller import ( "crypto/tls" + "time" "github.com/crossplane/crossplane-runtime/pkg/controller" "k8s.io/apimachinery/pkg/runtime/schema" @@ -38,6 +39,10 @@ type Options struct { // ESSOptions for External Secret Stores. ESSOptions *ESSOptions + + // PollJitter adds the specified jitter to the configured reconcile period + // of the up-to-date resources in managed.Reconciler. + PollJitter time.Duration } // ESSOptions for External Secret Stores. diff --git a/pkg/pipeline/templates/controller.go.tmpl b/pkg/pipeline/templates/controller.go.tmpl index 18d39219..4dcb6d8f 100644 --- a/pkg/pipeline/templates/controller.go.tmpl +++ b/pkg/pipeline/templates/controller.go.tmpl @@ -54,6 +54,9 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { managed.WithConnectionPublishers(cps...), managed.WithPollInterval(o.PollInterval), } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } {{- if .FeaturesPackageAlias }} if o.Features.Enabled({{ .FeaturesPackageAlias }}EnableAlphaManagementPolicies) { opts = append(opts, managed.WithManagementPolicies())