Merge pull request #6279 from hashicorp/f-connect-docs

Initial placeholder connect docs
This commit is contained in:
Michael Schurter
2019-09-05 12:29:44 -07:00
committed by GitHub
8 changed files with 503 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
---
layout: "docs"
page_title: "connect Stanza - Job Specification"
sidebar_current: "docs-job-specification-connect"
description: |-
The "connect" stanza allows specifying options for Consul Connect integration
---
# `connect` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> service -> **connect**</code>
</td>
</tr>
</table>
The `connect` stanza allows configuring various options for
[Consul Connect](/guides/integrations/consul-connect/index.html). It is
valid only within the context of a service definition at the task group
level.
```hcl
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
task "web" {
driver = "docker"
config {
image = "test/test:v1"
}
}
}
}
```
## `connect` Parameters
- `native` `(bool: false)` native should be set to true if a service implements Connect directly
and does not need a sidecar. This is not common.
- `sidecar_service` - <code>([sidecar_service][]: nil)</code> - This is used to configure the sidecar
service injected by Nomad for Consul Connect.
- `sidecar_task` - <code>([sidecar_task][]:nil)</code> - This modifies the configuration of the Envoy
proxy task.
## `connect` Examples
The following example is a minimal connect stanza with defaults
```hcl
connect {
sidecar_service {}
}
```
The following example includes specifying upstreams.
```hcl
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
}
}
}
```
### Interpolation
TODO do we need this
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"
[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification"
[sidecar_task]: /docs/job-specification/sidecar_task.html "Nomad sidecar task config Specification"

View File

@@ -129,5 +129,20 @@ job "docs" {
}
```
Note that starting with Nomad 0.10, the `service` stanza can also be specified at the group level. This
allows job specification authors to create and register services with Consul Connect support. A service
stanza specified at the group level must include a [connect][] stanza, like the following snippet.
```hcl
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
```
[hcl]: https://github.com/hashicorp/hcl "HashiCorp Configuration Language"
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[connect]: /docs/job-specification/connect.html "Connect Stanza Specification"

View File

@@ -0,0 +1,80 @@
---
layout: "docs"
page_title: "proxy Stanza - Job Specification"
sidebar_current: "docs-job-specification-proxy"
description: |-
The "proxy" stanza allows specifying options for configuring
sidecar proxies used in Consul Connect integration
---
# `proxy` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> service -> connect -> sidecar_service -> **proxy** </code>
</td>
</tr>
</table>
The `proxy` stanza allows configuring various options for
the sidecar proxy managed by Nomad for Consul Connect integration.
It is valid only within the context of a `sidecar_service` stanza.
```hcl
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
task "web" {
driver = "docker"
config {
image = "test/test:v1"
}
}
}
}
```
## `proxy` Parameters
- `upstreams` <code>([upstreams][]: nil)</code> Used to configure details of each upstream service that
this sidecar proxy communicates with.
- `config` - (map: nil)</code> - Proxy configuration that's opaque to Nomad and passed directly to Consul.
## `proxy` Examples
The following example is a proxy specification that includes upstreams configuration.
```hcl
sidecar_service {
proxy {
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
}
}
```
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"
[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification"
[upstreams]: /docs/job-specification/upstreams.html "Nomad upstream config Specification"

View File

@@ -0,0 +1,88 @@
---
layout: "docs"
page_title: "sidecar_service Stanza - Job Specification"
sidebar_current: "docs-job-specification-sidecar-service"
description: |-
The "sidecar_service" stanza allows specifying options for configuring
sidecar proxies used in Consul Connect integration
---
# `sidecar_service` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> service -> connect -> **sidecar_service** </code>
</td>
</tr>
</table>
The `sidecar_service` stanza allows configuring various options for
the sidecar proxy managed by Nomad for Consul Connect integration.
It is valid only within the context of a connect stanza.
```hcl
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
task "web" {
driver = "docker"
config {
image = "test/test:v1"
}
}
}
}
```
## `sidecar_service` Parameters
- `port` `(string: )` Port label for sidecar service.
- `proxy` - <code>([proxy][]: nil)</code> - This is used to configure the sidecar proxy service.
## `sidecar_service` Examples
The following example is a minimal `sidecar_service` stanza with defaults
```hcl
connect {
sidecar_service {}
}
```
The following example includes specifying upstreams.
```hcl
sidecar_service {
proxy {
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
}
}
```
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"
[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification"
[proxy]: /docs/job-specification/proxy.html "Nomad sidecar proxy config Specification"

View File

@@ -0,0 +1,110 @@
---
layout: "docs"
page_title: "sidecar_service Stanza - Job Specification"
sidebar_current: "docs-job-specification-sidecar-task"
description: |-
The "sidecar_task" stanza allows specifying options for configuring
the task of the sidecar proxies used in Consul Connect integration
---
# `sidecar_task` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> service -> connect -> **sidecar_task** </code>
</td>
</tr>
</table>
The `sidecar_task` stanza allows configuring various options for
the sidecar proxy managed by Nomad for Consul Connect integration.
It is valid only within the context of a connect stanza.
```hcl
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
sidecar_task {
resources {
cpu = 500
memory = 1024
}
}
}
}
task "web" {
driver = "docker"
config {
image = "test/test:v1"
}
}
}
}
```
## `sidecar_task` Parameters
- `name` `(string: )` - Name of the task.
- `driver` `(string: )` - Driver used for the sidecar task.
- `user` `(string:nil)` - Determines which user is used to run the task, defaults
to the same user the Nomad client is being run as.
- `config` `(map:nil )` - Configuration provided to the driver for initialization.
- `env` `(map:nil )` - Map of environment variables used by the driver.
- `resources` <code>[resources][]</code> - Resources needed by this task.
- `meta` `(map:nil )` - Arbitary metadata associated with this task that's opaque to Nomad.
- `logs` <code>([Logs][]: nil)</code> - Specifies logging configuration for the
`stdout` and `stderr` of the task.
- `kill_timeout` `(int:)` - Time between signalling a task that will be killed and killing it.
- `shutdown_delay` `(int:)` - Delay between deregistering the task from Consul and sendint it a
signal to shutdown.
- `kill_signal` `(string:SIGINT)` - Kill signal to use for the task, defaults to SIGINT.
## `sidecar_task` Examples
The following example configures resources for the sidecar task and other configuration.
```hcl
sidecar_task {
resources {
cpu = 500
memory = 1024
}
env {
FOO = "abc"
}
shutdown_delay = "5s"
}
```
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"
[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification"
[resources]: /docs/job-specification/resources.html "Nomad resources Job Specification"
[logs]: /docs/job-specification/logs.html "Nomad logs Job Specification"

View File

@@ -108,6 +108,9 @@ job "docs" {
required by the task. This overrides any `vault` block set at the `group` or
`job` level.
- `kind` `(string: <varies>)` - Used internally to manage tasks according to
the value of this field. Initial use case is for Consul Connect.
## `task` Examples
The following examples only show the `task` stanzas. Remember that the

View File

@@ -0,0 +1,95 @@
---
layout: "docs"
page_title: "upstreams Stanza - Job Specification"
sidebar_current: "docs-job-specification-upstreams"
description: |-
The "upstreams" stanza allows specifying options for configuring
upstream services
---
# `upstreams` Stanza
<table class="table table-bordered table-striped">
<tr>
<th width="120">Placement</th>
<td>
<code>job -> group -> service -> connect -> sidecar_service -> proxy -> **upstreams** </code>
</td>
</tr>
</table>
The `upstreams` stanza allows configuring various options for
managing upstream services that the proxy routes to.
It is valid only within the context of a `proxy` stanza.
```hcl
job "countdash" {
datacenters = ["dc1"]
group "dashboard" {
network {
mode = "bridge"
port "http" {
static = 9002
to = 9002
}
}
service {
name = "count-dashboard"
port = "9002"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
}
}
}
}
task "dashboard" {
driver = "docker"
env {
COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
}
config {
image = "hashicorpnomad/counter-dashboard:v1"
}
}
}
}
```
## `upstreams` Parameters
- `destination_name` `(string: nil)` - Name of the upstream service.
- `local_bind_port` - (int: nil)</code> - The port the proxy will receive
connections for the upstream on.
## `upstreams` Examples
The following example is an upstream config with the name of the destination service
and a local bind port.
```hcl
upstreams {
destination_name = "count-api"
local_bind_port = 8080
}
```
[job]: /docs/job-specification/job.html "Nomad job Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification"
[task]: /docs/job-specification/task.html "Nomad task Job Specification"
[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation"
[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification"
[upstreams]: /docs/job-specification/upstreams.html "Nomad upstream config Specification"

View File

@@ -371,6 +371,9 @@
<li<%= sidebar_current("docs-job-specification-check_restart")%>>
<a href="/docs/job-specification/check_restart.html">check_restart</a>
</li>
<li<%= sidebar_current("docs-job-specification-connect")%>>
<a href="/docs/job-specification/connect.html">connect</a>
<li>
<li<%= sidebar_current("docs-job-specification-constraint")%>>
<a href="/docs/job-specification/constraint.html">constraint</a>
</li>
@@ -410,6 +413,9 @@
<li<%= sidebar_current("docs-job-specification-periodic")%>>
<a href="/docs/job-specification/periodic.html">periodic</a>
</li>
<li<%= sidebar_current("docs-job-specification-proxy")%>>
<a href="/docs/job-specification/proxy.html">proxy</a>
<li>
<li<%= sidebar_current("docs-job-specification-reschedule")%>>
<a href="/docs/job-specification/reschedule.html">reschedule</a>
</li>
@@ -422,6 +428,12 @@
<li<%= sidebar_current("docs-job-specification-service")%>>
<a href="/docs/job-specification/service.html">service</a>
</li>
<li<%= sidebar_current("docs-job-specification-sidecar-service")%>>
<a href="/docs/job-specification/sidecar_service.html">sidecar_service</a>
</li>
<li<%= sidebar_current("docs-job-specification-sidecar-task")%>>
<a href="/docs/job-specification/sidecar_task.html">sidecar_task</a>
</li>
<li<%= sidebar_current("docs-job-specification-spread")%>>
<a href="/docs/job-specification/spread.html">spread</a>
</li>
@@ -434,6 +446,9 @@
<li<%= sidebar_current("docs-job-specification-update")%>>
<a href="/docs/job-specification/update.html">update</a>
</li>
<li<%= sidebar_current("docs-job-specification-upstreams")%>>
<a href="/docs/job-specification/update.html">upstreams</a>
</li>
<li<%= sidebar_current("docs-job-specification-vault")%>>
<a href="/docs/job-specification/vault.html">vault</a>
</li>