-
Notifications
You must be signed in to change notification settings - Fork 17
Add Indexer plumbing, add kcp indexers by default #10
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
Add Indexer plumbing, add kcp indexers by default #10
Conversation
1db7775
to
2108c00
Compare
I'm guessing there will be an additional change to use these indexers? |
whoops meant to make this a draft, yeah looking into the listers atm |
pkg/cache/internal/cache_reader.go
Outdated
// TODO(kcp), should we just require people to pass in the cluster list option, or maybe provide | ||
// a wrapper that adds it from the context automatically rather than doing this? | ||
// It may also make more sense to just use the context and not bother provided a ListOption for it | ||
if listOpts.Cluster.String() == "" { |
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 listOpts.Cluster.String() == "" { | |
if listOpts.Cluster.Empty() { |
pkg/cache/internal/cache_reader.go
Outdated
@@ -125,10 +137,12 @@ func (c *CacheReader) List(_ context.Context, out client.ObjectList, opts ...cli | |||
// namespaced index key. Otherwise, ask for the non-namespaced variant by using the fake "all namespaces" | |||
// namespace. | |||
objs, err = c.indexer.ByIndex(FieldIndexName(field), KeyToNamespacedKey(listOpts.Namespace, val)) | |||
case listOpts.Cluster.String() == "": |
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.
case listOpts.Cluster.String() == "": | |
case listOpts.Cluster.Empty(): |
@@ -488,6 +492,14 @@ func (m MatchingFieldsSelector) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) { | |||
m.ApplyToList(&opts.ListOptions) | |||
} | |||
|
|||
// InCluster restricts the list/delete operation to the given cluster. |
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.
Could this ultimately go into a kcp repo instead of controller-runtime?
var objs []interface{} | ||
var err error | ||
|
||
listOpts := client.ListOptions{} | ||
listOpts.ApplyOptions(opts) | ||
|
||
// TODO(kcp), should we just require people to pass in the cluster list option, or maybe provide | ||
// a wrapper that adds it from the context automatically rather than doing this? | ||
// It may also make more sense to just use the context and not bother provided a ListOption for it |
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.
I maybe think I prefer the ListOption, especially if it's in a kcp repo instead of controller-runtime. I'm not sure that would work with the live client easily, though, as that needs the context?
9c36bda
to
bad30ba
Compare
No description provided.