Skip to content

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

Merged

Conversation

fabianvf
Copy link

No description provided.

@fabianvf fabianvf force-pushed the add-indexer-plumbing branch from 1db7775 to 2108c00 Compare May 27, 2022 16:36
@ncdc
Copy link
Member

ncdc commented May 27, 2022

I'm guessing there will be an additional change to use these indexers?

@fabianvf
Copy link
Author

whoops meant to make this a draft, yeah looking into the listers atm

@fabianvf fabianvf marked this pull request as draft May 27, 2022 16:50
// 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() == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if listOpts.Cluster.String() == "" {
if listOpts.Cluster.Empty() {

@@ -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() == "":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

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
Copy link
Member

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?

@fabianvf fabianvf marked this pull request as ready for review May 31, 2022 19:13
@fabianvf fabianvf force-pushed the add-indexer-plumbing branch from 9c36bda to bad30ba Compare May 31, 2022 19:41
@ncdc ncdc merged commit 5d0ed0e into kcp-dev:feature-logical-clusters-1.23 May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants