-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add documentation for proxy.expose configuration
This changeset adds documentation changes for `proxy.expose` and the `proxy.expose.path` stanzas in the jobspec. The examples are centered around proposed changes for the "countdash" `dashboard-service` in [demo-consul-101](github.com/hashicorp/demo-consul-101/pull/6). The dashboard service will now serve two additonal endpoints - `/health/api` - `/metrics` which should serve nicely as expose-able paths.
- Loading branch information
Showing
4 changed files
with
235 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
layout: docs | ||
page_title: expose Stanza - Job Specification | ||
sidebar_title: expose | ||
description: |- | ||
The "expose" stanza allows specifying options for configuring Envoy expose | ||
paths used in Consul Connect integration | ||
--- | ||
|
||
# `expose` Stanza | ||
|
||
<Placement | ||
groups={['job', 'group', 'service', 'connect', 'sidecar_service', 'proxy', 'expose']} | ||
/> | ||
|
||
The `expose` stanza allows configuring options for the default Envoy sidecar | ||
proxy managed by Nomad for [Consul Connect](/guides/integrations/consul-connect). | ||
It is valid only within the context of a `proxy` stanza. Detailed information about | ||
Expose Path configurations for Envoy can be found in Consul's | ||
[Expose Paths Configuration Reference](https://www.consul.io/docs/connect/registration/service-registration.html#expose-paths-configuration-reference) | ||
|
||
```hcl | ||
job "expose-example" { | ||
datacenters = ["dc1"] | ||
group "dashboard" { | ||
network { | ||
mode = "bridge" | ||
port "expose" { | ||
to = -1 | ||
} | ||
} | ||
service { | ||
name = "count-dashboard" | ||
port = "9001" | ||
connect { | ||
sidecar_service { | ||
proxy { | ||
expose { | ||
checks = true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## `expose` Parameters | ||
|
||
- `checks` `(bool: false)` - Automatically generate expose path configuration for | ||
HTTP and gRPC type checks defined for the service. Other types of checks are | ||
not supported by the expose stanza. | ||
- `path` <code>([Path]: nil)</code> - A list of [Envoy Expose Path Configurations](/docs/job-specification/path) | ||
to expose through Envoy. | ||
|
||
## `expose` Examples | ||
|
||
The following example is an expose configuration that is configured to automatically | ||
expose compatible service checks, as well as a custom path for a `/metrics` endpoint. | ||
|
||
```hcl | ||
service { | ||
name = "count-dashboard" | ||
port = "9001" | ||
connect { | ||
sidecar_service { | ||
proxy { | ||
expose { | ||
checks = true | ||
path { | ||
path = "/metrics" | ||
protocol = "http" | ||
local_path_port = 9001 | ||
listener_port = "expose" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
check { | ||
address_mode = "driver" | ||
name = "api-expose-check" | ||
tls_skip_verify = true | ||
type = "http" | ||
port = "expose" | ||
interval = "3s" | ||
timeout = "2s" | ||
method = "GET" | ||
path = "/health/api" | ||
} | ||
} | ||
``` | ||
|
||
[path]: /docs/job-specification/path 'Nomad expose path Specification' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
layout: docs | ||
page_title: path Stanza - Job Specification | ||
sidebar_title: path | ||
description: |- | ||
The "path" stanza allows specifying a custom Envoy expose path configuration | ||
when using the default Envoy proxy in the Consul Connect integration | ||
--- | ||
|
||
# `path` Stanza | ||
|
||
<Placement | ||
groups={['job', 'group', 'service', 'connect', 'sidecar_service', 'proxy', 'expose', 'path']} | ||
/> | ||
|
||
The `path` stanza allows specifying a custom Envoy expose path configuration when | ||
using the default Envoy sidecar proxy managed by Nomad for [Consul Connect](/guides/integrations/consul-connect). | ||
It is valid only within the context of an `expose` stanza. Detailed information | ||
about Expose Path configurations for Envoy can be found in Consul's | ||
[Expose Paths Configuration Reference](https://www.consul.io/docs/connect/registration/service-registration.html#expose-paths-configuration-reference) | ||
|
||
```hcl | ||
job "expose-path-example" { | ||
datacenters = ["dc1"] | ||
group "dashboard" { | ||
network { | ||
mode = "bridge" | ||
port "expose" { | ||
to = -1 | ||
} | ||
} | ||
service { | ||
name = "count-dashboard" | ||
port = "9001" | ||
connect { | ||
sidecar_service { | ||
proxy { | ||
expose { | ||
path { | ||
path = "/health/api" | ||
protocol = "http" | ||
local_path_port = 9001 | ||
listener_port = "expose" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### `path` Parameters | ||
|
||
- `path` `(string: required)` - The HTTP path to expose. The path must be prefixed | ||
with a slash (e.g. `/health`). | ||
- `protocol` `(string: required)` - Sets the protocol of the listener. Must be | ||
`http` or `http2`. For gRPC use `http2`. | ||
- `local_path_port` `(int: required)` - The port the service is listening to for connections to | ||
the configured `path`. Typically this will be the same as the `service.port` value. | ||
- `listener_port` <code>([Port]: required)</code> - The name of the port to use for the exposed listener. The | ||
port should be configured to map inside the task's network namespace. | ||
|
||
## `path` Examples | ||
|
||
The following example is an expose configuration that manually exposes three | ||
endpoints of the Connect enabled service. | ||
|
||
```hcl | ||
proxy { | ||
expose { | ||
path { | ||
path = "/health/api" | ||
protocol = "http" | ||
local_path_port = 9001 | ||
listener_port = "expose" | ||
} | ||
path { | ||
path = "/metrics" | ||
protocol = "http" | ||
local_path_port = 9001 | ||
listener_port = "expose" | ||
} | ||
path { | ||
path = "/v2/health" | ||
protocol = "http2" | ||
local_path_port = 9002 | ||
listener_port = "expose" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
[port]: /docs/job-specification/network#port-parameters 'Nomad Port Parameters' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters