github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/consul/input/namespaces/services_task.nomad (about)

     1  job "services_task" {
     2    datacenters = ["dc1"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "group-b" {
    11  
    12      consul {
    13        namespace = "banana"
    14      }
    15  
    16      network {
    17        mode = "bridge"
    18        port "port-b" {
    19          to = 1234
    20        }
    21      }
    22  
    23      task "task-b" {
    24        driver = "docker"
    25  
    26        config {
    27          image   = "busybox:1"
    28          command = "nc"
    29          args    = ["-ll", "-p", "1234", "-e", "/bin/cat"]
    30        }
    31  
    32        service {
    33          name = "b1"
    34          port = "port-b"
    35  
    36          check {
    37            name     = "ping-b1"
    38            type     = "tcp"
    39            interval = "10s"
    40            timeout  = "2s"
    41          }
    42        }
    43  
    44        service {
    45          name = "b2"
    46          port = "port-b"
    47  
    48          check {
    49            name     = "ping-b2"
    50            type     = "tcp"
    51            interval = "10s"
    52            timeout  = "2s"
    53          }
    54        }
    55      }
    56    }
    57  
    58    group "group-c" {
    59  
    60      consul {
    61        namespace = "cherry"
    62      }
    63  
    64      network {
    65        mode = "bridge"
    66        port "port-c" {
    67          to = 1234
    68        }
    69      }
    70  
    71      task "task-c" {
    72        driver = "docker"
    73  
    74        config {
    75          image   = "busybox:1"
    76          command = "nc"
    77          args    = ["-ll", "-p", "1234", "-e", "/bin/cat"]
    78        }
    79  
    80        service {
    81          name = "c1"
    82          port = "port-c"
    83  
    84          check {
    85            name     = "ping-c1"
    86            type     = "tcp"
    87            interval = "10s"
    88            timeout  = "2s"
    89          }
    90        }
    91  
    92        service {
    93          name = "c2"
    94          port = "port-c"
    95  
    96          check {
    97            name     = "ping-c2"
    98            type     = "tcp"
    99            interval = "10s"
   100            timeout  = "2s"
   101          }
   102        }
   103      }
   104    }
   105  
   106    group "group-z" {
   107  
   108      # consul namespace not set
   109  
   110      network {
   111        mode = "bridge"
   112        port "port-z" {
   113          to = 1234
   114        }
   115      }
   116  
   117      task "task-z" {
   118        driver = "docker"
   119  
   120        config {
   121          image   = "busybox:1"
   122          command = "nc"
   123          args    = ["-ll", "-p", "1234", "-e", "/bin/cat"]
   124        }
   125  
   126        service {
   127          name = "z1"
   128          port = "port-z"
   129  
   130          check {
   131            name     = "ping-z1"
   132            type     = "tcp"
   133            interval = "10s"
   134            timeout  = "2s"
   135          }
   136        }
   137  
   138        service {
   139          name = "z2"
   140          port = "port-z"
   141  
   142          check {
   143            name     = "ping-z2"
   144            type     = "tcp"
   145            interval = "10s"
   146            timeout  = "2s"
   147          }
   148        }
   149      }
   150    }
   151  }