Return 503 by default when no endpoint is available #1513
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PRs changes the backend of a location to be empty per default instead of "upstream-default-backend". During template rendering, if the backend of a location is empty, a
503
is returned to the client.Which issue this PR fixes
Currently, if no endpoint is available for an upstream, the backends of locations using that upstream will be set to the default-backend.
This means that a client might get a
404
under heavy load when no end-points are available. This sound wrong has clients interpret404
as a valid response meaning the resource doesn't exist. I think that instead of a404
, the answer should be a503 Service Unavailable
(The server is currently unable to handle the request).The definition of the default backend from the documentation says it's a service [for] handling all url paths and hosts the nginx controller doesn't understand.
I think that perfectly fine and would like not to use it anymore for upstreams without endpoints, which the Nginx Controller knows about but are simply temporarily unavailable.
Special notes for your reviewer
I didn't tested the behavior when using a
custom-default-backend
, but I expect it to be unchanged by this PR.