Merge pull request #1161 from hashicorp/d-json-corrections

Json clean up + fixed variable names
This commit is contained in:
Alex Dadgar 2016-05-09 17:04:05 -07:00
commit 66620ccc23

View file

@ -241,47 +241,79 @@ The `Job` object supports the following keys:
### Task Group ### Task Group
`TaskGroups` is a list of `Task Group`, and each object supports the following `TaskGroups` is a list of `TaskGroup` objects, each supports the following
attributes: attributes:
* `Constraints` - This is a list of `Constraint` objects. See the constraint
reference for more details.
* `Count` - Specifies the number of the task groups that should * `Count` - Specifies the number of the task groups that should
be running. Must be non-negative, defaults to one. be running. Must be non-negative, defaults to one.
* `Constraints` - This is a list of `Constraint` objects. See the constraint * `Meta` - A key/value map that annotates the task group with opaque metadata.
reference for more details.
* `Name` - The name of the task group. Must be specified.
* `RestartPolicy` - Specifies the restart policy to be applied to tasks in this group. * `RestartPolicy` - Specifies the restart policy to be applied to tasks in this group.
If omitted, a default policy for batch and non-batch jobs is used based on the If omitted, a default policy for batch and non-batch jobs is used based on the
job type. See the restart policy reference for more details. job type. See the restart policy reference for more details.
* `Tasks` - It's a list of `Task` object, allows adding tasks as * `Tasks` - A list of `Task` object that are part of the task group.
part of the group.
* `Meta` - A key/value map that annotates the task group with opaque metadata.
### Task ### Task
The `Task` object supports the following keys: The `Task` object supports the following keys:
* `Driver` - Specifies the task driver that should be used to run the * `Artifacts` - `Artifacts` is a list of `Artifact` objects which define
task. See the [driver documentation](/docs/drivers/index.html) for what artifacts to be downloaded before the task is run. See the artifacts
is available. Examples include `docker`, `qemu`, `java`, and `exec`.
* `User` - Set the user that will run the task. It defaults to the same user
the Nomad client is being run as.
* `Constraints` - This is a list of `Constraint` objects. See the constraint
reference for more details. reference for more details.
* `Config` - A map of key/value configuration passed into the driver * `Config` - A map of key/value configuration passed into the driver
to start the task. The details of configurations are specific to to start the task. The details of configurations are specific to
each driver. each driver.
* `Services` - Nomad integrates with Consul for service discovery. A service * `Constraints` - This is a list of `Constraint` objects. See the constraint
block represents a routable and discoverable service on the network. Nomad reference for more details.
automatically registers when a task is started and de-registers it when the
task transitions to the dead state. [Click * `Driver` - Specifies the task driver that should be used to run the
here](/docs/jobspec/servicediscovery.html) to learn more about services. task. See the [driver documentation](/docs/drivers/index.html) for what
is available. Examples include `docker`, `qemu`, `java`, and `exec`.
* `Env` - A map of key/value representing environment variables that
will be passed along to the running process. Nomad variables are
interpreted when set in the environment variable values. See the table of
interpreted variables [here](/docs/jobspec/interpreted.html).
For example the below environment map will be reinterpreted:
```
"Env": {
"NODE_CLASS" : "${nomad.class}"
}
```
* `KillTimeout` - `KillTimeout` is a time duration in nanoseconds. It can be
used to configure the time between signaling a task it will be killed and
actually killing it. Drivers first sends a task the `SIGINT` signal and then
sends `SIGTERM` if the task doesn't die after the `KillTimeout` duration has
elapsed.
* `LogConfig` - This allows configuring log rotation for the `stdout` and `stderr`
buffers of a Task. See the log rotation reference below for more details.
* `Meta` - Annotates the task group with opaque metadata.
* `Name` - The name of the task. This field is required.
* `Resources` - Provides the resource requirements of the task.
See the resources reference for more details.
* `Services` - `Services` is a list of `Service` objects. Nomad integrates with
Consul for service discovery. A `Service` object represents a routable and
discoverable service on the network. Nomad automatically registers when a task
is started and de-registers it when the task transitions to the dead state.
[Click here](/docs/jobspec/servicediscovery.html) to learn more about
services. Below is the fields in the `Service` object:
* `Name`: Nomad automatically determines the name of a Task. By default the * `Name`: Nomad automatically determines the name of a Task. By default the
name of a service is `$(job-name)-$(task-group)-$(task-name)`. Users can name of a service is `$(job-name)-$(task-group)-$(task-name)`. Users can
@ -296,16 +328,16 @@ The `Task` object supports the following keys:
limited to alphanumeric and hyphen characters (i.e. `[a-z0-9\-]`), and be limited to alphanumeric and hyphen characters (i.e. `[a-z0-9\-]`), and be
less than 64 characters in length. less than 64 characters in length.
* `Tags`: A list of tags associated with this Service. String interpolation * `Tags`: A list of string tags associated with this Service. String
is supported in tags. interpolation is supported in tags.
* `PortLabel`: `PortLabel` is optional and is used to associate the port * `PortLabel`: `PortLabel` is an optional string and is used to associate
with the service. If specified, the port label must match one defined in the port with the service. If specified, the port label must match one
the resources block. This could be a label to either a dynamic or a defined in the resources block. This could be a label to either a
static port. If an incorrect port label is specified, Nomad doesn't dynamic or a static port. If an incorrect port label is specified, Nomad
register the IP:Port with Consul. doesn't register the IP:Port with Consul.
* `Checks`: `Checks` is an array of check objects.A check object defines a * `Checks`: `Checks` is an array of check objects. A check object defines a
health check associated with the service. Nomad supports the `script`, health check associated with the service. Nomad supports the `script`,
`http` and `tcp` Consul Checks. Script checks are not supported for the `http` and `tcp` Consul Checks. Script checks are not supported for the
qemu driver since the Nomad client doesn't have access to the file system qemu driver since the Nomad client doesn't have access to the file system
@ -337,36 +369,8 @@ The `Task` object supports the following keys:
checks. checks.
* `Env` - A map of key/value representing environment variables that * `User` - Set the user that will run the task. It defaults to the same user
will be passed along to the running process. Nomad variables are the Nomad client is being run as.
interpreted when set in the environment variable values. See the table of
interpreted variables [here](/docs/jobspec/interpreted.html).
For example the below environment map will be reinterpreted:
```
"Env": {
"NODE_CLASS" : "${nomad.class}"
}
```
* `Resources` - Provides the resource requirements of the task.
See the resources reference for more details.
* `Meta` - Annotates the task group with opaque metadata.
* `KillTimeout` - `KillTimeout` is a time duration in nanoseconds. It can be
used to configure the time between signaling a task it will be killed and
actually killing it. Drivers first sends a task the `SIGINT` signal and then
sends `SIGTERM` if the task doesn't die after the `KillTimeout` duration has
elapsed.
* `LogConfig` - This allows configuring log rotation for the `stdout` and `stderr`
buffers of a Task. See the log rotation reference below for more details.
* `Artifacts` - `Artifacts` is a list of `Artifact` objects which define
artifacts to be downloaded before the task is run. See the artifacts
reference for more details.
### Resources ### Resources
@ -386,9 +390,9 @@ The Network object supports the following keys:
* `MBits` - The number of MBits in bandwidth required. * `MBits` - The number of MBits in bandwidth required.
Nomad can allocate two types of ports to a task - Dynamic and Static ports. A Nomad can allocate two types of ports to a task - Dynamic and Static/Reserved
network object allows the user to specify a list of `DynamicPorts` and ports. A network object allows the user to specify a list of `DynamicPorts` and
`StaticPorts`. Each object supports the following attributes: `ReservedPorts`. Each object supports the following attributes:
* `Value` - The port number for static ports. If the port is dynamic, then this * `Value` - The port number for static ports. If the port is dynamic, then this
attribute is ignored. attribute is ignored.
@ -455,7 +459,7 @@ The `LogConfig` object configures the log rotation policy for a task's `stdout`
* `MaxFiles` - The maximum number of rotated files Nomad will retain for * `MaxFiles` - The maximum number of rotated files Nomad will retain for
`stdout` and `stderr`, each tracked individually. `stdout` and `stderr`, each tracked individually.
* `MaxFileSize` - The size of each rotated file. The size is specified in * `MaxFileSizeMB` - The size of each rotated file. The size is specified in
`MB`. `MB`.
If the amount of disk resource requested for the task is less than the total If the amount of disk resource requested for the task is less than the total
@ -513,13 +517,15 @@ The `Artifact` object supports the following keys:
An example of downloading and unzipping an archive is as simple as: An example of downloading and unzipping an archive is as simple as:
``` ```
"Artifacts": { "Artifacts": [
# The archive will be extracted before the task is run, making {
# it easy to ship configurations with your binary. # The archive will be extracted before the task is run, making
"GetterSource": "https://example.com/my.zip", # it easy to ship configurations with your binary.
"GetterSource": "https://example.com/my.zip",
"GetterOptions": { "GetterOptions": {
"checksum": "md5:7f4b3e3b4dd5150d4e5aaaa5efada4c3" "checksum": "md5:7f4b3e3b4dd5150d4e5aaaa5efada4c3"
}
} }
} ]
``` ```