diff --git a/pkg/syncer/resource_syncer.go b/pkg/syncer/resource_syncer.go index dffa224e..e280b369 100644 --- a/pkg/syncer/resource_syncer.go +++ b/pkg/syncer/resource_syncer.go @@ -769,7 +769,13 @@ func (r *resourceSyncer) onUpdate(oldObj, newObj interface{}) { return } - r.workQueue.Enqueue(newObj) + // If the resource version didn't change, that indicates a re-sync by the informer so enqueue at low priority. + // We want to prioritize processing resources that did actually change. + if oldResource.GetResourceVersion() == newResource.GetResourceVersion() { + r.workQueue.EnqueueLowPriority(newObj) + } else { + r.workQueue.Enqueue(newObj) + } } func (r *resourceSyncer) onDelete(obj interface{}) { diff --git a/pkg/syncer/resource_syncer_test.go b/pkg/syncer/resource_syncer_test.go index 0bb4a4be..6d71b22e 100644 --- a/pkg/syncer/resource_syncer_test.go +++ b/pkg/syncer/resource_syncer_test.go @@ -914,8 +914,7 @@ func testUpdateSuppression() { Context("and the resource's ObjectMeta is updated in the datastore", func() { BeforeEach(func() { - t := metav1.Now() - d.resource.ObjectMeta.DeletionTimestamp = &t + d.resource.ObjectMeta.Finalizers = []string{"test"} }) It("should distribute it", func() { @@ -941,8 +940,7 @@ func testUpdateSuppression() { Context("and the resource's ObjectMeta is updated in the datastore", func() { BeforeEach(func() { - t := metav1.Now() - d.resource.ObjectMeta.DeletionTimestamp = &t + d.resource.ObjectMeta.Finalizers = []string{"test"} }) It("should not distribute it", func() { @@ -1474,7 +1472,11 @@ func newTestDriver(sourceNamespace, localClusterID string, syncDirection syncer. restMapper, gvr := test.GetRESTMapperAndGroupVersionResourceFor(d.config.ResourceType) d.config.RestMapper = restMapper - d.config.SourceClient = fakeClient.NewSimpleDynamicClient(d.config.Scheme, initObjs...) + + dynClient := fakeClient.NewSimpleDynamicClient(d.config.Scheme, initObjs...) + fakereactor.AddBasicReactors(&dynClient.Fake) + + d.config.SourceClient = dynClient d.sourceClient = d.config.SourceClient.Resource(*gvr).Namespace(d.config.SourceNamespace)