nomad
nomad copied to clipboard
[feature request] be able override resources in parameterized job
Nomad version
Nomad v0.11.3 (8918fc804a0c6758b6e3e9960e4eb2e605e38552)
Operating system and Environment details
CentOS 7/8, Ubuntu 18.04
Issue
I want to be able to register a parameterized job and then, be able to have different resource constraints for each dispatch of the job instance.
Also, if I were to move the meta from required to optional, how would I be able to specify a default value for the optional parameter?
Reproduction steps
Job file (if appropriate)
File: param1.nomad
job "param1" {
type = "batch"
parameterized {
payload = "forbidden"
meta_required = ["CPU_VALUE"]
}
group "mygroup" {
task "mytask" {
driver = "raw_exec"
config {
command = "/bin/sleep"
args = ["300"]
}
resources {
cpu = "${NOMAD_META_CPU_VALUE}" # this does not work (of course), but that's what I want to achieve
memory = 256
network {
mbits = 100
}
}
}
}
}
Use Case
The parameterized job is used to build different software components, some require more CPU/MEMORY than others while building, hence reserving the same cpu/memory for each dispatch is "sub-optimal". n/a
I'm going to mark this with hcl because it's the sort of thing we might be able to improve upon when we embark on our HCL2 migration.
"embark" makes it sound quite far away! 😀
for now, I see just doing a full render (using levant/or equivalent) which will set job and task specific values all over.
just updating, in case anyone else reaches here while searching
https://github.com/hashicorp/nomad/issues/12228 was a duplicate of this and I've closed that. But that also made me realize I should have removed the hcl label from this one, as it really doesn't help for this use case because HCL2 parsing is done in the CLI and not in the server.
☝️ +1 this would come really handy
+1 this would really help me too