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

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  # a job that mounts an EBS volume and writes its job ID as a file
     5  job "use-ebs-volume" {
     6    datacenters = ["dc1", "dc2"]
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "group" {
    14      volume "test" {
    15        type            = "csi"
    16        source          = "ebs-vol"
    17        attachment_mode = "file-system"
    18        access_mode     = "single-node-writer"
    19        per_alloc       = true
    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  }