open-nomad/e2e/consul/input/namespaces/template_kv.nomad
Seth Hoenig 509490e5d2 e2e: consul namespace tests from nomad ent
(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)
2021-04-19 15:35:31 -06:00

49 lines
791 B
HCL

job "template_kv" {
datacenters = ["dc1"]
type = "batch"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
group "group-b" {
consul {
namespace = "banana"
}
task "task-b" {
driver = "raw_exec"
config {
command = "cat"
args = ["local/a.txt"]
}
template {
data = "value: {{ key \"ns-kv-example\" }}"
destination = "local/a.txt"
}
}
}
group "group-z" {
# no consul namespace set
task "task-z" {
driver = "raw_exec"
config {
command = "cat"
args = ["local/a.txt"]
}
template {
data = "value: {{ key \"ns-kv-example\" }}"
destination = "local/a.txt"
}
}
}
}