mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 03:15:42 +03:00
Add a `PerAlloc` field to volume requests that directs the scheduler to test feasibility for volumes with a source ID that includes the allocation index suffix (ex. `[0]`), rather than the exact source ID. Read the `PerAlloc` field when making the volume claim at the client to determine if the allocation index suffix (ex. `[0]`) should be added to the volume source ID.
39 lines
755 B
HCL
39 lines
755 B
HCL
# a job that mounts an EBS volume and writes its job ID as a file
|
|
job "use-ebs-volume" {
|
|
datacenters = ["dc1", "dc2"]
|
|
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
|
|
group "group" {
|
|
volume "test" {
|
|
type = "csi"
|
|
source = "ebs-vol"
|
|
per_alloc = true
|
|
}
|
|
|
|
task "task" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "busybox:1"
|
|
command = "/bin/sh"
|
|
args = ["-c", "echo 'ok' > ${NOMAD_TASK_DIR}/test/${NOMAD_ALLOC_ID}; sleep 3600"]
|
|
}
|
|
|
|
volume_mount {
|
|
volume = "test"
|
|
destination = "${NOMAD_TASK_DIR}/test"
|
|
read_only = false
|
|
}
|
|
|
|
resources {
|
|
cpu = 500
|
|
memory = 128
|
|
}
|
|
}
|
|
}
|
|
}
|