-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
client#List with client.InNamespace ListOption requires permissions at cluster-level #2608
Comments
I'm opening this in this repository because I'm not quite sure where the problem lies. It might be in the way the operator configures the client, or perhaps it's it's in how the controller-runtime handles the cache. |
This error isn't propagated to my operator, so I can't just print the stack there. It does not happen during the startup of my operator, but rather, during reconciliation. |
HI @jpkrohling, Are you able to reproduce/create a POC with by using the Go Memcached Sample? Because if the information is true :
Then, the same behaviour could be reproduced with. Am I right? Could you please provide the steps for we are able to reproduce it? |
It should be easy to reproduce with the memcached example. I can't work on that right now, but I'll try to get a reproducer before the end of the month. |
@jpkrohling I haven't tried reproducing this, but my first thought is that if the manager is setup to watch all namespaces, then (I think) it configures the client to do |
@jpkrohling Can you confirm if your operator is watching all namespaces when you encounter this issue? If the controller-runtime's The controller-runtime client (likely the one you're using for this This issue is related as well: kubernetes-sigs/controller-runtime#244 If the above description of your scenario is correct, I don't think the SDK can help with this problem (other than helping solve this issue upstream). Thoughts? |
This does sound correct, just not 100% sure I faced this only when WATCH_NAMESPACES is empty. I need a couple of days (or a week) to verify this. |
Just tried it out, and it does indeed happen only when the operator is watching all namespaces. Steps to reproduce:
opts := []client.ListOption{
client.InNamespace("memcached"),
client.MatchingLabels(map[string]string{
"app.kubernetes.io/instance": "my-instance",
"app.kubernetes.io/managed-by": "app-operator",
}),
}
list := &corev1.SecretList{}
err := r.client.List(ctx, list, opts...) Once the CR is applied, the following is seen in the logs and the reconciliation never finishes:
|
HI @jpkrohling, I am closing this one since it is something that needs be addressed in the controller-runtime and was described already in the above comment #2608 (comment). Also, shows that you could confirm it as well. However, please feel free to ping us if you think that it should be re-opened. |
Bug Report
When an operator has permissions for a single namespace, using the client provided by the manager makes the client to request objects from the cluster-level, causing the operator to hang indefinitely with messages like the following being shown every second:
And here's the code that triggered it:
Source: https://github.com/jaegertracing/jaeger-operator/blob/c9147e7ec923113b2dbeafc917c8eb0070c7dc8e/pkg/controller/jaeger/secret.go#L21-L31
Note that namespace does contain a valid and existing namespace (
observability
).As a workaround, I can bypass the cache by using
mgr.GetAPIReader()
instead ofmgr.GetClient()
for the list operations.What did you expect to see?
#List
operation to eventually fail after a timeout, instead of waiting indefinitely for the cache. client.Get will hung when service-account lack of get and list permissions kubernetes-sigs/controller-runtime#550 seems relevant here.What did you see instead? Under which circumstances?
Environment
Possible Solution
mgr.GetAPIReader()
, and used that whenever a#List
operation is neededAdditional context
Causes: jaegertracing/jaeger-operator#935
Possibly (partially) related: kubernetes-sigs/controller-runtime#550
The text was updated successfully, but these errors were encountered: