dataplaneapi
dataplaneapi copied to clipboard
HAProxy Peers/Aggregators Auto discovery based on AWS EC2 Tags
Now DataPlane API support EC2 autodiscovery in AWS, it would be cool to get same option for peers server
directive.
For example such Tagging can be used:
-
HAProxy:Peer:Cluster = mycluster
- cluster name -
HAProxy:Peer:Name = loadbalancer1
- server name -
HAProxy:Peer:Port = 10000
port to use with peering - Optional
HAProxy:Peer:Cetificate = /etc/ssl/certs/site.pem
path to ssl cert to enable SSL on peer communication. Should be used on all EC2 in Cluster to be valid: if at least one EC2 in cluster omit this EC2 Tag then all members of cluster will be set to not work over ssl.
Each member of cluster controlled via DataPlane API could get own EC2 ID and read own tags to get own name. And then find all other EC2s that belong to cluster.
This how it will result on loadbalancer1
:
peers mycluster
bind :10000 ssl crt /etc/ssl/certs/site.pem
default-server ssl
server loadbalancer1
server loadbalancer2 192.168.1.11:10000
and on loadbalancer2
:
peers mycluster
bind :10000 ssl crt /etc/ssl/certs/site.pem
default-server ssl
server loadbalancer1 192.168.1.10:10000
server loadbalancer2
We will try to incorporate this in our roadmap.
FWIW, I've had pretty good success with hashicorp/go-discover to provide this functionality in our applications.