Skip to content
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 support for fieldSelector to fakeClient #1948

Closed
grzesuav opened this issue Jul 1, 2022 · 7 comments
Closed

Add support for fieldSelector to fakeClient #1948

grzesuav opened this issue Jul 1, 2022 · 7 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@grzesuav
Copy link

grzesuav commented Jul 1, 2022

Currently it seems only labelSelector is supported - https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/fake/client.go#L423

@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 29, 2022
@matteoolivi
Copy link
Contributor

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:

  1. add a WithIndex(gvk schema.GroupVersionKind, IndexName, IndexFunc) function to the fake client builder.
  2. add a field of type map[schema.GroupVersionResource]map[string]IndexFunc that stores all the Indexes that have been registered with the fake client on a per GroupVersionResource basis.
  3. 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: #800

@alvaroaleman
Copy link
Member

sounds good to me

@FillZpp
Copy link
Contributor

FillZpp commented Oct 13, 2022

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 13, 2022
@matteoolivi
Copy link
Contributor

PR opened: #2025

@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 16, 2023
@alvaroaleman
Copy link
Member

Fixed in #2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

6 participants