Skip to content

Weights are not returned from the runtime API #408

@ema-pe

Description

@ema-pe

Hi, I'm using the following two endpoints to add a new server and set its weight via the Runtime API, in order to avoid reloading HAProxy:

  • PUT /services/haproxy/runtime/backends/{parent_name}/servers/{name} (doc)
  • POST /services/haproxy/runtime/backends/{parent_name}/servers (doc)

The issue I'm facing (also reported on the HAProxy Discourse) is that runtime transient server properties (such as weight) are not properly returned by the GET /services/haproxy/runtime/backends/{parent_name}/servers/{name} endpoint.

Here is an example:

curl commands
$ curl -s -u admin:admin "http://localhost:30555/v3/services/haproxy/runtime/backends/function_figlet_forwarded/servers" | jq           
[                                                                                                                                                                       
  {                                                                                                                                                                     
    "address": "IP_X",                                                                                                                                           
    "admin_state": "ready",                                                                                                                                             
    "id": "1",
    "name": "openfaas-local",
    "operational_state": "up",
    "port": 31112
  },
  {
    "address": "IP_Y",
    "admin_state": "ready",
    "id": "2",
    "name": "test",
    "operational_state": "up",
    "port": 31112
  }
]
$ curl -s -u admin:admin -X PUT "http://localhost:30555/v3/services/haproxy/runtime/backends/function_figlet_forwarded/servers/openfaas-local" -H "Content-Type: application/json" -d '{"weight": 80}' | jq
{
  "address": "IP_X",
  "admin_state": "ready",
  "id": "1",
  "name": "openfaas-local",
  "operational_state": "up",
  "port": 31112
}
$ curl -s -u admin:admin "http://localhost:30555/v3/services/haproxy/runtime/backends/function_figlet_forwarded/servers" | jq
[
  {
    "address": "IP_X",
    "admin_state": "ready",
    "id": "1",
    "name": "openfaas-local",
    "operational_state": "up",
    "port": 31112
  },
  {
    "address": "IP_Y",
    "admin_state": "ready",
    "id": "2",
    "name": "test",
    "operational_state": "up",
    "port": 31112
  }
]

As shown above, even after setting the weight via the runtime API, the value does not appear in subsequent GET response. I think this is a bug, or am I doing something wrong? I'm using HAProxy 3.3.10-0a72d7f9f and Data Plane API v3.2.5 152e8a0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions