Skip to content

Commit

Permalink
Use jitter in main reconcile loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Olshevski committed Jan 2, 2024
1 parent 4594673 commit e565bee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/controllers/reconciliation/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/jsonmergepatch"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand All @@ -23,8 +24,6 @@ import (
"github.com/go-logr/logr"
)

// TODO: Jitter

// TODO: Block ResourceSlice deletion until resources have been cleaned up
// TODO: Clean up unused resource slices older than a duration

Expand Down Expand Up @@ -124,7 +123,7 @@ func (c *Controller) Reconcile(ctx context.Context, req *reconstitution.Request)
})

if resource != nil && resource.Manifest.ReconcileInterval != nil {
return ctrl.Result{RequeueAfter: resource.Manifest.ReconcileInterval.Duration}, nil
return ctrl.Result{RequeueAfter: wait.Jitter(resource.Manifest.ReconcileInterval.Duration, 0.1)}, nil
}
return ctrl.Result{}, nil
}
Expand Down

0 comments on commit e565bee

Please sign in to comment.