Distinct Property supports arbitrary limit

This PR enhances the distinct_property constraint such that a limit can
be specified in the RTarget/value parameter. This allows constraints
such as:

```
constraint {
  distinct_property = "${meta.rack}"
  value = "2"
}
```

This restricts any given rack from running more than 2 allocations from
the task group.

Fixes https://github.com/hashicorp/nomad/issues/1146
This commit is contained in:
Alex Dadgar
2017-07-31 16:44:17 -07:00
parent abdb7c3297
commit 4e71ba2e71
8 changed files with 506 additions and 66 deletions

View File

@@ -537,7 +537,9 @@ The `Constraint` object supports the following keys:
omitted.
- `distinct_property` - If set, the scheduler selects nodes that have a
distinct value of the specified property for each allocation. This can
distinct value of the specified property. The `RTarget` specifies how
many allocations are allowed to share the value of a property. The
`RTarget` must be 1 or greater and if omitted, defaults to 1. This can
be specified as a job constraint which applies the constraint to all
task groups in the job, or as a task group constraint which scopes the
effect to just that group. The constraint may not be specified at the