respond with 503 when there are no endpoints

* related to:
  * https://github.com/kubernetes/ingress-nginx/issues/3070
  * https://github.com/kubernetes/ingress-nginx/issues/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.
This commit is contained in:
Tim Reddehase 2018-12-20 14:48:03 +01:00
parent d4d25f6fb4
commit 018a1e4d94
4 changed files with 94 additions and 8 deletions

View file

@ -75,7 +75,8 @@ end
local function sync_backend(backend)
if not backend.endpoints or #backend.endpoints == 0 then
ngx.log(ngx.INFO, string.format("there is no endpoint for backend %s. Skipping...", backend.name))
ngx.log(ngx.INFO, string.format("there is no endpoint for backend %s. Removing...", backend.name))
balancers[backend.name] = nil
return
end