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
shared index informer is watching resources in all namespaces even though they are intended to watch in particular namespace #2331
Comments
@skpandey91 : Which version of client are you using? |
4.10.2 version I am using, As it is trying to list, watch CRs in all namespaces , it is mandatory to create cluster role binding, but we work with rolebinding only ..PLease suggest we are blocked.. |
This is quite strange since we have a test for this case 😕 . Would it be possible for you to share a reproducible test case ? Lines 478 to 520 in ee93164
|
|
Hello, we just now updated to version 1.6.0 of Quarkus which uses 4.10.2 of Fabric8 and we can see that it looks at all Namespaces and not the one its intended to look at. |
So is it a defect or feature ?? |
I would call it a defect, because we are defining a namespace that should be used by the Informer and it is ignored. |
Hi, I'm not able to reproduce this issue. For me having three pods in my default namespace:
When I run a simple
I get this as output:
|
What's more strange is that we have a test case already covering this scenario: Lines 478 to 528 in 12e2580
Could anyone please share a reproducer project which we can try out and test? |
Then just deploy the pod you watch into another namespace or on more than two |
I do have pods running in other namespaces. This is my output with
|
Okay, so I'am a using Custom Resource, but also a Cluster Role for the Service Account. The Kubernetes Client itself is set to a Namespace. Maybe you should try it out with a Custom Resource, maybe only that one has a problem in this case. |
ohk, I'm able to reproduce this. Let me try to fix it whenever I get time this week. |
ohk, now I'm able to see why informer was watching in all namespaces instead of a specified one. In 4.10.x versions we introduced a new interface called Lines 18 to 19 in 55cf52c
Every resource in Kubernetes Model which is a namespace resource implements this interface, otherwise, it's considered to be a Cluster scoped resource. Our test was passing because our PodSet class implements this interface: kubernetes-client/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSet.java Line 22 in 55cf52c
I modified my Could you please check if adding making your Custom Resource classes implement this |
Okay, so just adding implements Namespaced to the CR helps in this case? Just asking if I understood it correctly. Edit: reading helps :D Trying to test it now |
@bframke : Yes, I think so. I've tested and it seemed to work for me. |
Please let me know if it works for you. I'll update the docs so that it's clearly visible. |
Okay, it works fine. Just added it, had custom resources in other namespaces and they were not pulled in from the indexinformer. |
Below is code to create SharedIndexInformer, I wanted to watch in a particular namespace only but it is watching in all the namespaces.
Please suggest
Starting it like below
sharedInformerFactory.startAllRegisteredInformers();
The text was updated successfully, but these errors were encountered: