kubernetes-sigs / kubernetes-sigs/controller-runtime

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

Open
#988 11 comments 0 reactions 1 assignee View on GitHub

@dlanov is already working on this.

Since Jul 20, 2026.

help wanted lifecycle/frozen priority/awaiting-more-evidence
Dominant language
Go
Stars
3k
Forks
1.3k
Avg merge
2d 5h
Merged PRs (30d)
14

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.