-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Remove backend from external backends if same backend name #8430
Conversation
@freddyesteban: This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @freddyesteban. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@longwuyuan thank you for taking the time to look at our PR. Our use case for changing the Service type in flight is to spin down all pods if not in use (spin to zero), and point to an external service to signals the user that pod is spun down ( a please wait page) until it wakes up. Our automation "wakes up" the pods by scaling the deployment replicas back to 1 and the Service Object is switched to use the ClusterIP. This particular behavior worked on an older version of the controller, the nginx controller would cause a reload for the change though. In this version of the controller, it attempt to perform the change dynamically using the Lua balancer which is great so we can hopefully avoid the reload. You've suggested why not delete the ingress object and we could do that but found that just updating the Service type avoids a reload. Our clusters are relative big and this could be very advantageous to our use case. To replicate the issue, I've put together a step-by-step guide here. To see the difference with our change, follow step-by-step guide here. Why fixing removing the cached external backend with the same name is important to us? We're aware that we could delete the ingress object or even update it in place and that would work but that causes a reload. Which it could be ok since the old ingress controller object was doing this but we'd like to take advantage of the dynamic reload our fix is providing. Here are two step-by-step guide for the approach of deleting the ingress object and just recreating, the logs will show a backend reload, see here. Here are two step-by-step guide for the approach of updating the ingress object to use a separate Service object, the logs will show a backend reload, see here. |
Hi @freddyesteban ,
My next request is please write tests. I think there should be some assurance that just checking for a pre-existing stale backend in Lua does not interfere with any other codepath. Please write tests that you think will provide this assurance. I din't expect any panic for a if condition check, but a test should confirm that for users who don't create a externalName type service and edit it later, there is not going to be any impact. I don't even know if the externalName type existing but not being pointed to the internet but to a custom destination make sa difference or not. Basically, please write all the tests that will provide the assurance needed. |
/kind feature |
@freddyesteban on a very different note, if. you have already tried https://kubernetes.github.io/ingress-nginx/examples/customization/custom-errors/#custom-errors, please write a note on why custom-errors are not a preferred solution for the use case you described. It would be such a clean and supported solution to server the "please wait" page from custom-backend. |
Please sign CLA |
/assign |
@tao12345666333 We were under the impression that we as a company had already done that but I think the project moved to EasyCLA and that's no longer the case. My manager has filed a ticket to get that fixed. Thank you. |
Thank you. I created the issue and linked it to this PR. In regards to testing, the change would only remove the backend from I'm new to Lua, apologies if there's a better way to approach the testing and if you have any suggestions or could point me in the right direction, I'd appreciate that. |
For us at least, It's more of routing to a particular external service when the Service changes rather than creating a default backend that could handle our particular use case. With enough work, I think we could find multiple solutions including your suggestion of deleting ingress objects. We'd like to have our please wait service decoupled from the nginx controller deployments as it serves multiple clusters, that's just one factor. |
…e, prevents using old cached external backend
…or unit test purposes
@longwuyuan @tao12345666333 thoughts on the changes? |
/ok-to-test Thanks |
…e, prevents using old cached external backend
…or unit test purposes
…-main Fix linting and rebase kubernetes main
Sure. It's on my queue. |
/test pull-ingress-nginx-test-lua |
/retest |
Errors in CI are not related to code changes, which may have something to do with test-infra. I will do a code review
|
Ricardo had to remove a if condition that checks for DIND, because prow was failing e2e but local/laptop e2e was working. |
/retest |
@tao12345666333 any updates on this or anything I should be doing to help get this over the line? TIA |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Co-authored-by: William Quade <[email protected]>
add codeowners
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: freddyesteban The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@freddyesteban: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
What this PR does / why we need it:
Remove backend from external backends if new backend has the same name, prevents using old cached external backend when type of backend is changed.
When changing Service object type from
ExternalName
toClusterIP
, the backend inbackends_with_external_name
in the lua balancer is never removed causing the External backend to keep serving traffic. This PR removes the balancer frombackends_with_external_name
if it has the same name.Types of changes
Which issue/s this PR fixes
fixes #8440
How Has This Been Tested?
make dev-env
nginx:latest
ExternalName
pointing to an external website, traffic is routed appropriatelyClusterIP
to route traffic to Deployment pod, traffic is routed appropriately (prior to this PR, traffic was still routed using external backend).Checklist: