github.com/hernad/nomad@v1.6.112/e2e/servicediscovery/input/simple_lb_clients.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "simple_lb_clients" {
     5    datacenters = ["dc1"]
     6    type        = "batch"
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "client_1" {
    14      task "cat" {
    15        driver = "raw_exec"
    16        config {
    17          command = "bash"
    18          args    = ["-c", "sleep 15000"]
    19        }
    20        resources {
    21          cpu    = 10
    22          memory = 16
    23        }
    24        template {
    25          destination = "output.txt"
    26          data        = <<EOH
    27  {{$allocID := env "NOMAD_ALLOC_ID" -}}
    28  {{range nomadService 1 $allocID "db"}}
    29    server {{ .Address }}:{{ .Port }}
    30  {{- end}}
    31  EOH
    32        }
    33      }
    34    }
    35  
    36    group "client_2" {
    37      task "cat" {
    38        driver = "raw_exec"
    39        config {
    40          command = "bash"
    41          args    = ["-c", "sleep 15000"]
    42        }
    43        resources {
    44          cpu    = 10
    45          memory = 16
    46        }
    47        template {
    48          destination = "output.txt"
    49          data        = <<EOH
    50  {{$allocID := env "NOMAD_ALLOC_ID" -}}
    51  {{range nomadService 2 $allocID "db"}}
    52    server {{ .Address }}:{{ .Port }}
    53  {{- end}}
    54  EOH
    55        }
    56      }
    57    }
    58  }