Search code examples
haproxyhaproxy-ingress

Is there an endpoint in the HAProxy Data Plane API that gives the current file version?


I am using the Data Plane API to start a transaction. I notice the top of my haproxy file looks like this.

# _version=130

When I start my app to consume this API I read that value to base my transaction version on. However, sometimes it gets stuck telling me the following error.

{
  status: 409,
  text: '{"code":409,"message":"15: Version mismatch, transaction version: 129, configured version: 130"}\n',
  method: 'PUT',
  path: '/v1/services/haproxy/transactions/5d0298aa-038e-44d1-9381-f8db0612d9ea'
}

It seems that the data plane api sidecar process does not stay in sync with the current values inside the active haproxy.cfg file on the system. However, after scouring the API's swagger (OpenAPI) file. I am unable to locate any methods to get the actual version to use when starting and committing a transaction.

Has anybody else ran into this issue? Have you noticed that it only happens when a transaction rollback is issued? I have... so far...


Solution

  • I believe by performing a GET request on a configuration endpoint will return it within _version. For example:

    # curl --user <user>:<password> http://localhost:10000/v1/services/haproxy/configuration/frontends
    {"_version":2,"data":[{"name":"fe_main"},{"http-use-htx":"enabled","name":"fe_stats"},{"http-use-htx":"enabled","name":"stats"}]}