-
Notifications
You must be signed in to change notification settings - Fork 31
Support registering multiple health checks. #59
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
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
@@ -312,9 +312,8 @@ pub struct RegisterEntityPayload { | |||
/// Optional service to register. | |||
#[serde(skip_serializing_if = "Option::is_none")] | |||
pub Service: Option<RegisterEntityService>, | |||
/// Optional check to register | |||
#[serde(skip_serializing_if = "Option::is_none")] | |||
pub Check: Option<RegisterEntityCheck>, |
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.
Hey.
In the official API docs, Check
is not marked as deprecated or as legacy.
I think someone reading the docs will naturally use Check
, so it's better to keep it and document that Checks
is preferred instead.
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.
Hi @x0rw, we discussed this.
The official documentation states that
Multiple checks can be provided by replacing Check with Checks and sending an array of Check objects
.
When we examined the server code for consul however, it accepts both as well and appends Check to Checks.
This behavior is confusing/surprising. We're opting to expose just one field instead, which can be empty to represent the original None state.
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.
see documentation here. Code is [here] (https://github.com/hashicorp/consul/blob/1e4639402af0843b1fb3fa4b56c1bdd9eb2773d3/agent/consul/catalog_endpoint.go#L151)
What problem are we solving?
Today, the RegisterEntityPayload offers the legacy registration interface that allowed registering a single
Check
. Consul supports registering multiple health checks starting in 2015 (commit 674be58e55f). For backward compatibility they maintain support for passing a singleCheck
. Here is the relevant excerpt from agent/consul/catalog_endpoint.go:How are we solving the problem?
Let's switch from offering a single 'Check' to running multiple 'Checks'. This breaks backwards compatibility and drops support to consuls servers from 10 years ago.
Checks
Please check these off before promoting the pull request to non-draft status.