Skip to content

Commit 3fdcda6

Browse files
committed
PR feedback
1 parent cda7f39 commit 3fdcda6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

.changelog/25598.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
```release-note:improvement
2-
task environment: add NOMAD_UNIX_ADDR env var when using workload identity
2+
task environment: new NOMAD_UNIX_ADDR env var points to the task API unix socket, for use with workload identity
33
```

client/taskenv/env.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const (
9999
HostAddrPrefix = "NOMAD_HOST_ADDR_"
100100

101101
// UnixAddr is the task api unix socket, in the appropriate format
102-
// for use in a NOMAD_ADDR (i.e. prefixed with "unix:")
102+
// for use in a NOMAD_ADDR (i.e. prefixed with "unix://")
103103
UnixAddr = "NOMAD_UNIX_ADDR"
104104

105105
// IpPrefix is the prefix for passing the host IP of a port allocation
@@ -624,12 +624,12 @@ func (b *Builder) buildEnv(allocDir, localDir, secretsDir string,
624624
// Build the Nomad Workload Token
625625
if b.workloadTokenDefault != "" {
626626
envMap[WorkloadToken] = b.workloadTokenDefault
627-
envMap[UnixAddr] = "unix:" + filepath.Join(secretsDir, "api.sock")
627+
envMap[UnixAddr] = "unix://" + filepath.Join(secretsDir, "api.sock")
628628
}
629629

630630
for name, token := range b.workloadTokens {
631631
envMap[WorkloadToken+"_"+name] = token
632-
envMap[UnixAddr] = "unix:" + filepath.Join(secretsDir, "api.sock")
632+
envMap[UnixAddr] = "unix://" + filepath.Join(secretsDir, "api.sock")
633633
}
634634

635635
// Copy and interpolate task meta

website/content/docs/commands/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ may override these environment variables with individual flags.
6666

6767
- `NOMAD_ADDR` - The address of the Nomad server. Defaults to
6868
`http://127.0.0.1:4646`. For unix sockets, as with the [task API][],
69-
the format is `unix:/path/to/api.sock`.
69+
the format is either `unix:/path/to/api.sock` or `unix:///path/to/api.sock`.
7070

7171
- `NOMAD_REGION` - The region of the Nomad server to forward commands to.
7272
Defaults to the Agent's local region

website/content/partials/envvars.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
| `NOMAD_PARENT_CGROUP` | The parent cgroup used to contain task cgroups (Linux only) |
2323
| `NOMAD_NAMESPACE` | Namespace in which the allocation is running |
2424
| `NOMAD_REGION` | Region in which the allocation is running |
25-
| `NOMAD_UNIX_ADDR` | Use this value as your `NOMAD_ADDR` to use `nomad` CLI with the [task API][]'s unix socket. The value is equivalent to `"unix:${NOMAD_SECRETS_DIR}/api.sock"`
25+
| `NOMAD_UNIX_ADDR` | Use this value as your `NOMAD_ADDR` to use `nomad` CLI with the [task API][]'s unix socket. The value is equivalent to `"unix://${NOMAD_SECRETS_DIR}/api.sock"`
2626
| `NOMAD_META_<key>` | The metadata value given by `key` on the task's metadata. Any character in a key other than `[A-Za-z0-9_.]` will be converted to `_`. <br/> **Note:** this is different from [`${meta.<key>}`](/nomad/docs/runtime/interpolation#node-variables-) which are keys in the node's metadata. |
2727
| `CONSUL_HTTP_TOKEN` | The tasks' Consul token. See [Consul Integration][consul] documentation for more details. |
2828
| `CONSUL_TOKEN` | The tasks' Consul token. See [Consul Integration][consul] documentation for more details. This variable is deprecated and exists only for backwards compatibility. |

0 commit comments

Comments
 (0)