improve spread docs
This commit is contained in:
parent
ed7e1bc064
commit
2db052d4ad
|
@ -38,6 +38,11 @@ job "docs" {
|
|||
- `affinity` <code>([Affinity][]: nil)</code> - This can be provided
|
||||
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
|
||||
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"
|
||||
[job]: /docs/job-specification/job.html "Nomad job 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"
|
||||
[ephemeraldisk]: /docs/job-specification/ephemeral_disk.html "Nomad ephemeral_disk Job Specification"
|
||||
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
|
||||
|
|
|
@ -80,6 +80,10 @@ job "docs" {
|
|||
[Nomad affinity reference](/docs/job-specification/affinity.html) for more
|
||||
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
|
||||
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"
|
||||
[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"
|
||||
[meta]: /docs/job-specification/meta.html "Nomad meta Job Specification"
|
||||
[migrate]: /docs/job-specification/migrate.html "Nomad migrate Job Specification"
|
||||
|
|
|
@ -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
|
||||
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
|
||||
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.
|
||||
|
||||
Spread may be expressed on [attributes][interpolation] or [client metadata][client-meta].
|
||||
Additionally, spread may be specified at the [job][job], [group][group], or
|
||||
[task][task] levels for ultimate flexibility.
|
||||
Additionally, spread may be specified at the [job][job] and [group][group] levels for ultimate flexibility.
|
||||
|
||||
|
||||
## `spread` Parameters
|
||||
|
|
Loading…
Reference in a new issue