nomad
nomad copied to clipboard
need a `nomad-template` cli like `consul-template`
Proposal
I think there should be a way to render the "template" from the template stanza of Nomad using the cmd line on the target machine.
This would be useful during debugging.
It would be fine if it was a command/subcommand of the nomad binary as well.
Use-cases
I had the following template in a Nomad job:
SOME_VAR="-Xms[[ env "attr.memory.totalbytes" | parseUint | divide 1048576 | multiply 0.60 | minimum 15360 | printf "%.0f" ]]m ...
I was trying to get 60% of total memory and use the minimum of that and 15GB.
This worked fine for smaller sized machines, where the 60% was less than 15360m
For a machine with large memory, it failed with:
Invalid initial heap size: -Xms%!f(int64=15360)m
The message is very cryptic and the only clue being the %!f.
What made it work was making 15360 to 15360.0 for the subsequent "float print".
I wish there was a Nomad way to test this, using a cli tool like consul-template.
Typically I test consul specific templates using consul-template to figure out their accuracy, especially around newlines and spaces, etc.
Attempted Solutions
None
Hey @shantanugadgil, just letting you know that I'm aware of this now! I was the moderator for the Q&A!
Oh, that’s nice! Would be a great help.