Skip to content

Commit

Permalink
Merge pull request #281 from turkenf/add-jitter
Browse files Browse the repository at this point in the history
Add jitter to reconcile delay for managed.Reconciler
  • Loading branch information
turkenf authored Sep 27, 2023
2 parents a41bb83 + e283b5c commit cc55f39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package controller

import (
"crypto/tls"
"time"

"github.com/crossplane/crossplane-runtime/pkg/controller"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions pkg/pipeline/templates/controller.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit cc55f39

Please sign in to comment.