jcmoraisjr / haproxy-ingress

HAProxy Ingress
https://haproxy-ingress.github.io
Apache License 2.0
1.04k stars 269 forks source link

Adding peers and stick-table feature #296

Open eduardodoria opened 5 years ago

eduardodoria commented 5 years ago

Hello, I trying to config HAProxy with stick-table feature. To make this work I'm using config-backend annotation, like this:

ingress.kubernetes.io/config-backend: | stick-table type string len 64 size 1m expire 8h stick store-response res.cook(JSESSIONID) stick match req.cook(JSESSIONID)

But I'm having trouble because we have multiple HAProxy instances and they don't share the table in memory. Also, if any pod changes, HAProxy need to reload and loses the table.

Looking HAProxy docs I found "peers" feature, that I can use to share stick-table between instances, like this:

peer haproxy1 192.168.0.1:1024 peer haproxy2 192.168.0.2:1024 peer haproxy3 10.2.0.1:1024

It's easy to add this in template with fixed servers, but how could I configure the template to list all HAProxy instances IP and add a line for each?

terrafying commented 4 years ago

This would be much easier if peers worked with resolvers - as far as I can tell, it only takes IP's Alternatively, if you're using host network and your nodes don't change, you could just list all your nodes' IPs in the config

kadambkaluskar commented 1 year ago

any update on this feature request?

jcmoraisjr commented 1 year ago

Hi, planning to add shared tables for rate/max/etc limits, btw already did some poc and tests with peers, but we've at least gateway api and control plane / data plane separation as priorities for now.

Anyway maybe adding some templating and var expansion in the config snippets seem to add some value for one that wants to make the peer configuration themselves. How does it sound? I can run a quick poc on that just to confirm if it's as simple as it seems to be.