github.com/hernad/nomad@v1.6.112/e2e/consul/input/namespaces/connect_ingress.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  job "connect_ingress" {
     5    datacenters = ["dc1"]
     6    type        = "service"
     7  
     8    constraint {
     9      attribute = "${attr.kernel.name}"
    10      value     = "linux"
    11    }
    12  
    13    group "ingress-group" {
    14  
    15      consul {
    16        namespace = "apple"
    17      }
    18  
    19      network {
    20        mode = "bridge"
    21        port "inbound" {
    22          static = 8080
    23          to     = 8080
    24        }
    25      }
    26  
    27      service {
    28        name = "my-ingress-service"
    29        port = "8080"
    30  
    31        connect {
    32          gateway {
    33            ingress {
    34              listener {
    35                port     = 8080
    36                protocol = "tcp"
    37                service {
    38                  name = "uuid-api"
    39                }
    40              }
    41            }
    42          }
    43        }
    44      }
    45    }
    46  
    47    group "ingress-group-z" {
    48  
    49      # consul namespace not set
    50  
    51      network {
    52        mode = "bridge"
    53        port "inbound" {
    54          static = 8081
    55          to     = 8080
    56        }
    57      }
    58  
    59      service {
    60        name = "my-ingress-service-z"
    61        port = "8081"
    62  
    63        connect {
    64          gateway {
    65            ingress {
    66              listener {
    67                port     = 8080
    68                protocol = "tcp"
    69                service {
    70                  name = "uuid-api-z"
    71                }
    72              }
    73            }
    74          }
    75        }
    76      }
    77    }
    78  
    79    group "generator" {
    80  
    81      consul {
    82        namespace = "apple"
    83      }
    84  
    85      network {
    86        mode = "host"
    87        port "api" {}
    88      }
    89  
    90      service {
    91        name = "uuid-api"
    92        port = "${NOMAD_PORT_api}"
    93  
    94        connect {
    95          native = true
    96        }
    97      }
    98  
    99      task "generate" {
   100        driver = "docker"
   101  
   102        config {
   103          image        = "hashicorpdev/uuid-api:v3"
   104          network_mode = "host"
   105        }
   106  
   107        env {
   108          BIND = "0.0.0.0"
   109          PORT = "${NOMAD_PORT_api}"
   110        }
   111      }
   112    }
   113  
   114    group "generator-z" {
   115  
   116      # consul namespace not set
   117  
   118      network {
   119        mode = "host"
   120        port "api" {}
   121      }
   122  
   123      service {
   124        name = "uuid-api-z"
   125        port = "${NOMAD_PORT_api}"
   126  
   127        connect {
   128          native = true
   129        }
   130      }
   131  
   132      task "generate-z" {
   133        driver = "docker"
   134  
   135        config {
   136          image        = "hashicorpdev/uuid-api:v3"
   137          network_mode = "host"
   138        }
   139  
   140        env {
   141          BIND = "0.0.0.0"
   142          PORT = "${NOMAD_PORT_api}"
   143        }
   144      }
   145    }
   146  }