2

I'm trying to use the lua-circuit-breaker plugin with ingress-nginx in a Kubernetes cluster. I want to set up two upstream servers such that the first is "wrapped" with this circuit breaker, and it falls back to a different upstream endpoint in case the circuit breaker is open. Both upstream servers are Kubernetes Services.

There are 2 things that I am unsure of at the moment.

  1. The plugin support of ingress-nginx seems to expect plugins to operate within certain callbacks like init_worker or rewrite. I don't see how I can replicate the example in the lua-circuit-breaker plugin given that it sets up a local variable before the "wrapped" function and uses it after. As far as I know, I wouldn't be able to access the cb variable in the header_filter callback if I initialize it in the rewrite callback. It doesn't seem to be possible to wrap the request within the scope of the variable.
  2. I am not sure how to use Kubernetes Ingress objects to set up the fallback behavior. If I use a server-snippet I believe that only applies to a single upstream server and I can't set up multiple upstream servers in a single Ingress.

I sort-of hit a wall here with lack of familiarity of lua-nginx-module that ingress-nginx uses. Any help is greatly appreciated!

Andrew D.
  • 21
  • 1

0 Answers0