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
DefaultNamespaces Cache Option doesn't allow All Namespaces for List #2628
Comments
/kind support |
So you are limiting the watch for configmaps to one namespace using The controller-runtime/pkg/cache/cache.go Lines 233 to 234 in 1b80b96
Also, the default is to cache all namespaces without further selection logic, so putting And yeah, the client reads from the cache by default, hence if you limit the cache to a given namespace, you can't use the default client to read from a different namespace. Does this answer your question? Do you think the godocs are unclear here? |
Yes, that was my intention, as I expect configmaps to change a lot, but I'm only interested in changes to one specific config map (the controllers "config" file).
I see now, that controller-runtime/pkg/cache/cache.go Lines 239 to 242 in 1b80b96
AllNamespaces/NamespaceAll in ByObject , like in this test.
However, the DefaultNamespace option suggests it's possible to use both together. That still leaves me confused about this godoc: controller-runtime/pkg/cache/cache.go Lines 182 to 189 in 1b80b96
I read this and thought, it would apply I'm pretty sure it works for |
I'm trying to limit the controller to watch config maps only in one namespace, while watching other resources in all namespaces. Mainly for performance reasons, I don't want the controller to trigger for any config map event in the cluster.
The cache design document describes the config as
DefaultNamespaces map[string]*Config
, while the code implementsDefaultNamespaces map[string]Config
. Since all options are nil-able I guess that's not an issue.From the cache tests I'd expect this to allow list and get in all namespaces:
However, it results in
unable to list: test-7af124d because of unknown namespace for the cache
.I think that's because the
List
func in multi cache is missing the special handling, that was added toGet
func:If I understand the consequences of cache options correctly, they do limit
Watch
, but also affect the cached client. I need another client, e.g. APIReader, to retrieve configmaps in other namespaces.The text was updated successfully, but these errors were encountered: