-
Notifications
You must be signed in to change notification settings - Fork 8.4k
namespace scope not working as expected #9662
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
/retitle namespace scope not working as expected namespace-scope is something to be looked at. After the stabilization work is completed, I think this will get some attention /triage accepted |
@longwuyuan Raised one PR #9712 to fix this issue |
@yong-jie-gong I think the details of the problem you are hinting at, are not explained here. Also I made a comment on your PR. Please help out here. Please write a step-by-step instructions procedure here in such a way that someone can create a default minikube cluster or kind cluster and then copy/paste from your instructions to reproduce the problem. This is because you have made several assumptions in your post that actually are a deep dive into the configuration of the controller, but none of the impacting design aspects are clearly explained. For example, you can look at the helm chart methijd of installing the controller and the key:value pairs related to that in the values.yaml . There is also the service-account object in the static manifest
|
This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach |
@longwuyuan - I have hit this issue and have a simple recreate. I believe this is also the same issue described in #9636.
I see that the multi-ingress controller docs state:
It doesn't really make it clear what "not used" means, but I'd expect the behavior to be consistent. Either it should mean that the Ingress is never processed (unless the deprecated annotation is used), or it is always processed. To give a bit more background on my scenario: I have a cluster-wide ingress controller that is used to provide external access to the cluster. For a specific application, I want to use the This all works fine, except that the application also defines another Ingress resource in the same namespace that specifies the ingress class for the cluster-wide controller. As per the recreate above, when the resource is first created, everything is fine. It is ignored by the namespaced controller and the cluster-wide controller picks it up and processes it. Unfortunately, when the cluster-wide controller controller updates the status, that causes the namespaced controller to kick off a sync, even though the ingress class does not match. The resource then flip-flops between the two controllers. I believe the fix in the linked PR is good. It would mean that, in the update scenario, it would still check the annotation on the resource and consequently ignore it. |
@davidcurrie Please explicitly state what the issue is for you. Are you trying to install a instance of the ingress-nginx controller that processes ingresses only from one namespace ?
|
@longwuyuan - answers as follows:
Yes. The complicating factors though are that a) there are other ingress resources in that same namespace that should be processed by a cluster-wide controller, and b) the namespaced controller should not have any cluster-wide permissions. In particular, the namespaced controller cannot read
As I said above, the application has a requirement for sharding when one component is calling another. We want to use nginx's
The recreate above contains all of the flags necessary to recreate the problem.
This works because it does not set ingress-nginx/internal/ingress/controller/store/store.go Lines 475 to 478 in 6ff70f0
GetIngressClass because, even if it can't read IngressClass resources (which that function handles anyway) it may still be able to usefully process annotations.
|
|
@longwuyuan, thanks for providing some background. As previously stated, we're using this nginx instance for internal traffic within the application. As such, we deploy the controller as part of what is essentially a packaged application. To date, we have avoided creating cluster-scoped resources, making it easier to persuade administrators to deploy the application in a multi-tenant cluster. I appreciate that this is very definitely an edge case. What bothers me most here is the inconsistency in behavior. If the controller does not have permission to list On both an add and an update, I would argue that it should ignore Note that none of the above is really about namespacing, it's just about what happens when it can't list |
We've run into the same behavior as we run an ingress controller per tenant namespace to restrict the blast damage of any configuration issues (lots, saved us from them many times). |
@davidcurri tht udpate is helpful. I think that a ton of info needs to be exchanged for triaging what you explained. I will try to list in not any particular order
|
@longwuyuan - I'm only describing what we are doing as motivation as to why this matters to us. In terms of reproduction, please just follow the steps in #9662 (comment) (the configuration we package in our application is based on a I believe what I'm describing is exactly the same as in the issue description. The key points are that the controller does not have permission to list |
Thank you @davidcurrie . I need to go backwards towards basics as I am not able to understand the problem that needs to be solved in the code. This is how I understand the related current feature of the controller in v1.9.4 ;
If I am reading the info here right, I have to guess that the description of the problem to be solved is not detailed enough
The timestamps are different for the create as well as the edit events in the screenshot
Previously, in the ingress configuration, I had set the backend service name to the actually existing service Hence I think that in my test, I saw the controller ignore a ingress correctly, as expected. Since this is not working for you, the issue description needs to be more detailed for example, output of below commands in one single post ;
But this is all my opinion. You may just wait for comments from others on this issue and the related PR |
@longwuyuan - additional information as requested...
At |
@davidcurrie thanks for the update. This message
does not mean that a request was sent to the controller and the controller matched the rules fro the ingress object named as If you want to do that deep dive to describe a problem or bug in the code, then please edit the above post and create the app backend and send requests, first with the backend as test and next with the backend as changed. Correspondingly edit the logs also. If the request gets proper response code of 200, then it is proof that that the ingress was processed by the controller. On a completely different observation, even though you have explained already, I still do not understand the practical need to disable the ingressClassResource. I suspect that the practical use of that spec Secondly I suspect that the spec Please wait for comments from others and kindly join the community meeting. I could be wrong but my summary is ;
|
I can assure you that, if the backend service did exist then the controller would have configured nginx to route to it. I'm just trying to keep the recreate as simple as possible. The desire to not use As you'll see from the linked PR in the |
there is a flag to the controller like |
|
I won't rehash the problem description. It's a shame the original PR was not merged, as I believe it was the correct fix. I understand that this is an edge case, though, and if there is no intention of implementing this simple change imminently, I'd close this issue. |
@davidcurrie thank you for the updated comment. The namespace-scoping is closer to the Ingres-API unlike a fringe implication, so closing this issue is not fair. The problem thought is resources available to work on it. So lets leave this open to track namespace-scoping. |
What happened:
but if I restart nginx-ingress-controller, "test-global" path rule will be removed from nginx configuration. it means nginx-ingress-controller behave different on runtime and fresh start.
What you expected to happen:
s nginx-ingress-controller should work in consistent way on runtime and fresh start.
if ingress object doesn't belongs current nginx-ingress-controller, it should be not caught and write into nginx path rule
NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
nginx-ingress-controller --version
NGINX Ingress controller
Release: v1.5.1
Build: git-f966ccc43
Repository: github
nginx version: nginx/1.21.6
Kubernetes version (use
kubectl version
):Client Version: version.Info{Major:"1", Minor:"24+", GitVersion:"v1.24.7-eks-fb459a0", GitCommit:"c240013134c03a740781ffa1436ba2688b50b494", GitTreeState:"clean", BuildDate:"2022-10-24T20:40:13Z", GoVersion:"go1.18.7", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24+", GitVersion:"v1.24.8-eks-ffeb93d", GitCommit:"abb98ec0631dfe573ec5eae40dc48fd8f2017424", GitTreeState:"clean", BuildDate:"2022-11-29T18:45:03Z", GoVersion:"go1.18.8", Compiler:"gc", Platform:"linux/amd64"}
Environment:
NA
Cloud provider or hardware configuration: AWS
OS (e.g. from /etc/os-release): NA
Kernel (e.g.
uname -a
): 4.18.0-305.el8.x86_64 Basic structure #1 SMP Thu Apr 29 08:54:30 EDT 2021 x86_64 x86_64 x86_64 GNU/LinuxInstall tools:
Please mention how/where was the cluster created like kubeadm/kops/minikube/kind etc.
Basic cluster related info:
kubectl version
kubectl get nodes -o wide
How was the ingress-nginx-controller installed: helm
helm ls -A | grep -i ingress
helm -n <ingresscontrollernamepspace> get values <helmreleasename>
Current State of the controller:
kubectl describe ingressclasses
kubectl -n <ingresscontrollernamespace> get all -A -o wide
kubectl -n <ingresscontrollernamespace> describe po <ingresscontrollerpodname>
kubectl -n <ingresscontrollernamespace> describe svc <ingresscontrollerservicename>
Current state of ingress object, if applicable:
kubectl -n <appnnamespace> get all,ing -o wide
kubectl -n <appnamespace> describe ing <ingressname>
Others:
kubectl describe ...
of any custom configmap(s) created and in useHow to reproduce this issue:
Anything else we need to know:
The text was updated successfully, but these errors were encountered: