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

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "multi-ingress" {
     5  
     6    datacenters = ["dc1"]
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "gateways" {
    14      network {
    15        mode = "bridge"
    16        port "inbound1" {
    17          static = 8081
    18          to     = 8081
    19        }
    20        port "inbound2" {
    21          static = 8082
    22          to     = 8082
    23        }
    24        port "inbound3" {
    25          static = 8083
    26          to     = 8083
    27        }
    28      }
    29  
    30      service {
    31        name = "ig1"
    32        port = "8081"
    33        connect {
    34          gateway {
    35            ingress {
    36              listener {
    37                port     = 8081
    38                protocol = "tcp"
    39                service {
    40                  name = "api1"
    41                }
    42              }
    43            }
    44          }
    45        }
    46      }
    47  
    48      service {
    49        name = "ig2"
    50        port = "8082"
    51        connect {
    52          gateway {
    53            ingress {
    54              listener {
    55                port     = 8082
    56                protocol = "tcp"
    57                service {
    58                  name = "api2"
    59                }
    60              }
    61            }
    62          }
    63        }
    64      }
    65  
    66      service {
    67        name = "ig3"
    68        port = "8083"
    69        connect {
    70          gateway {
    71            ingress {
    72              listener {
    73                port     = 8083
    74                protocol = "tcp"
    75                service {
    76                  name = "api3"
    77                }
    78              }
    79            }
    80          }
    81        }
    82      }
    83    }
    84  
    85    group "api1" {
    86      network {
    87        mode = "host"
    88        port "api" {}
    89      }
    90  
    91      service {
    92        name = "api1"
    93        port = "api"
    94  
    95        connect {
    96          native = true
    97        }
    98      }
    99  
   100      task "api1" {
   101        driver = "docker"
   102  
   103        config {
   104          image        = "hashicorpdev/uuid-api:v5"
   105          network_mode = "host"
   106        }
   107  
   108        env {
   109          BIND = "0.0.0.0"
   110          PORT = "${NOMAD_PORT_api}"
   111        }
   112      }
   113    }
   114  
   115    group "api2" {
   116      network {
   117        mode = "host"
   118        port "api" {}
   119      }
   120  
   121      service {
   122        name = "api2"
   123        port = "api"
   124  
   125        connect {
   126          native = true
   127        }
   128      }
   129  
   130      task "api2" {
   131        driver = "docker"
   132  
   133        config {
   134          image        = "hashicorpdev/uuid-api:v5"
   135          network_mode = "host"
   136        }
   137  
   138        env {
   139          BIND = "0.0.0.0"
   140          PORT = "${NOMAD_PORT_api}"
   141        }
   142      }
   143    }
   144  
   145    group "api3" {
   146      network {
   147        mode = "host"
   148        port "api" {}
   149      }
   150  
   151      service {
   152        name = "api3"
   153        port = "api"
   154  
   155        connect {
   156          native = true
   157        }
   158      }
   159  
   160      task "api3" {
   161        driver = "docker"
   162  
   163        config {
   164          image        = "hashicorpdev/uuid-api:v5"
   165          network_mode = "host"
   166        }
   167  
   168        env {
   169          BIND = "0.0.0.0"
   170          PORT = "${NOMAD_PORT_api}"
   171        }
   172      }
   173    }
   174  }