hashicorp / hashicorp/nomad

Feature Request: Make alloc base dir on node available for interpolation

Open
#7,657 4 comments 0 reactions 0 assignees View on GitHub
theme/client theme/hcl type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

# Problem Description

If you know that nomad's data dir is set to `/opt/nomad/data` then you can craft a job like this

```
template {
destination = "local/seccomp.json"
perms = "644"
data = "..."
}
...
config {
....
security_opt = ["seccomp=/opt/nomad/data/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}/local/seccomp.json"]

```
However if you do not know that all the nodes will use the same path, then this becomes infeasible.

This is especially a problem in cases like this, your task description needs the path on the real host disk of artifacts and cannot use the one inside the container. In this example, I want to pass a path to the docker driver to use for seccomp, and the driver needs to know the path before it creates the task - which means it needs the host disk location.

A workaround would be to put the seccomp on the host manually without nomad, or in a batch job, but this is an unnecessary limitation and difficult to coordinate.

# Suggestion
A simple suggestion would be to add a node attribute to be used in interpolation, so that you could craft paths like the following
`${node.allocdir}/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}/${NOMAD_TASK_DIR}/seccomp.json`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.