509490e5d2
(cherry-picked from ent without _ent things) This is part 2/4 of e2e tests for Consul Namespaces. Took a first pass at what the parameterized tests can look like, but only on the ENT side for this PR. Will continue to refactor in the next PRs. Also fixes 2 bugs: - Config Entries registered by Nomad Server on job registration were not getting Namespace set - Group level script checks were not getting Namespace set Those changes will need to be copied back to Nomad OSS. Nomad OSS + no ACLs (previously, needs refactor) Nomad ENT + no ACLs (this) Nomad OSS + ACLs (todo) Nomad ENT + ALCs (todo)
206 lines
3 KiB
HCL
206 lines
3 KiB
HCL
job "connect_terminating" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
|
|
group "api" {
|
|
|
|
consul {
|
|
namespace = "apple"
|
|
}
|
|
|
|
network {
|
|
mode = "host"
|
|
port "port" {
|
|
static = "9001"
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "count-api"
|
|
port = "port"
|
|
}
|
|
|
|
task "api" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "hashicorpnomad/counter-api:v3"
|
|
network_mode = "host"
|
|
}
|
|
|
|
env {
|
|
PORT = "${NOMAD_PORT_port}"
|
|
}
|
|
}
|
|
}
|
|
|
|
group "api-z" {
|
|
|
|
# consul namespace not set
|
|
|
|
network {
|
|
mode = "host"
|
|
port "port" {
|
|
static = "9011"
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "count-api-z"
|
|
port = "port"
|
|
}
|
|
|
|
task "api" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "hashicorpnomad/counter-api:v3"
|
|
network_mode = "host"
|
|
}
|
|
|
|
env {
|
|
PORT = "${NOMAD_PORT_port}"
|
|
}
|
|
}
|
|
}
|
|
|
|
group "gateway" {
|
|
|
|
consul {
|
|
namespace = "apple"
|
|
}
|
|
|
|
network {
|
|
mode = "bridge"
|
|
}
|
|
|
|
service {
|
|
name = "api-gateway"
|
|
|
|
connect {
|
|
gateway {
|
|
terminating {
|
|
service {
|
|
name = "count-api"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group "gateway-z" {
|
|
|
|
# consul namespace not set
|
|
|
|
network {
|
|
mode = "bridge"
|
|
}
|
|
|
|
service {
|
|
name = "api-gateway-z"
|
|
|
|
connect {
|
|
gateway {
|
|
terminating {
|
|
service {
|
|
name = "count-api-z"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group "dashboard" {
|
|
|
|
consul {
|
|
namespace = "apple"
|
|
}
|
|
|
|
network {
|
|
mode = "bridge"
|
|
|
|
port "http" {
|
|
static = 9002
|
|
to = 9002
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "count-dashboard"
|
|
port = "9002"
|
|
|
|
connect {
|
|
sidecar_service {
|
|
proxy {
|
|
upstreams {
|
|
destination_name = "count-api"
|
|
local_bind_port = 8080
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task "dashboard" {
|
|
driver = "docker"
|
|
|
|
env {
|
|
COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
|
|
}
|
|
|
|
config {
|
|
image = "hashicorpnomad/counter-dashboard:v3"
|
|
}
|
|
}
|
|
}
|
|
|
|
group "dashboard-z" {
|
|
|
|
# consul namespace not set
|
|
|
|
network {
|
|
mode = "bridge"
|
|
|
|
port "http" {
|
|
static = 9012
|
|
to = 9002
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "count-dashboard-z"
|
|
port = "9012"
|
|
|
|
connect {
|
|
sidecar_service {
|
|
proxy {
|
|
upstreams {
|
|
destination_name = "count-api-z"
|
|
local_bind_port = 8080
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task "dashboard" {
|
|
driver = "docker"
|
|
|
|
env {
|
|
COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api-z}"
|
|
}
|
|
|
|
config {
|
|
image = "hashicorpnomad/counter-dashboard:v3"
|
|
}
|
|
}
|
|
}
|
|
}
|