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

     1  job "connect_terminating" {
     2    datacenters = ["dc1"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "api" {
    11  
    12      consul {
    13        namespace = "apple"
    14      }
    15  
    16      network {
    17        mode = "host"
    18        port "port" {
    19          static = "9001"
    20        }
    21      }
    22  
    23      service {
    24        name = "count-api"
    25        port = "port"
    26      }
    27  
    28      task "api" {
    29        driver = "docker"
    30  
    31        config {
    32          image        = "hashicorpdev/counter-api:v3"
    33          network_mode = "host"
    34        }
    35  
    36        env {
    37          PORT = "${NOMAD_PORT_port}"
    38        }
    39      }
    40    }
    41  
    42    group "api-z" {
    43  
    44      # consul namespace not set
    45  
    46      network {
    47        mode = "host"
    48        port "port" {
    49          static = "9011"
    50        }
    51      }
    52  
    53      service {
    54        name = "count-api-z"
    55        port = "port"
    56      }
    57  
    58      task "api" {
    59        driver = "docker"
    60  
    61        config {
    62          image        = "hashicorpdev/counter-api:v3"
    63          network_mode = "host"
    64        }
    65  
    66        env {
    67          PORT = "${NOMAD_PORT_port}"
    68        }
    69      }
    70    }
    71  
    72    group "gateway" {
    73  
    74      consul {
    75        namespace = "apple"
    76      }
    77  
    78      network {
    79        mode = "bridge"
    80      }
    81  
    82      service {
    83        name = "api-gateway"
    84  
    85        connect {
    86          gateway {
    87            terminating {
    88              service {
    89                name = "count-api"
    90              }
    91            }
    92          }
    93        }
    94      }
    95    }
    96  
    97    group "gateway-z" {
    98  
    99      # consul namespace not set
   100  
   101      network {
   102        mode = "bridge"
   103      }
   104  
   105      service {
   106        name = "api-gateway-z"
   107  
   108        connect {
   109          gateway {
   110            terminating {
   111              service {
   112                name = "count-api-z"
   113              }
   114            }
   115          }
   116        }
   117      }
   118    }
   119  
   120    group "dashboard" {
   121  
   122      consul {
   123        namespace = "apple"
   124      }
   125  
   126      network {
   127        mode = "bridge"
   128  
   129        port "http" {
   130          static = 9002
   131          to     = 9002
   132        }
   133      }
   134  
   135      service {
   136        name = "count-dashboard"
   137        port = "9002"
   138  
   139        connect {
   140          sidecar_service {
   141            proxy {
   142              upstreams {
   143                destination_name = "count-api"
   144                local_bind_port  = 8080
   145              }
   146            }
   147          }
   148        }
   149      }
   150  
   151      task "dashboard" {
   152        driver = "docker"
   153  
   154        env {
   155          COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
   156        }
   157  
   158        config {
   159          image = "hashicorpdev/counter-dashboard:v3"
   160        }
   161      }
   162    }
   163  
   164    group "dashboard-z" {
   165  
   166      # consul namespace not set
   167  
   168      network {
   169        mode = "bridge"
   170  
   171        port "http" {
   172          static = 9012
   173          to     = 9002
   174        }
   175      }
   176  
   177      service {
   178        name = "count-dashboard-z"
   179        port = "9012"
   180  
   181        connect {
   182          sidecar_service {
   183            proxy {
   184              upstreams {
   185                destination_name = "count-api-z"
   186                local_bind_port  = 8080
   187              }
   188            }
   189          }
   190        }
   191      }
   192  
   193      task "dashboard" {
   194        driver = "docker"
   195  
   196        env {
   197          COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api-z}"
   198        }
   199  
   200        config {
   201          image = "hashicorpdev/counter-dashboard:v3"
   202        }
   203      }
   204    }
   205  }