-
Notifications
You must be signed in to change notification settings - Fork 338
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
bug: apisix-controller will watch all namespace when no namespaces match namespaceSelector #908
Comments
Thanks! I think this issue has been discussed before. |
if !validation.HasValueInSyncMap(c.watchingNamespaces) && len(c.watchingLabels) == 0 {
// list all namespaces and put them all in c.watchingNamespaces
} Is this the right way? |
This way is more reasonable. |
I think this is the right way to solve this problem. We should put all exsiting namespaces in |
Agreed. When the selector is not empty, it is more semantic to watch nothing. |
if !validation.HasValueInSyncMap(c.watchingNamespaces) && len(c.watchingLabels) == 0 {
// ...
} It could solve this problem after add |
I assume that the new behavior is accepted. This could be a breaking change for some environments. |
Yes, this is a breaking change. But it's also valuable and I think we should make changes. |
@cmssczy This modification is required, and some comments or documentation may need to be modified. Also need to check other related sections |
I will check it. Thanks for remind. |
what is the difference between |
Yes, |
I will send a pr to fix it. |
Do we plan to delete |
@cmssczy yes, please! Thanks |
Issue description
I set
namespace_selector: ["apisix.ingress=watching"]
in conf.yaml before I start the apisix-ingress-controller. And there are no namespaces can match this label. So I think what we want is that the controller would not watch any namespaces. But in fact it watch all the exsiting namesapces(default/kube-system/kube-public...).I check the code and find that it will list all the exsiting namespaces and put them all in
watchingNamespaces
whenwatchingNamespaces
is empty.Is it really what we want?
I think it can put all existing namespaces in
watchingNamespaces
only when thenamespace_selector
is empty.apisix-ingress-controller/pkg/ingress/compare.go
Lines 50 to 64 in 1159522
Environment
Minimal test code / Steps to reproduce
namespace_selector: ["apisix.ingress=watching"]
which no namespaces can match this label.watchingNamespaces
Actual result
it can print all the exsiting namespaces' name.
Error log
no error log
Expected result
no namespaces in
watchingNamespaces
The text was updated successfully, but these errors were encountered: