Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jitter to reconcile delay for managed.Reconciler #281

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading