improve spread docs

This commit is contained in:
Preetha Appan 2019-01-24 14:58:26 -06:00
parent ed7e1bc064
commit 2db052d4ad
No known key found for this signature in database
GPG Key ID: 9F7C19990A50EAFC
3 changed files with 35 additions and 2 deletions

View File

@ -38,6 +38,11 @@ job "docs" {
- `affinity` <code>([Affinity][]: nil)</code> - This can be provided - `affinity` <code>([Affinity][]: nil)</code> - This can be provided
multiple times to define preferred placement criteria. multiple times to define preferred placement criteria.
- `spread` <code>([Spread][spread]: nil)</code> - This can be provided
multiple times to define criteria for spreading allocations across a
node attribute or metadata. See the
[Nomad spread reference](/docs/job-specification/spread.html) for more details.
- `count` `(int: 1)` - Specifies the number of the task groups that should - `count` `(int: 1)` - Specifies the number of the task groups that should
be running under this group. This value must be non-negative. be running under this group. This value must be non-negative.
@ -121,6 +126,7 @@ group "example" {
[task]: /docs/job-specification/task.html "Nomad task Job Specification" [task]: /docs/job-specification/task.html "Nomad task Job Specification"
[job]: /docs/job-specification/job.html "Nomad job Job Specification" [job]: /docs/job-specification/job.html "Nomad job Job Specification"
[constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification" [constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification"
[spread]: /docs/job-specification/spread.html "Nomad spread Job Specification"
[affinity]: /docs/job-specification/affinity.html "Nomad affinity Job Specification" [affinity]: /docs/job-specification/affinity.html "Nomad affinity Job Specification"
[ephemeraldisk]: /docs/job-specification/ephemeral_disk.html "Nomad ephemeral_disk Job Specification" [ephemeraldisk]: /docs/job-specification/ephemeral_disk.html "Nomad ephemeral_disk Job Specification"
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification" [meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"

View File

@ -80,6 +80,10 @@ job "docs" {
[Nomad affinity reference](/docs/job-specification/affinity.html) for more [Nomad affinity reference](/docs/job-specification/affinity.html) for more
details. details.
- `spread` <code>([Spread][spread]: nil)</code> - This can be provided multiple times
to define criteria for spreading allocations across a node attribute or metadata.
See the [Nomad spread reference](/docs/job-specification/spread.html) for more details.
- `datacenters` `(array<string>: <required>)` - A list of datacenters in the region which are eligible - `datacenters` `(array<string>: <required>)` - A list of datacenters in the region which are eligible
for task placement. This must be provided, and does not have a default. for task placement. This must be provided, and does not have a default.
@ -230,6 +234,7 @@ $ VAULT_TOKEN="..." nomad job run example.nomad
[constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification" [constraint]: /docs/job-specification/constraint.html "Nomad constraint Job Specification"
[affinity]: /docs/job-specification/affinity.html "Nomad affinity Job Specification" [affinity]: /docs/job-specification/affinity.html "Nomad affinity Job Specification"
[spread]: /docs/job-specification/spread.html "Nomad spread Job Specification"
[group]: /docs/job-specification/group.html "Nomad group Job Specification" [group]: /docs/job-specification/group.html "Nomad group Job Specification"
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification" [meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
[migrate]: /docs/job-specification/migrate.html "Nomad migrate Job Specification" [migrate]: /docs/job-specification/migrate.html "Nomad migrate Job Specification"

View File

@ -29,6 +29,29 @@ The operator can specify a node attribute such as datacenter, availability zone,
in a physical datacenter to spread the allocations over. By default, when using spread the scheduler will attempt to place allocations equally in a physical datacenter to spread the allocations over. By default, when using spread the scheduler will attempt to place allocations equally
among the available values of the given target. among the available values of the given target.
```hcl
job "docs" {
# Spread allocations over all datacenter
spread {
attribute = "${node.datacenter}"
}
group "example" {
# Spread allocations over each rack based on desired percentage
spread {
attribute = "${node.datacenter}"
target "us-east1" {
percent = 60
}
target "us-west1" {
percent = 40
}
}
}
}
```
Nodes are scored according to how closely they match the desired target percentage defined in the Nodes are scored according to how closely they match the desired target percentage defined in the
spread stanza. Spread scores are combined with other scoring factors such as bin packing. spread stanza. Spread scores are combined with other scoring factors such as bin packing.
@ -38,8 +61,7 @@ Spread criteria are treated as a soft preference by the Nomad scheduler.
If no nodes match a given spread criteria, placement is still successful. If no nodes match a given spread criteria, placement is still successful.
Spread may be expressed on [attributes][interpolation] or [client metadata][client-meta]. Spread may be expressed on [attributes][interpolation] or [client metadata][client-meta].
Additionally, spread may be specified at the [job][job], [group][group], or Additionally, spread may be specified at the [job][job] and [group][group] levels for ultimate flexibility.
[task][task] levels for ultimate flexibility.
## `spread` Parameters ## `spread` Parameters