github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/connect/input/ingress-gateway.nomad (about)

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