From 9c6fcdc1d72888514c52d662f980b1718a645cd0 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Mon, 11 Jan 2016 11:12:09 -0800 Subject: [PATCH] Documentation --- website/source/docs/drivers/docker.html.md | 11 +++++++-- website/source/docs/drivers/exec.html.md | 9 +++++++- website/source/docs/drivers/java.html.md | 9 +++++++- website/source/docs/drivers/raw_exec.html.md | 9 +++++++- website/source/docs/drivers/rkt.html.md | 9 +++++++- website/source/docs/jobspec/index.html.md | 24 ++++++++++++++++---- 6 files changed, 61 insertions(+), 10 deletions(-) diff --git a/website/source/docs/drivers/docker.html.md b/website/source/docs/drivers/docker.html.md index cb2304b64..5cf65d79c 100644 --- a/website/source/docs/drivers/docker.html.md +++ b/website/source/docs/drivers/docker.html.md @@ -37,8 +37,15 @@ The following options are available for use in the job specification. * `command` - (Optional) The command to run when starting the container. -* `args` - (Optional) A list of arguments to the optional `command`. If no - `command` is present, `args` are ignored. +* `args` - (Optional) A list of arguments to the optional `command`. If no + `command` is present, `args` are ignored. References to environment variables + or any [intepretable Nomad + variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted + before launching the task. For example: + + ``` + args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + ``` * `labels` - (Optional) A key/value map of labels to set to the containers on start. diff --git a/website/source/docs/drivers/exec.html.md b/website/source/docs/drivers/exec.html.md index 3d921aa6d..ce1413461 100644 --- a/website/source/docs/drivers/exec.html.md +++ b/website/source/docs/drivers/exec.html.md @@ -32,7 +32,14 @@ The `exec` driver supports the following configuration in the job spec: is supplied and does not match the downloaded artifact, the driver will fail to start -* `args` - (Optional) A list of arguments to the `command`. +* `args` - (Optional) A list of arguments to the optional `command`. + References to environment variables or any [intepretable Nomad + variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted + before launching the task. For example: + + ``` + args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + ``` ## Client Requirements diff --git a/website/source/docs/drivers/java.html.md b/website/source/docs/drivers/java.html.md index 45baacb72..57d67a0bf 100644 --- a/website/source/docs/drivers/java.html.md +++ b/website/source/docs/drivers/java.html.md @@ -27,7 +27,14 @@ The `java` driver supports the following configuration in the job spec: is supplied and does not match the downloaded artifact, the driver will fail to start -* `args` - (Optional) A list of arguments to the `java` command. +* `args` - (Optional) A list of arguments to the optional `command`. + References to environment variables or any [intepretable Nomad + variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted + before launching the task. For example: + + ``` + args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + ``` * `jvm_options` - (Optional) A list of JVM options to be passed while invoking java. These options are passed not validated in any way in Nomad. diff --git a/website/source/docs/drivers/raw_exec.html.md b/website/source/docs/drivers/raw_exec.html.md index cfca5e4f0..fc0fb48dc 100644 --- a/website/source/docs/drivers/raw_exec.html.md +++ b/website/source/docs/drivers/raw_exec.html.md @@ -30,7 +30,14 @@ The `raw_exec` driver supports the following configuration in the job spec: is supplied and does not match the downloaded artifact, the driver will fail to start -* `args` - (Optional) A list of arguments to the `command`. +* `args` - (Optional) A list of arguments to the optional `command`. + References to environment variables or any [intepretable Nomad + variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted + before launching the task. For example: + + ``` + args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + ``` ## Client Requirements diff --git a/website/source/docs/drivers/rkt.html.md b/website/source/docs/drivers/rkt.html.md index 5efab860b..6225faf87 100644 --- a/website/source/docs/drivers/rkt.html.md +++ b/website/source/docs/drivers/rkt.html.md @@ -24,7 +24,14 @@ The `rkt` driver supports the following configuration in the job spec: * `command` - (Optional) A command to execute on the ACI. -* `args` - (Optional) A list of arguments to the image. +* `args` - (Optional) A list of arguments to the optional `command`. + References to environment variables or any [intepretable Nomad + variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted + before launching the task. For example: + + ``` + args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + ``` * `trust_prefix` - (Optional) The trust prefix to be passed to rkt. Must be reachable from the box running the nomad agent. If not specified, the image is diff --git a/website/source/docs/jobspec/index.html.md b/website/source/docs/jobspec/index.html.md index 9e3a0c599..0923d3255 100644 --- a/website/source/docs/jobspec/index.html.md +++ b/website/source/docs/jobspec/index.html.md @@ -240,8 +240,20 @@ The `task` object supports the following keys: task transitons to the dead state. [Click here](/docs/jobspec/servicediscovery.html) to learn more about services. -* `env` - A map of key/value representing environment variables that - will be passed along to the running process. +* `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](#interpreted_vars). + + For example the below environment map will be reinterpreted: + + ``` + env { + // The value will be interpreted by the client and set to the + // correct value. + NODE_CLASS = "$nomad.class" + } + ``` * `resources` - Provides the resource requirements of the task. See the resources reference for more details. @@ -336,7 +348,7 @@ restart { The `constraint` object supports the following keys: * `attribute` - Specifies the attribute to examine for the - constraint. See the table of attributes below. + constraint. See the table of attributes [below](#interpreted_vars). * `operator` - Specifies the comparison operator. Defaults to equality, and can be `=`, `==`, `is`, `!=`, `not`, `>`, `>=`, `<`, `<=`. The @@ -368,7 +380,11 @@ The `constraint` object supports the following keys: Tasks within a task group are always co-scheduled. -Below is a table documenting the variables that can be interpreted: +### Interpreted Variables + +Certain Nomad variables are interpretable for use in constraints, task +environment variables and task arguments. Below is a table documenting the +variables that can be interpreted: