Closed captncraig closed 6 years ago
I think from an API standpoint this is very specific to the purpose and not generally useful for all. My plan here is to return all NodeRoles for everything and let the consumer achieve any permutation they desire instead, and later add filtering if needed (it isn't at our scale). I'll get an API in this weekend that should work for ya, it'll require changing the interface up for a mass return.
I pushed this up in 0f954248964b9db514469cd6112c682b44493b68, example output when not passing a node, e.g. /api/node/roles?pretty=1
:
{
"Inactive": 24,
"Active": 1914,
"Roles": [{
"Active": true,
"SiblingsInactive": 0,
"SiblingsActive": 8,
"Description": "06 - CO T20: Chat - Chat Websockets",
"Service": "HAProxy",
"Node": "co-web01"
}, {
"Active": true,
"SiblingsInactive": 0,
"SiblingsActive": 8,
"Description": "06 - CO T20: Chat - Chat Websockets",
"Service": "HAProxy",
"Node": "co-web02"
},
And a single node, e.g. with /api/node/roles?node=ny-service03&pretty=1
:
{
"Inactive": 4,
"Active": 12,
"Roles": [{
"Active": false,
"SiblingsInactive": 0,
"SiblingsActive": 2,
"Description": "06 - NY T2: Promo/Support - Providence",
"Service": "HAProxy"
}, {
"Active": true,
"SiblingsInactive": 0,
"SiblingsActive": 2,
"Description": "06 - NY T2: Promo/Support - be_dmz_stackshop",
"Service": "HAProxy"
},
Closing since it's addressed above
The node status api currently tells me which backends a given node is a member of, and its' status in each of them. For some use cases (patching), it is necessary to know how many other nodes in each backend are up/down. This just adds two more fields
TotalActive
andTotalInactive
to each NodeRole, and populates it from the HAProxy provider as it iterates over each server anyway.