-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consul/connect: Enable running multiple ingress gateways per Nomad agent
Connect ingress gateway services were being registered into Consul without an explicit deterministic service ID. Consul would generate one automatically, but then Nomad would have no way to register a second gateway on the same agent as it would not supply 'proxy-id' during envoy bootstrap. Set the ServiceID for gateways, and supply 'proxy-id' when doing envoy bootstrap. Fixes #9834
- Loading branch information
Showing
6 changed files
with
218 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
job "multi-ingress" { | ||
|
||
datacenters = ["dc1"] | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
group "gateways" { | ||
network { | ||
mode = "bridge" | ||
port "inbound1" { | ||
static = 8081 | ||
to = 8081 | ||
} | ||
port "inbound2" { | ||
static = 8082 | ||
to = 8082 | ||
} | ||
port "inbound3" { | ||
static = 8083 | ||
to = 8083 | ||
} | ||
} | ||
|
||
service { | ||
name = "ig1" | ||
port = "8081" | ||
connect { | ||
gateway { | ||
ingress { | ||
listener { | ||
port = 8081 | ||
protocol = "tcp" | ||
service { | ||
name = "api1" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
service { | ||
name = "ig2" | ||
port = "8082" | ||
connect { | ||
gateway { | ||
ingress { | ||
listener { | ||
port = 8082 | ||
protocol = "tcp" | ||
service { | ||
name = "api2" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
service { | ||
name = "ig3" | ||
port = "8083" | ||
connect { | ||
gateway { | ||
ingress { | ||
listener { | ||
port = 8083 | ||
protocol = "tcp" | ||
service { | ||
name = "api3" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
group "api1" { | ||
network { | ||
mode = "host" | ||
port "api" {} | ||
} | ||
|
||
service { | ||
name = "api1" | ||
port = "api" | ||
|
||
connect { | ||
native = true | ||
} | ||
} | ||
|
||
task "api1" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "hashicorpnomad/uuid-api:v5" | ||
network_mode = "host" | ||
} | ||
|
||
env { | ||
BIND = "0.0.0.0" | ||
PORT = "${NOMAD_PORT_api}" | ||
} | ||
} | ||
} | ||
|
||
group "api2" { | ||
network { | ||
mode = "host" | ||
port "api" {} | ||
} | ||
|
||
service { | ||
name = "api2" | ||
port = "api" | ||
|
||
connect { | ||
native = true | ||
} | ||
} | ||
|
||
task "api2" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "hashicorpnomad/uuid-api:v5" | ||
network_mode = "host" | ||
} | ||
|
||
env { | ||
BIND = "0.0.0.0" | ||
PORT = "${NOMAD_PORT_api}" | ||
} | ||
} | ||
} | ||
|
||
group "api3" { | ||
network { | ||
mode = "host" | ||
port "api" {} | ||
} | ||
|
||
service { | ||
name = "api3" | ||
port = "api" | ||
|
||
connect { | ||
native = true | ||
} | ||
} | ||
|
||
task "api3" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "hashicorpnomad/uuid-api:v5" | ||
network_mode = "host" | ||
} | ||
|
||
env { | ||
BIND = "0.0.0.0" | ||
PORT = "${NOMAD_PORT_api}" | ||
} | ||
} | ||
} | ||
} |