speedianet / control-issues-tracker

Speedia Control is a lightweight self-hosted PaaS platform written in Go.
https://speedia.net/control/
2 stars 0 forks source link

feat: allow for custom load balancing strategies #6

Open ntorga opened 3 months ago

ntorga commented 3 months ago

The user may need to split the traffic between two containers, so it's important to allow multiple upstreams. Also, the SpeediaOS hard upgrade feature will require the system to run two containers with the same hostname while the migration is performed.

ntorga commented 3 months ago

At first, I thought this was an old request that was copied over to GitHub cause that feature, in theory, was already implemented:

Image

However, by reading the code I did remember why I created this card. I was under the impression that we returned the targets of the mapping as a list of containerIds, but actually, we don't, MappingTarget is an actual entity:

Image

That's also why this was bumped to a higher priority. I imagined I would have had to convert the list of containerIds as a list of entities because (and that's the whole reason of this issue) we need to eventually support different load balancing algos: https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/

With entities we can have weight, max connections etc for each target. Fortunately, it's already a list of entities, so we have a good foundation for when we decide to implement this nice to have feature. However, we have a long list of things more important to be developed right now so I'm moving this issue back to the bottom of the approved list.

By the way, reading the LB guide, NGINX Plus seems to have most of the nice features, but searching for the license cost, it is unbelievable expensive. Maybe we should consider using NGINX JS or better yet migrate to OpenResty. We could also consider Caddy or Pingora but they don't support SSL Passthrough officially. I'm creating a new issue on the backlog to discuss the migration to OpenResty.