Skip to content

Commit

Permalink
updated consul nr docs to reflect latest changes
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulaziz Elsheikh <[email protected]>
  • Loading branch information
a-elsheikh authored Oct 16, 2023
1 parent 3a2f85e commit 8cb6774
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ spec:
selfRegister: true
```
If Consul service registration is managed externally from Dapr you need to ensure that the Dapr-to-Dapr internal gRPC port is added to the service metadata under `DAPR_PORT` (this key is configurable) and that the Consul service Id matches the Dapr app Id. You can then omit `selfRegister` from the config above.
If Consul service registration is managed externally from Dapr you need to ensure that the Dapr-to-Dapr internal gRPC port is added to the service metadata under `DAPR_PORT` (this key is configurable) and that the Consul service name matches the Dapr app Id. You can then omit `selfRegister` from the config above.

## Behaviour

On `init` the Consul component either validates the connection to the configured (or default) agent or registers the service if configured to do so. The name resolution interface does not cater for an "on shutdown" pattern so consider this when using Dapr to register services to Consul as it does not deregister services.
On startup the Consul component either validates the connection to the configured (or default) agent or registers the service if configured to do so. Similarly, on shutdown the component will deregister the service if configured to do so.

The component resolves target apps by filtering healthy services and looks for a `DAPR_PORT` in the metadata (key is configurable) in order to retrieve the Dapr sidecar port. Consul `service.meta` is used over `service.port` so as to not interfere with existing Consul estates.

Expand All @@ -46,8 +46,10 @@ The configuration spec is fixed to v1.3.0 of the Consul API
| Tags | N | `[]string` | Configures any tags to include if/when registering services | `- "dapr"`
| Meta | N | `map[string]string` | Configures any additional metadata to include if/when registering services | `DAPR_METRICS_PORT: "${DAPR_METRICS_PORT}"`
| DaprPortMetaKey | N | `string` | The key used for getting the Dapr sidecar port from Consul service metadata during service resolution, it will also be used to set the Dapr sidecar port in metadata during registration. If blank it will default to `DAPR_PORT` | `"DAPR_TO_DAPR_PORT"`
| SelfRegister | N | `bool` | Controls if Dapr will register the service to Consul. The name resolution interface does not cater for an "on shutdown" pattern so please consider this if using Dapr to register services to Consul as it will not deregister services. If blank it will default to `false` | `true`
| SelfRegister | N | `bool` | Controls if Dapr will register the service to consul on startup. If unset it will default to `false` | `true`
| SelfDeregister | N | `bool` | Controls if Dapr will deregister the service from consul on shutdown. If unset it will default to `false` | `true`
| AdvancedRegistration | N | [*api.AgentServiceRegistration](https://pkg.go.dev/github.com/hashicorp/consul/[email protected]#AgentServiceRegistration) | Gives full control of service registration through configuration. If configured the component will ignore any configuration of Checks, Tags, Meta and SelfRegister. | See [sample configs](#sample-configurations)
| UseCache | N | `bool` | Configures if Dapr will cache the resolved services in-memory. This is done using consul [blocking queries](https://www.consul.io/api-docs/features/blocking) which can be configured via the QueryOptions configuration. If unset it will default to `false` | `true`

## Sample configurations

Expand Down

0 comments on commit 8cb6774

Please sign in to comment.