-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 |
…ernetes libs to v0.30.0 (#3707) * go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
…ernetes libs to v0.30.0 (kubernetes-sigs#3707) * go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3
* update the traffic test for ingress (#3725) * update the traffic test for ingress * make crds * prevent controller runtime complaining about SetupLogger() was never called (#3724) * Update go to v1.22, controller-runtime dependency to v0.18.2, and kubernetes libs to v0.30.0 (#3707) * go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3 * restrict resolve resolveViaVPCENIs to fargate only (#3709) * Added helm envFrom value parameter for cluster-name (#3683) * Added helm envFrom value parameter for cluster-name * Update README.md file * Add envFrom configuration to values.yaml * Remove empty line in values.yaml * feat: disable default helm labels (#3574) * feat: disable helm labels * fix: doc * Update README.md (#3638) Remove extra / in crds --------- Co-authored-by: Luke Arntz <luke@blue42.net> Co-authored-by: Omer Aplatony <61663422+omerap12@users.noreply.github.com> Co-authored-by: Rémi BUISSON <remi-buisson@orange.fr> Co-authored-by: Mike Wilson <hyperbolic2346@users.noreply.github.com>
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
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-sigs/prow repository. |
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: