From b1b9ca70b5149c2e9ca5eb437275231f774f6d7d Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 11 Aug 2021 16:48:43 -0400 Subject: [PATCH] contrib: add list of check register flows --- contributing/service-discovery/README.md | 4 +-- .../service-discovery/health-checks.md | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 contributing/service-discovery/health-checks.md diff --git a/contributing/service-discovery/README.md b/contributing/service-discovery/README.md index 6e9483491..4787ce3ea 100644 --- a/contributing/service-discovery/README.md +++ b/contributing/service-discovery/README.md @@ -2,6 +2,6 @@ This section is still a work in progress. -1. [catalog](./catalog.md) +1. [Catalog](./catalog.md) 1. [DNS Interface](./dns.md) -1. health checking +1. [Health Checks](./health-checks.md) diff --git a/contributing/service-discovery/health-checks.md b/contributing/service-discovery/health-checks.md new file mode 100644 index 000000000..88aa99dcb --- /dev/null +++ b/contributing/service-discovery/health-checks.md @@ -0,0 +1,32 @@ +# Health Checks + +This section is still a work in progress. + + +## Check Registration flows + +There are many paths to register a check. Many of these use different struct +types, so to properly validate and convert a check, all of these paths must +be reviewed and tested. + +1. API [/v1/catalog/register](https://www.consul.io/api-docs/catalog#register-entity) - the `Checks` + field on `structs.RegisterRequest`. The entrypoint is `CatalogRegister` in + [agent/catalog_endpoint.go]. +2. API [/v1/agent/check/register](https://www.consul.io/api-docs/agent/check#register-check) - the entrypoint + is `AgentRegisterCheck` in [agent/agent_endpoint.go] +3. API [/v1/agent/service/register](https://www.consul.io/api-docs/agent/service#register-service) - + the `Check` or `Checks` fields on `ServiceDefinition`. The entrypoint is `AgentRegisterService` + in [agent/agent_endpoint.go]. +4. Config [Checks](https://www.consul.io/docs/discovery/checks) - the `Checks` and `Check` fields + on `config.Config` in [agent/config/config.go]. +5. Config [Service.Checks](https://www.consul.io/docs/discovery/services) - the + `Checks` and `Check` fields on `ServiceDefinition` in [agent/config/config.go]. +6. CLI [consul services register](https://www.consul.io/commands/services/register) - the + `Checks` and `Check` fields on `api.AgentServiceRegistration`. The entrypoint is + `ServicesFromFiles` in [command/services/config.go]. + + +[agent/catalog_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/catalog_endpoint.go +[agent/agent_endpoint.go]: https://github.com/hashicorp/consul/blob/main/agent/agent_endpoint.go +[agent/config/config.go]: https://github.com/hashicorp/consul/blob/main/agent/config/config.go +[command/services/config.go]: https://github.com/hashicorp/consul/blob/main/command/services/config.go