-
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
Fix 503 error generation on empty endpoints #3628
Fix 503 error generation on empty endpoints #3628
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
@0robustus1 please sign the CLA |
Get(f.IngressController.HTTPURL). | ||
Set("Host", host). | ||
End() | ||
Expect(errs).Should(BeEmpty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reuse runRequest
here to keep things DRY
@@ -189,6 +249,24 @@ func ensureRequest(f *framework.Framework, host string) { | |||
Expect(resp.StatusCode).Should(Equal(http.StatusOK)) | |||
} | |||
|
|||
func ensureRequestWithStatus(f *framework.Framework, host string, statusCode int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that we have this helper we can refactor ensureRequest
to use this function
@@ -92,6 +92,60 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() { | |||
Expect(nginxConfig).Should(Equal(newNginxConfig)) | |||
}) | |||
|
|||
It("handles endpoints only changes (down scaling of replicas)", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why is this necessary given you have https://github.com/kubernetes/ingress-nginx/pull/3628/files#diff-8700c46a8379c603b5e41ccbaff6b71eR124?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is an unnecessary remnant from a first version of the test. I removed it.
ensureRequestWithStatus(f, "foo.com", 503) | ||
}) | ||
|
||
It("handles endpoints only changes consistently (down scaling of replicas vs. empty service)", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about
It("returns 503 when a service is created without replicas or replicas scaled down to zero at runtime", function(...)
LGTM. Please sign the CLA and squash commits into one before we merge. |
/check-cla |
@0robustus1 friendly ping. I want to include this PR in 0.22 (last PR) but I am not sure if you can sign the CLA and squash the commits. Please let me know :) |
8c46e85
to
b1bd660
Compare
b1bd660
to
e489f70
Compare
@aledbf i squashed the commit. Regarding the CLA we're setting up CCLA which is why it is taking a little while; we should get it sorted this week. Sorry for that. |
e489f70
to
6cbd918
Compare
It turns out the CCLA setup on our side takes a little bit longer than originally expected. I'll keep you posted on the developments. (Sorry again) |
@0robustus1 any update with the CLA process? |
Sadly not yet. |
* related to: * kubernetes#3070 * kubernetes#3335 * add a 503 test * test a service that starts out empty (a.k.a. ingress-nginx controller (re-)start) * test scaling up (should route traffic accordingly) * test scaling down to empty service * use custom deployments for scaling test. * provide a fix by updating the lua table (cache) of the configured backends to unset the backend if there are no endpoints available.
6cbd918
to
018a1e4
Compare
/lgtm |
@0robustus1 thanks! |
If there are no replicas defined, do not wait around for the respective endpoints, since none are expected.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 0robustus1, aledbf The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
It provides two tests (minimal example) to illustrate a problem when encountering a service with no endpoints. One expects a generated 503 response in this case by the ingress-nginx.
But if such a change happened during runtime (e.g. replica-count changed from 2 to 0)
a 502 or 504 is returned instead.
This issue seems to have been outlined by the following github issues:
I also added an attempt at fixing the issues (by removing the backend from the lua cache when there are no endpoints, instead of skipping it).
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #3070Special notes for your reviewer: