I can't understand how to best to parameterize a Jsonnet file so that I may call the same file from bash and from another Jsonnet file.
Assuming I have a simple template called template.jsonnet:
{
// Required arguments
name:: error "'name' must be specified",
port:: error "'port' must be specified",
...,
}
I can readily incorporate this into another Jsonnet file and provide its required parameter values with:
{
local template = = import "./template.jsonnet";
template + {
name:: "service",
port:: 8080,
}
I'm struggling to determine the intended way that I could call template.jsonnet
from bash to achieve the same result.
I can use --ext-str
but this appears to require std.extVar(x)
A GitHub issue suggests that --tla-code
may be an alternative to std.extVar() but I don't understand how to use it for my needs.
A follow-up question is: how do do this for a parameter this is an array:
{
local template = = import "./template.jsonnet";
template + {
name:: "service",
port:: [8080,8081,8082],
}