Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Check generation to ensure index working on same object
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Mar 14, 2022
commit 32f977624f8902ae4448d42ac9cf360efd5be480
8 changes: 6 additions & 2 deletions pkg/cache/internal/cache_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ func (c *CacheReader) List(_ context.Context, out client.ObjectList, opts ...cli
for i := range list {
obj := list[i].(client.Object)
key := client.ObjectKey{Namespace: obj.GetNamespace(), Name: obj.GetName()}
if _, exists := objmap[key]; exists {
numap[key] = obj
if o, exists := objmap[key]; exists {
if o.(client.Object).GetGeneration() == obj.GetGeneration() {
numap[key] = obj
} else {
return fmt.Errorf("multiple generation found in indices for %+v %s/%s", obj.GetObjectKind().GroupVersionKind(), obj.GetNamespace(), obj.GetName())
}
}
}
objmap = numap
Expand Down