Skip to content

Commit

Permalink
Use resync period in event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
alok87 committed Feb 4, 2022
1 parent 158d426 commit fef9160
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/workerpodautoscaler/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (v *runCmd) run(cmd *cobra.Command, args []string) {
kubeInformerFactory.Apps().V1().ReplicaSets(),
customInformerFactory.K8s().V1().WorkerPodAutoScalers(),
wpaDefaultMaxDisruption,
resyncPeriod,
queues,
)

Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func NewController(
replicaSetInformer appsinformers.ReplicaSetInformer,
workerPodAutoScalerInformer informers.WorkerPodAutoScalerInformer,
defaultMaxDisruption string,
resyncPeriod time.Duration,
queues *queue.Queues) *Controller {

// Create event broadcaster
Expand Down Expand Up @@ -230,13 +231,13 @@ func NewController(
klog.V(4).Info("Setting up event handlers")

// Set up an event handler for when WorkerPodAutoScaler resources change
workerPodAutoScalerInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
workerPodAutoScalerInformer.Informer().AddEventHandlerWithResyncPeriod(cache.ResourceEventHandlerFuncs{
AddFunc: controller.enqueueAddWorkerPodAutoScaler,
UpdateFunc: func(old, new interface{}) {
controller.enqueueUpdateWorkerPodAutoScaler(new)
},
DeleteFunc: controller.enqueueDeleteWorkerPodAutoScaler,
})
}, resyncPeriod)
return controller
}

Expand Down

0 comments on commit fef9160

Please sign in to comment.