Files
nomad/e2e/consulcompat/input/connect.nomad.hcl
Tim Gross 4e38b41d9d E2E: add template block to consulcompat test (#19055)
The Consul compatibility test focuses on Connect, but it'd be a good idea to
ensure we can successfully get template data out of Consul as well.

Also tightens up the test's Consul ACL policy for the Nomad agent.
2023-11-10 09:25:37 -05:00

83 lines
1.4 KiB
HCL

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
job "countdash" {
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
task "web" {
driver = "docker"
config {
image = "hashicorpdev/counter-api:v3"
auth_soft_fail = true
}
}
}
group "dashboard" {
network {
mode = "bridge"
port "http" {
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 = "hashicorpdev/counter-dashboard:v3"
auth_soft_fail = true
}
# this template can't be used for the COUNTING_SERVICE_URL because it
# needs the Nomad-assigned upstream address here and not the Consul
# service address, but this is handy for testing.
template {
data = <<EOT
{{- range service "count-api" }}
API_ADDR=http://{{ .Address }}:{{ .Port }}{{- end }}
EOT
destination = "local/count-api.txt"
}
}
}
}