Add support for fieldSelector to fakeClient
Currently it seems only labelSelector is supported - https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/fake/client.go#L423
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
If there's consensus from the project maintainers me and @pleic would like to open a PR to add this, since we have code that needs it. If there's not immediate consensus (e.g. because a real API server should be used with envtest rather than the fake client) we'll elaborate more on our use case and try to make a case for this.
Our rough idea to implement this was to:
- add a
WithIndex(gvk schema.GroupVersionKind, IndexName, IndexFunc)function to the fake client builder. - add a field of type
map[schema.GroupVersionResource]map[string]IndexFuncthat stores all the Indexes that have been registered with the fake client on a perGroupVersionResourcebasis. - when a List requests specifies a field selector, we intercept the normal list results and filter it by lazily computing all the relevant indexes and dropping the list items that don't satisfy the selector.
cc @alvaroaleman @vincepri since you reviewed the previous attempt at this: https://github.com/kubernetes-sigs/controller-runtime/pull/800
sounds good to me
/remove-lifecycle stale
PR opened: https://github.com/kubernetes-sigs/controller-runtime/pull/2025
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Fixed in https://github.com/kubernetes-sigs/controller-runtime/pull/2025