github.com/hernad/nomad@v1.6.112/e2e/connect/input/ingress-gateway.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "ig-bridge-demo" {
     5  
     6    datacenters = ["dc1"]
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "ingress-group" {
    14  
    15      network {
    16        mode = "bridge"
    17        port "inbound" {
    18          static = 8080
    19          to     = 8080
    20        }
    21      }
    22  
    23      service {
    24        name = "my-ingress-service"
    25        port = "8080"
    26  
    27        connect {
    28          gateway {
    29            proxy {
    30              # The following options are automatically set by Nomad if not
    31              # explicitly configured when using bridge networking.
    32              #
    33              # envoy_gateway_no_default_bind = true
    34              # envoy_gateway_bind_addresses "uuid-api" {
    35              #   address = "0.0.0.0"
    36              #   port    = <associated listener.port>
    37              # }
    38              #
    39              # Additional options are documented at
    40              # https://www.nomadproject.io/docs/job-specification/gateway#proxy-parameters
    41            }
    42  
    43            ingress {
    44              # Nomad will automatically manage the Configuration Entry in Consul
    45              # given the parameters in the ingress block.
    46              #
    47              # Additional options are documented at
    48              # https://www.nomadproject.io/docs/job-specification/gateway#ingress-parameters
    49              listener {
    50                port     = 8080
    51                protocol = "tcp"
    52                service {
    53                  name = "uuid-api"
    54                }
    55              }
    56            }
    57          }
    58        }
    59      }
    60    }
    61  
    62    group "generator" {
    63      network {
    64        mode = "host"
    65        port "api" {}
    66      }
    67  
    68      service {
    69        name = "uuid-api"
    70        port = "${NOMAD_PORT_api}"
    71  
    72        connect {
    73          native = true
    74        }
    75      }
    76  
    77      task "generate" {
    78        driver = "docker"
    79  
    80        config {
    81          image        = "hashicorpdev/uuid-api:v3"
    82          network_mode = "host"
    83        }
    84  
    85        env {
    86          BIND = "0.0.0.0"
    87          PORT = "${NOMAD_PORT_api}"
    88        }
    89      }
    90    }
    91  }