-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Populate GVK for listed objects #389
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,9 @@ func (c *CacheReader) List(_ context.Context, out runtime.Object, opts ...client | |
if !isObj { | ||
return fmt.Errorf("cache contained %T, which is not an Object", obj) | ||
} | ||
runtimeObjs = append(runtimeObjs, obj) | ||
outObj := obj.DeepCopyObject() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe that we need to deep copy here because these objects are all created from within this function? Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 wonder if it is what the indexer gives us for each list is just the cached object? I will look it up to see eventually :) thanks for the explanation! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should've been deepcopying anyway, since that's what we do elsewhere anyway. |
||
outObj.GetObjectKind().SetGroupVersionKind(c.groupVersionKind) | ||
runtimeObjs = append(runtimeObjs, outObj) | ||
} | ||
filteredItems, err := objectutil.FilterWithLabels(runtimeObjs, labelSel) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are getting 4 pods, I think that is a bug in the namespaced cache implementation. I will attempt to re-create locally.
I think we may need to file an issue and merge this with a TODO remove
HaveLen(4)
IMO./cc @DirectXMan12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if you managed to repro locally or not, but to me it looks like the regular cache will be returning 4 pods as it lists across all namespaces(?) whereas the multinamespaced cache will only list 3 as there is a pod in a namespace that it isn't caching?
I haven't looked into this thoroughly though so am kinda guessing how the two different caches behave 🤷♂️