Support re-reading the HAproxy configuration file when handling `/services/haproxy/configuration/` endpoints.
Endpoints like /services/haproxy/configuration/frontends/{parent_name}/binds return cached information that's obtained at initialization and never updated (unless disable_inotify is set to false). This means the information could be out-of-date unless Data Plane API is reloaded every time HAproxy configuration file is changed.
Is it possible to add a parameter to enforce re-reading the file when making calls to the affected endpoints?
Worth noticing that /services/haproxy/configuration/raw endpoint is not affected as it always reads the latest on-disk version of the configuration file when handling it.
This can be easily tested by:
0- disable_inotify must be set to true.
1- Perform a GET /services/haproxy/configuration/frontends/{parent_name}/binds. Store the result.
2- Perform a GET /services/haproxy/configuration/raw. Store the result.
3- Manually modify (add/remove) binds in the haproxy.cfg file for {parent_name} frontend.
4- Repeat step (1) and (2). Notice how the result for (1) was the same as before (not reflecting the latest change). (2) do actually show the most recent configuration.
That is exactly the reason inotify mechanism is enabled. So it rereads the files on any change.
@mjuraga, I understand. But it also enable config checks and re-writes following pre-defined rules in the parser. For e.g: to reduce white-spaces or incorrectly remove valid sections. I'm running a pretty long and complex HAproxy configuration and I rather have it not touch it until I have a version that is properly aligned with those rules (and the above bug is fixed). That's the reason why I had to disable the option.
Maybe I'm framing this in the wrong direction and, instead of re-reading during handling, a new flag can be added that enables read-only operations (no re-writes).
For context, I'll workaround the issue by reloading the Data Plane API every time I modify the HAproxy configuration. The re-write is not happening when reading the file at initialization.