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

The filtering behavior of List() and DeleteAllOf() are different when they are used with the "InNamespace" predicate. #988

Open
zhranklin opened this issue Jun 10, 2020 · 10 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Milestone

Comments

@zhranklin
Copy link

Hi, I'm using operator-sdk. When I'm using the k8s client provided by controller-manager constructed by operator-sdk, I found the following surprising things:

I am accidentally trying to delete CRs under a certain namespace, which is a mistake because the CR was defined in cluster scope. The strange thing is that DeleteAllOf() removes all CRs in the cluster, but List() didn't return any result.

The relevant code probably is:

cache_reader:

https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/cache/internal/cache_reader.go#L109

writer:

https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/unstructured_client.go#L130

@vincepri
Copy link
Member

To clarify, you've called DeleteAllOf with a InNamespace predicate on a global custom resource?

@vincepri
Copy link
Member

/priority awaiting-more-evidence
/milestone Next

@k8s-ci-robot k8s-ci-robot added the priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. label Jul 22, 2020
@k8s-ci-robot k8s-ci-robot added this to the Next milestone Jul 22, 2020
@zhranklin
Copy link
Author

@vincepri Yes. DeleteAllOf and List with a InNamespace on a global custom resource.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/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 Nov 8, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@vincepri
Copy link
Member

vincepri commented Nov 9, 2020

Got it. We should definitely fix the behavior, returning an error when using InNamespace predicate on non-namespaced resources makes sense to me.
@alvaroaleman wdyt?

@alvaroaleman
Copy link
Member

Got it. We should definitely fix the behavior, returning an error when using InNamespace predicate on non-namespaced resources makes sense to me.

sounds good to me

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 9, 2020
@vincepri
Copy link
Member

vincepri commented Jan 4, 2021

/lifecycle frozen
/help

@k8s-ci-robot
Copy link
Contributor

@vincepri:
This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/lifecycle frozen
/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Projects
None yet
Development

No branches or pull requests

5 participants