github.com/hernad/nomad@v1.6.112/e2e/csi/input/use-efs-volume-write.nomad (about)

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