-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add controller-isleader xweb component to respond with 200 if the controller in question is a raft leader #2581
Conversation
moved from |
Hi @nenkoru , before going too deep with this PR, we require a CLA before accepting contributions. Information on that is here: https://openziti.io/policies/CONTRIBUTING.html#code-contributions |
Hey, @plorenz! |
CLA looks good 👍 Having looked at it again, I think it looks overall. The only 2 thing I'd like changed are:
Let me know if those make sense. |
I think it gets complicated with moving this logic to a health-checks handler. We might also opt for moving this heath-check to the actual gosundheit custom check https://github.com/openziti/ziti/blob/main/controller/health.go#L15, and try to find the result of the check within that health-check loop at https://github.com/openziti/ziti/blob/main/common/health/handler.go#L99 and decide whether to return 429 status code there. Or we could just make health-checks specific for controller. Thoughts? |
Yes, this was the direction I was thinking. Leave the router health check as it is and replace the use of the common health checker with this, controller specific one. So the only changes required would be to
|
Made changes accordingly. Naming was hard, but I named this as Eg response: < HTTP/1.1 429 Too Many Requests
< Content-Type: application/json
< Date: Tue, 24 Dec 2024 21:47:33 GMT
< Content-Length: 408
<
{
"data": {
"checks": [
{
"details": null,
"healthy": true,
"id": "bolt.read",
"lastCheckDuration": "17.334µs",
"lastCheckTime": "2024-12-24T21:47:24Z"
}
],
"healthy": true
},
"meta": {},
"raft": {
"isLeader": false,
"isRaftEnabled": true
}
} Also I skimmed the zititest but couldn't an appropriate place to put tests for this behaviour. I guess after tests created I could unmark this PR as being a draft and we could continue iterating on this! |
Hi @nenkoru Sorry for the late response, I was out for a couple of weeks at the end of the year. It's looking pretty good. I only have a couple of questions. First, can you make sure your commits are signed, please? (see https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits). Second, how would you feel about making the |
…troller is a raft leader Signed-off-by: Chernenko Ruslan <[email protected]>
…ader check Signed-off-by: Chernenko Ruslan <[email protected]>
Signed-off-by: Chernenko Ruslan <[email protected]>
Signed the commits, will do the path check for somethig like |
Pushed the appropriate change |
Looks good! I'll give it a quick test run tomorrow and then likely merge it up. Thank you! |
Looks good. I see did see a panic when running this against a non-HA controller, so I'll add a check for that and also a CHANGELOG entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
I picked it just to be consistent with the Hashicorp Vault[1] status code. I thought it might be good to just follow the leading Raft implementation in this case. At glance 503 might be more suitable than 429, but I don't think it could make much of a difference so it's up for debate. [1] https://developer.hashicorp.com/vault/api-docs/system/health#429 |
Ok, I left as 429, that seems like a good enough justification. Thank you :) |
closes(backref) #2582