github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/csi/input/use-ebs-volume.nomad (about)

     1  # a job that mounts an EBS volume and writes its job ID as a file
     2  job "use-ebs-volume" {
     3    datacenters = ["dc1", "dc2"]
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "group" {
    11      volume "test" {
    12        type            = "csi"
    13        source          = "ebs-vol"
    14        attachment_mode = "file-system"
    15        access_mode     = "single-node-writer"
    16        per_alloc       = true
    17      }
    18  
    19      task "task" {
    20        driver = "docker"
    21  
    22        config {
    23          image   = "busybox:1"
    24          command = "/bin/sh"
    25          args    = ["-c", "echo 'ok' > ${NOMAD_TASK_DIR}/test/${NOMAD_ALLOC_ID}; sleep 3600"]
    26        }
    27  
    28        volume_mount {
    29          volume      = "test"
    30          destination = "${NOMAD_TASK_DIR}/test"
    31          read_only   = false
    32        }
    33  
    34        resources {
    35          cpu    = 500
    36          memory = 128
    37        }
    38      }
    39    }
    40  }