mittwald / kube-httpcache

Varnish Reverse Proxy on Kubernetes
MIT License
300 stars 74 forks source link

Support for multiple backends #133

Open davidroth opened 2 years ago

davidroth commented 2 years ago

Hi, thanks for this really nice project. It solves some hard issues in an elegant way. Currently its only possible to specify a single backend via -backend-service=backend-service. Yes this backend service can have multiple replicas. But what If you have a single varnish in front of lets say 2 (or more) backends, each with several replicas.

I'd need exactly that: Support for multiple backends. With "backends", I mean distinct backend applications.

Request -->  [ Varnish ]  -->
                                    |---> [ Backend Service A]
                                                 [Backend Service A POD 1]
                                                 [Backend Service A POD 2]
                                    |---> [ Backend Service B]
                                                 [Backend Service B POD 1]
                                                 [Backend Service B POD 2]

Currently I'd need to launch two kube-httpcache deployments. One for each backend. However, that leads to more overhead and less efficient memory utilization because I cannot share a given memory space for all the backend applications.

martin-helmich commented 2 years ago

Hey David -- thanks for your feedback; happy to hear that it's useful to you. 🙂

This is a very reasonable suggestion, that I'd very much like to see implemented as well. However, this would probably require some major changes in the internal design of the controller, so I cannot make any promises as to when we'd actually get around to implementing this. PRs are always welcome, though. 🙂

sgohl commented 4 months ago

I have the same requirement - lots of different applications that I want to proxy through varnish.

@davidroth did you also end up running dedicated varnish instances per application?

I feel that kubernetes is missing some kind of middleware feature that varnish could be implemented as