-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
DelegatingReader cant be used to read unstructured.Unstructured from cache #615
Comments
You have to create the delegating reader to use this behavior yourself on startup. Here is an example of how to do it:
We chose to make this the default behavior to make sure that folks were not caching the entire cluster on accident with unstructured. |
I can work around the problem, but this issue is about avoiding the workaround :)
Generally I find this a very valid concern, but why do you think this is more likely and/or more problematic when ppl use I would have argued that the types that create a particular high amount of traffic like Pods or Endpoints are mostly in the corev1 api and ppl tend to not have very high number of CRs. |
Also I personally find the behavior of automatically creating watches pretty magic in itself and IMHO its something ppl need to be aware of. Having a sub-condition there is IMHO mainly making it more complicated to understand, but is not very likely to prevent ppl from using this wrong. |
It is easier to have a generic list of things, that you go and get with unstructured then having to get the type for all of those things with the client. |
I do not really follow, do you have an example of what you mean there? There is nothing preventing ppl from using a |
So the initial logic was that the common case for unstructured is that you need to read basically arbitrary objects from the cluster from "untrusted" input (things like the garbage collector). In this case, you could potentially accidentally cache the entire cluster, which seemed like a major footgun, and we wanted to avoid it. |
hopefully that helps provide some background |
Okay, thanks for the explanation |
The delegatingReader always redirects read requests for
unstructured.Unstructured
to the API reader:controller-runtime/pkg/client/split.go
Line 47 in 801e12a
However it seems the
InformersMap
is perfectly well capable of establishing watches forunstructured.Unstructured
:controller-runtime/pkg/cache/internal/deleg_map.go
Line 77 in 801e12a
When doing a quick test by creating a client that just uses a
Cache
asReader
and requestingunstructured.Unstructured
through it, everything seemed to work fine and I was able to get objects this way:/kind bug
CC @thetechnick
The text was updated successfully, but these errors were encountered: