API plugin of HaProxy for Canary deployment
Before starting to write this article I have tried to do research to find REST API control of HaProxy for canary deployments behind of HaProxy loadbalancer. I have tested a lot of stuff in dataplane api of Haproxy but, I cannot find such API. Due that I have started to analyze HaProxy socket internal commands and got all needed stuff which I could automate. Before starting to write an API, I have collected requirement of CI/CD application which will use it. And main part was authorization from Jenkins Master and Slave servers. Due that I have created simple authorization with static username, password and created access list to access only from source IP addresses of any Jenkins servers(Master or Slaves). You can download all code files from the following repository with detailed usage of README.
$ git clone https://github.com/jamalshahverdiev/python-general-public-codes.git && cd python-general-public-codes/HaProxyRestAPI/
I have created system UNIT file for linux if you want use this API in the startup. For the detailed usage and see in the real how traffic will work you can watch the following video.
I hope it will be useful to all.