Skip to content

runtime servers: admin_state always return maint #343

Open
@devops-email

Description

@devops-email

I'm using a HAProxy 2.4.27 with Data Plane API 2.6.5 on Linux and when I try to get the admin_state for the runtime servers, it always returns maint admin_state, doesn't matter if server is on READY, DRAIN or MAINT state:

$ curl -sX GET --user admin:verysecretpass "http://10.1.1.1:5555/v2/services/haproxy/runtime/servers/webserver1?backend=backend1" | jq
{
  "address": "10.1.1.1",
  "admin_state": "maint",
  "id": "1",
  "name": "webserver1",
  "operational_state": "up",
  "port": 8080
}

Checking the Data Plane API code (GetServerState() and GetServersState() in handlers/runtime_server.go) and its dependencies, I found GetServerAdminState() in https://github.com/haproxytech/client-native/blob/master/misc/bits.go and I solved the problem by making the changes below:

From:

if mask.Any(B0, B1, B5) {
  return "maint", nil
}
if mask.Any(B3, B4) {
  return "drain", nil
}

To:

if mask.Any(B0) {
  return "maint", nil
}
if mask.Any(B1) {
  return "drain", nil
}

I don't know if it's a feature that isn't normally used, as I haven't found anyone else reporting this problem. I don't have any information on whether this problem continues in the most recent versions of HAProxy and Data Plane API, but it was the solution adopted to resolve the problem in these versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions