open-nomad/e2e/workload_id/input/node-meta.nomad.hcl
Michael Schurter d9587b323a
Task API / Dynamic Node Metadata E2E test fixes (#16219)
* taskapi: return Forbidden on bad credentials

Prior to this change a "Server error" would be returned when ACLs are
enabled which did not match when ACLs are disabled.

* e2e: love love love datacenter wildcard default

* e2e: skip windows nodes on linux only test

The Logfs are a bit weird because they're most useful when converted to
Printfs to make debugging the test much faster, but that makes CI noisy.

In a perfect world Go would expose how many tests are being run and we
could stream output live if there's only 1. For now I left these helpful
lines in as basically glorified comments.
2023-02-21 10:53:10 -08:00

105 lines
1.8 KiB
HCL

variable "foo_key" {
type = string
}
variable "empty_key" {
type = string
}
variable "unset_key" {
type = string
}
variable "foo_constraint" {
type = string
}
variable "empty_constraint" {
type = string
}
variable "unset_constraint" {
type = string
}
job "node-meta" {
type = "batch"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
constraint {
attribute = var.foo_constraint
value = "bar"
}
constraint {
attribute = var.empty_constraint
operator = "is_set"
}
constraint {
attribute = var.unset_constraint
operator = "is_not_set"
}
group "node-meta" {
// sets keyUnset
task "docker-nm" {
driver = "docker"
config {
image = "curlimages/curl:7.87.0"
args = [
"--unix-socket", "${NOMAD_SECRETS_DIR}/api.sock",
"-H", "Authorization: Bearer ${NOMAD_TOKEN}",
"--data-binary", "{\"Meta\": {\"${var.unset_key}\": \"set\"}}",
"--fail-with-body",
"--verbose",
"localhost/v1/client/metadata",
]
}
identity {
env = true
}
resources {
cpu = 16
memory = 32
disk = 64
}
}
// unsets keyEmpty
task "exec-nm" {
driver = "exec"
config {
command = "curl"
args = [
"-H", "Authorization: Bearer ${NOMAD_TOKEN}",
"--unix-socket", "${NOMAD_SECRETS_DIR}/api.sock",
"--data-binary", "{\"Meta\": {\"${var.empty_key}\": null}}",
"--fail-with-body",
"--verbose",
"localhost/v1/client/metadata",
]
}
identity {
env = true
}
resources {
cpu = 16
memory = 32
disk = 64
}
}
}
}