Open git001 opened 7 months ago
Hey, this will work for sure. But to make a proper fix, we would need to do the following:
HAPROXY_MASTER_CLI
actually returns values separated by ;
, in the future there could be multiple of those, so we need to spilt the string by ;
unix@
prefix as we currently only work with unix stats sockets, check if it works and use itWith this logic we would be safe that any other sockets, or types of sockets added to the env variable won't break our parsing and we will always use the one we actually need.
I would also like to add that this code (not the PR itself) would override the haproxyOptions.MasterRuntime
even if the environment variable is not set:
because misc.IsUnixSocket
returns true
for empty strings:
So if someone tries to set the MasterRuntime
with the--master-runtime/-m
flag or haproxy.master_runtime
in the config file that value will be overwritten with an empty string
I guess it relies on the fact that HAPROXY_MASTER_CLI
is always set when HAPROXY_MWORKER
is set but I don't know if that's a safe assumption
Hey, this will work for sure. But to make a proper fix, we would need to do the following:
* the variable `HAPROXY_MASTER_CLI` actually returns values separated by `;`, in the future there could be multiple of those, so we need to spilt the string by `;` * we need to iterate through it and find the one with `unix@` prefix as we currently only work with unix stats sockets, check if it works and use it
With this logic we would be safe that any other sockets, or types of sockets added to the env variable won't break our parsing and we will always use the one we actually need.
Okay. How should then the haproxyOptions.MasterRuntime
be set for more the one socket?
@georgijd-form3 is right, the IsUnixSocket should be improved to properly check whether the string is unix@
If we have multiple sockets set, we should use the first one that is valid. As it is good enough for what we need it for.
@mjuraga
If we have multiple sockets set, we should use the first one that is valid. As it is good enough for what we need it for.
Looks like there is a code which checks if the socket is usable.
maybe there is something similar to canUseMasterSocketReload
or can this function be used to check if a master socket is usable?
Hi everyone,
Any updates on this?
With commit https://github.com/haproxy/haproxy/commit/8a02257d88276e2f2f10c407d2961995f74a192c was the
sockpair@
added to the master socket.fix: https://github.com/haproxytech/dataplaneapi/issues/329