Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime servers: admin_state always return maint #343

Open
devops-email opened this issue Aug 6, 2024 · 0 comments
Open

runtime servers: admin_state always return maint #343

devops-email opened this issue Aug 6, 2024 · 0 comments

Comments

@devops-email
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant