mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Add IP and PORT environment variables
This commit is contained in:
@@ -53,15 +53,23 @@ environment variables.
|
||||
<td>The task's name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NOMAD_ADDR_\<label\></td>
|
||||
<td>NOMAD_IP_"label"</td>
|
||||
<td>The IP of the the port with the given label</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NOMAD_PORT_"label"</td>
|
||||
<td>The port value with the given label</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NOMAD_ADDR_"label"</td>
|
||||
<td>The IP:Port pair of the the port with the given label</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NOMAD_HOST_PORT_\<label\></td>
|
||||
<td>NOMAD_HOST_PORT_"label"</td>
|
||||
<td>The host port for the given label if the port is port mapped</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NOMAD_META_\<key\></td>
|
||||
<td>NOMAD_META_"key"</td>
|
||||
<td>The metadata of the task</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -128,7 +136,7 @@ directories can be read through the following environment variables:
|
||||
The job specification also allows you to specify a `meta` block to supply arbitrary
|
||||
configuration to a task. This allows you to easily provide job-specific
|
||||
configuration even if you use the same executable unit in multiple jobs. These
|
||||
key-value pairs are passed through to the job as `NOMAD_META_{KEY}={value}`,
|
||||
key-value pairs are passed through to the job as `NOMAD_META_"key"={value}`,
|
||||
where `key` is UPPERCASED from the job specification.
|
||||
|
||||
Currently there is no enforcement that the meta values be lowercase, but using
|
||||
|
||||
@@ -88,12 +88,12 @@ driver.
|
||||
<td>linux-64bit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${attr.\<key\>}</td>
|
||||
<td>${attr."key"}</td>
|
||||
<td>The attribute given by `key` on the client node.</td>
|
||||
<td>platform.aws.instance-type:r3.large</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${meta.\<key\>}</td>
|
||||
<td>${meta."key"}</td>
|
||||
<td>The metadata value given by `key` on the client node.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@@ -119,7 +119,7 @@ Below is a table documenting common node attributes:
|
||||
<td>Number of CPU cores on the client</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>driver.\<key\></td>
|
||||
<td>driver."key"</td>
|
||||
<td>See the [task drivers](/docs/drivers/index.html) for attribute documentation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -200,7 +200,17 @@ a particular node and as such can not be used in constraints.
|
||||
<td>The task's name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${NOMAD_ADDR_"label"}></td>
|
||||
<td>${NOMAD_IP_"label"}</td>
|
||||
<td>The IP for the given port `label`. See
|
||||
[here](/docs/jobspec/networking.html) for more information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${NOMAD_PORT_"label"}</td>
|
||||
<td>The port for the port `label`. See [here](/docs/jobspec/networking.html)
|
||||
for more information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${NOMAD_ADDR_"label"}</td>
|
||||
<td>The `ip:port` pair for the given port `label`. See
|
||||
[here](/docs/jobspec/networking.html) for more information.</td>
|
||||
</tr>
|
||||
|
||||
@@ -79,12 +79,13 @@ port `http`:
|
||||
port "http" {}
|
||||
```
|
||||
|
||||
When the task is started, it is passed an environment variable named
|
||||
`NOMAD_ADDR_http` which indicates a combination of the interface IP and port.
|
||||
When the task is started, it is passed the following environment variables:
|
||||
|
||||
```
|
||||
NOMAD_ADDR_http=127.0.0.1:53423 ./start-command
|
||||
```
|
||||
* `NOMAD_IP_http` - The IP to bind on for the given port label.
|
||||
|
||||
* `NOMAD_PORT_http` - The port value for the given port label.
|
||||
|
||||
* `NOMAD_ADDR_http` - A combined `IP:Port` that can be used for convenience.
|
||||
|
||||
### Mapped Ports <a id="mapped_ports"></a>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user