2020-03-16 12:53:04 +00:00
|
|
|
# a job that mounts an EFS volume and writes its job ID as a file
|
|
|
|
job "use-efs-volume" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
|
2020-04-06 15:57:59 +00:00
|
|
|
constraint {
|
|
|
|
attribute = "${attr.kernel.name}"
|
|
|
|
value = "linux"
|
|
|
|
}
|
|
|
|
|
2020-03-16 12:53:04 +00:00
|
|
|
group "group" {
|
|
|
|
volume "test" {
|
|
|
|
type = "csi"
|
|
|
|
source = "efs-vol0"
|
|
|
|
}
|
|
|
|
|
|
|
|
task "task" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "busybox:1"
|
|
|
|
command = "/bin/sh"
|
2020-11-13 14:31:21 +00:00
|
|
|
args = ["-c", "echo 'ok' > ${NOMAD_TASK_DIR}/test/${NOMAD_ALLOC_ID}; sleep 3600"]
|
2020-03-16 12:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "test"
|
|
|
|
destination = "${NOMAD_TASK_DIR}/test"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 500
|
|
|
|
memory = 128
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|