dataplaneapi icon indicating copy to clipboard operation
dataplaneapi copied to clipboard

dataplaneapi in read only mode

Open pontostroy opened this issue 4 years ago • 9 comments

Hello, i want to use dataplaneapi only for fetching backed servers. Is it possible to configure it to do not modify haproxy config file? Now I see this in my file

# _md5hash=5633fd65bc4d17590eb9365cb8caecfd
# _version=2
# Dataplaneapi managed File
# changing file directly can cause a conflict if dataplaneapi is running

My config

program dataplaneapi 
  command dataplaneapi --host 0.0.0.0 --port 5555 --haproxy-bin /usr/sbin/haproxy --config-file /etc/haproxy/haproxy.cfg -r 'systemctl status haproxy' -s 'systemctl status haproxy' --reload-delay 3600 --userlist api_users
  no option start-on-reload

pontostroy avatar Oct 11 '21 13:10 pontostroy

Hi, currently this is not possible, but we can see this being an interesting feature to add in some of the future releases.

mjuraga avatar Oct 18 '21 14:10 mjuraga

Hi, I'm also using api mainly read only, or to put some servers in maintenance in a backend.

previously, I was using dataplane api 2.1, and config file was not changed It seem to be changed since 2.2 and this commit https://github.com/haproxytech/dataplaneapi/commit/04964cafc8413d853927612b75d2e8c0ad3cf139

I'm pushing config with puppet, and this is really a problem, as dataplane add theses lines on haproxy reload, so puppet is changing the file again, reload haproxy, . then dataplane write again the file, ....in a infinite change/reload loop.

aderumier avatar Dec 15 '21 20:12 aderumier

Also using ansible to deploy / manage haproxy config file. Read-only would be a really great feature +1

discostur avatar Mar 21 '22 12:03 discostur

Hi Team

# _md5hash=5633fd65bc4d17590eb9365cb8caecfd
# _version=2
# Dataplaneapi managed File
# changing file directly can cause a conflict if dataplaneapi is running

Though we push haproxy.cfg with the chef. The last step on config will reload haproxy then dataplane write again the file, ....in an infinite change/reload loop

To resovle this can we run hapaxy-2.6 and datapalneapi API v2.0.1 ?

lakshmoji-trysapling avatar Oct 31 '22 05:10 lakshmoji-trysapling

Hi, the reason for rewriting is that we use inotify to reload the parser and the client when the file changes externally. And this writes a new md5hash. To disable this you can use following options in your dataplaneapi.yaml:


dataplaneapi:
  disable_inotify: true

Or run the dataplaneapi with --disable-inotify CLI option.

mjuraga avatar Nov 01 '22 09:11 mjuraga

Still there is a case where we:

1- Drain a node through the web interface 2- Use dataplaneapi to configure some maps and reload

and now the initial drain is gone

titansmc avatar May 24 '23 10:05 titansmc