Skip to content
Merged
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
23 changes: 11 additions & 12 deletions pkg/virtual/replication/builder/unwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,6 @@ func newUnwrappingWatch(
Handler: clientgocache.ResourceEventHandlerDetailedFuncs{
AddFunc: func(obj interface{}, isInInitialList bool) {
cachedObj := tombstone.Obj[*cachev1alpha1.CachedObject](obj)
if isInInitialList {
if cachedObj.GetResourceVersion() <= innerListOpts.ResourceVersion {
// This resource is older than the want we want to start from on isInInitial list replay.
return
}
if innerListOpts.SendInitialEvents != nil && !*innerListOpts.SendInitialEvents {
// The user explicitly requests not to send the initial list.
return
}
}

innerObj, err := unwrapWithMatchingSelectors(cachedObj)
if err != nil {
w.safeWrite(watch.Event{
Expand All @@ -355,6 +344,17 @@ func newUnwrappingWatch(
return
}

if isInInitialList {
if innerObj.GetResourceVersion() <= innerListOpts.ResourceVersion {
// This resource is older than the one we want to start from on isInInitial list replay.
return
}
if innerListOpts.SendInitialEvents != nil && !*innerListOpts.SendInitialEvents {
// The user explicitly requests not to send the initial list.
return
}
}

for _, cluster := range syntheticClusters() {
obj := innerObj.DeepCopy()
setCluster(obj, cluster)
Expand Down Expand Up @@ -499,7 +499,6 @@ func newUnwrappingList(innerListGVK schema.GroupVersionKind, innerObjGR schema.G
continue
}

innerObj.SetResourceVersion(item.GetResourceVersion())
for _, cluster := range clusters {
obj := innerObj.DeepCopy()
setCluster(obj, cluster)
Expand Down