-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty HAPROXY_CFGFILES environment variable causing managed dataplanapi process to exit #318
Comments
@TonyNguyenAdNet, we recently experienced the same issues running HAProxy v2.8.5 and Dataplaneapi v2.8.7 on OEL9. It looks like adding
We no longer get the has at the top of the HAProxy config file and it did not re-arrange anything. EDIT: This can be added as a config option in the yml as |
I have this same issue. The I'm on haproxy 3.0.3 Im following the exact instructions from here in a Kubernetes pod: I'm mounting in a file:
and in the main haproxy.cfg I have:
but:
I'm going to try setting this ENV but like the posters said above,
seems to just not work. |
@tommyjcarpenter my situation involved setting dataplaneapi back to watching the actual HAProxy configuration file, as well as setting the |
@KiyoIchikawa can you please elaborate on the first part? I tried the im doing this in kubernetes, which there are no instructions for, but I thought it should be the same using the Im currently giving a shot at the sidecar approach instead. |
So, I've realized only now that while my sidecar loads and does reads fine, it cant restart the haproxy process, because its in a separate container 😓 this should have been obvious... 20/20 hindsight. So i'd like to circle back here, because I have tried a million ways to solve this and I keep hitting this issue. Im trying to run the dataplaneapi in the same container as haproxy. In my haproxy config, I have
both of those my dataplaneapi.yaml looks like:
I have tried
|
Maybe related, but HAProxy is mixing things up;
and /etc/haproxy/dataplaneapi.yaml never gets created. Thing is, dataplaneapi config is stored in /etc/haproxy/dataplaneapi.yml , not /etc/haproxy/dataplaneapi.yaml |
Hi Everyone, hoping for some help!
High level goal:
Configure HAProxy via split config files, using
-f conf.d/
, similar to OS service configurations*.d/
pattern, while using dataplaneapi (latest 2.8 version) for basic configuration such as draining/enabling a backend server via remote scripting [1]. We are currently running into the issue where dataplaneapi invoked via program/command errors out due to what it believes to be a missing configuration file:time="2023-11-25T17:19:21-08:00" level=fatal msg="The configuration file is not declared in the HAPROXY_CFGFILES environment variable, cannot start."
... however the initial HAProxy config file is specified within the .yml file as so:
We have also tried the command-line argument, which results in the same error:
--config-file /f/haproxy-h3-9200/conf.d/00-haproxy.cfg
Note that even though we are specifying the first/primary config file (
00-haproxy.cfg
) to dataplaneapi, when starting dataplaneapi independently of HAProxy (ie, not usingprogram+command
), the desired management functionality works for the backend specified in the second file (01-haproxy.cfg
). It's just when using HAProxy to manage the dataplaneapi process do we see the above error.Doing some testing, it appears that HAProxy is not setting a value for this environment variable when spawning dataplaneapi via the
program
directive. As a simple test, I replaced dataplanapi with a simpleecho
command as shown in the below examples. I'm testing both our current HAProxy production version 2.2.14 as well as the latest 2.8.4, and as the output shows, the value ofHAPROXY_CFGFILES
is empty when using theecho
command. Interestingly, switching toprintenv
shows this variable being set! So perhaps there's some subtle behavior of the current sub-process creation that is not passing variables with certain sub-commands?Configuration Overview:
conf.d/00-haproxy.cfg
andconf.d/01-haproxy.cfg
are the contents of a previously working single configuration file, with00-haproxy.cfg
containing thedefaults/global
sections and01-haproxy.cfg
containing a singlelisten
directive. Setting aside dataplaneapi, the HAProxy functionality itself works fine with this configuration: the single listen configuration forwards incoming requests to the appropriate backend servers as expected.program
config:command echo "HAPROXY_CFGFILES: ${HAPROXY_CFGFILES}, PATH: ${PATH}, HAPROXY_SERVER_NAME: ${HAPROXY_SERVER_NAME}, HAPROXY_LOCALPEER: ${HAPROXY_LOCALPEER}"
With 2.2.14:
HAProxy invoke command1 (multiple config files specified):
/f/haproxy-9200/bin/haproxy-9200 -Ws -f /f/haproxy-9200/conf.d/00-haproxy.cfg -f /f/haproxy-9200/conf.d/01-haproxy.cfg -p /run/haproxy-9200.pid -S /run/haproxy-9200-master.sock
HAProxy invoke command2 (config directory specified):
/f/haproxy-9200/bin/haproxy-9200 -Ws -f /f/haproxy-9200/conf.d -p /run/haproxy-9200.pid -S /run/haproxy-9200-master.sock
Output is the same for both invocations:
With 2.8.4:
HAProxy invoke command1 (multiple config files specified):
/f/haproxy-h3-9200/bin/haproxy-h3-9200 -Ws -f /f/haproxy-h3-9200/conf.d/00-haproxy.cfg -f /f/haproxy-h3-9200/conf.d/01-haproxy.cfg -p /run/haproxy-h3-9200.pid -S /run/haproxy-h3-9200-master.sock
HAProxy invoke command2 (config directory specified):
/f/haproxy-h3-9200/bin/haproxy-h3-9200 -Ws -f /f/haproxy-h3-9200/conf.d -p /run/haproxy-h3-9200.pid -S /run/haproxy-h3-9200-master.sock
Output is the same for both invocations:
Finally, with
command printenv
I see the following output on both HAProxy versions (the variable is set):Any insight here is appreciated! We are very close to having our preferred configuration setup that is a balance between previous management styles and utilizing the latest dataplaneapi functionality.
[1] it is understood that the developers of dataplaneapi want to move administration completely under dataplanapi's control, ie, re-writing configuration files; however our production practices need to move in a slower fashion utilizing our current Ansible/Puppet management style which relies on these tools to manage config files. We will ultimately embrace dataplaneapi for management completely but now is not that time.
The text was updated successfully, but these errors were encountered: