github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/jobspec/test-fixtures/tg-network.hcl (about)

     1  job "foo" {
     2    datacenters = ["dc1"]
     3  
     4    group "bar" {
     5      count          = 3
     6      shutdown_delay = "14s"
     7  
     8      network {
     9        mode = "bridge"
    10  
    11        port "http" {
    12          static       = 80
    13          to           = 8080
    14          host_network = "public"
    15        }
    16  
    17        dns {
    18          servers = ["8.8.8.8"]
    19          options = ["ndots:2", "edns0"]
    20        }
    21      }
    22  
    23      service {
    24        name        = "connect-service"
    25        tags        = ["foo", "bar"]
    26        canary_tags = ["canary", "bam"]
    27        port        = "1234"
    28  
    29        connect {
    30          sidecar_service {
    31            tags = ["side1", "side2"]
    32  
    33            proxy {
    34              local_service_port = 8080
    35  
    36              upstreams {
    37                destination_name = "other-service"
    38                local_bind_port  = 4567
    39              }
    40            }
    41          }
    42  
    43          sidecar_task {
    44            resources {
    45              cpu    = 500
    46              memory = 1024
    47            }
    48  
    49            env {
    50              FOO = "abc"
    51            }
    52  
    53            shutdown_delay = "5s"
    54          }
    55        }
    56      }
    57  
    58      task "bar" {
    59        driver = "raw_exec"
    60  
    61        config {
    62          command = "bash"
    63          args    = ["-c", "echo hi"]
    64        }
    65  
    66        resources {
    67          network {
    68            mbits = 10
    69          }
    70        }
    71      }
    72    }
    73  }