open-nomad/jobspec/test-fixtures/tg-network.hcl
Tim Gross cd9c23617f
client/connect: ConsulProxy LocalServicePort/Address (#6358)
Without a `LocalServicePort`, Connect services will try to use the
mapped port even when delivering traffic locally. A user can override
this behavior by pinning the port value in the `service` stanza but
this prevents us from using the Consul service name to reach the
service.

This commits configures the Consul proxy with its `LocalServicePort`
and `LocalServiceAddress` fields.
2019-09-23 14:30:48 -04:00

65 lines
1,017 B
HCL

job "foo" {
datacenters = ["dc1"]
group "bar" {
count = 3
network {
mode = "bridge"
port "http" {
static = 80
to = 8080
}
}
service {
name = "connect-service"
tags = ["foo", "bar"]
canary_tags = ["canary", "bam"]
port = "1234"
connect {
sidecar_service {
proxy {
local_service_port = 8080
upstreams {
destination_name = "other-service"
local_bind_port = 4567
}
}
}
sidecar_task {
resources {
cpu = 500
memory = 1024
}
env {
FOO = "abc"
}
shutdown_delay = "5s"
}
}
}
task "bar" {
driver = "raw_exec"
config {
command = "bash"
args = ["-c", "echo hi"]
}
resources {
network {
mbits = 10
}
}
}
}
}