Skip to content

Commit 69c35f2

Browse files
committed
unwrappingWatch should check against real inner obj RV
Now that CachedObjects embeds the real resource version of the original object, the unwrappingWatch in Replication VW should check against that RV when handling ADDED events. On-behalf-of: @SAP [email protected] Signed-off-by: Robert Vasek <[email protected]>
1 parent 8cd0fc3 commit 69c35f2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkg/virtual/replication/builder/unwrap.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,6 @@ func newUnwrappingWatch(
331331
Handler: clientgocache.ResourceEventHandlerDetailedFuncs{
332332
AddFunc: func(obj interface{}, isInInitialList bool) {
333333
cachedObj := tombstone.Obj[*cachev1alpha1.CachedObject](obj)
334-
if isInInitialList {
335-
if cachedObj.GetResourceVersion() <= innerListOpts.ResourceVersion {
336-
// This resource is older than the want we want to start from on isInInitial list replay.
337-
return
338-
}
339-
if innerListOpts.SendInitialEvents != nil && !*innerListOpts.SendInitialEvents {
340-
// The user explicitly requests not to send the initial list.
341-
return
342-
}
343-
}
344-
345334
innerObj, err := unwrapWithMatchingSelectors(cachedObj)
346335
if err != nil {
347336
w.safeWrite(watch.Event{
@@ -355,6 +344,17 @@ func newUnwrappingWatch(
355344
return
356345
}
357346

347+
if isInInitialList {
348+
if innerObj.GetResourceVersion() <= innerListOpts.ResourceVersion {
349+
// This resource is older than the one we want to start from on isInInitial list replay.
350+
return
351+
}
352+
if innerListOpts.SendInitialEvents != nil && !*innerListOpts.SendInitialEvents {
353+
// The user explicitly requests not to send the initial list.
354+
return
355+
}
356+
}
357+
358358
for _, cluster := range syntheticClusters() {
359359
obj := innerObj.DeepCopy()
360360
setCluster(obj, cluster)

0 commit comments

Comments
 (0)