dataplaneapi icon indicating copy to clipboard operation
dataplaneapi copied to clipboard

Unable to change consul serverslotsbase in dataplane api config

Open rhermods opened this issue 2 years ago • 2 comments

Hi, After changing serverslotsbase in the dataplane api config file to something like this:

service_discovery:
  consuls:
    - address: 127.0.0.1
      enabled: true
      port: 8500
      retrytimeout: 1
      serverslotsbase: 1
      serverslotsgrowthincrement: 3
      serverslotsgrowthtype: exponential

and restarting haproxy, the serverslotsbase setting is set to the default value again (10).

Haproxy version: 2.8.3 Dataplane version: v2.9.0

Any ideas or workarounds for this? Thanks in advance!

rhermods avatar Dec 14 '23 09:12 rhermods

I ran into this as well, it looks like this is statically set in the code here: https://github.com/haproxytech/dataplaneapi/blob/67e0697e7e5b6b8e3f3d881cb2c1175ff53ae446/discovery/utils.go#L28 If anything less than 10 is specified for server_slots_base or server_slots_growth_increment, it resets it to 10 as the minimum.

Since this is set as a constant, it seems like to get around it we'd have to change it locally and build a custom version. Is there anyway to change that to a variable that can be set either in a configuration file or in the command line arguments?

DLMSweet avatar Feb 03 '25 14:02 DLMSweet

Is there any concern about this? By maintaining this we ensure that we don't have to reload HAProxy often. Having the disabled servers in the config, allows us to set the IP:port pairs and enable them dynamically trough runtime API.

mjuraga avatar May 09 '25 12:05 mjuraga