How qbec evaluates component code using jsonnet and what it expects the output to look like.
.jsonnet
, .json
, and .yaml
file directly under the component directory as a component to be loaded.
In this case, the component name is the file name without the extension.index.jsonnet
or index.yaml
file.
If so, create a component with the sub-directory name.
index.jsonnet
file exists load it for component processingindex.yaml
file exists load all .json
and .yaml
files in the subdirectory.This works as follows:
c1.jsonnet
, c2.json
, and c3.yaml
evaluate each file in its own VM in parallel
upto a specific concurrency.The YAML file is parsed as: std.native('parseYaml')(importstr '<file>')
The JSON file is parsed as: std.native('parseJson')(importstr '<file>')
The JSONNET is evaluated in a VM instance as-is. In this case:
qbec.io/env
extension variable is set to the environment name in question.qbec.io/envProperties
extension variable is set to the properties defined for the environment.qbec.io/tag
extension variable is set to the --app-tag
argument passed to the command line (or the empty
string, if it wasn’t)qbec.io/defaultNs
variable is set to the default namespace for the environment. This is typically the namespace
defined in the qbec.yaml
file for the environment. If the namespaceTagSuffix
attribute in qbec.yaml
is set to
true
and an --app-tag
argument was specified for the command, the namespace from qbec.yaml
is suffixed with the tag with a hyphen in between.qbec.yaml
but not specified on the command line are set.The evaluation above creates a map of component names to outputs returned by the jsonnet, json and yaml files.
The output is allowed to be:
kind
and apiVersion
fields, where kind
is not List
).kind
is List
and it has an items
array attribute
containing an array of outputs.In the latter 3 cases, the output is processed recursively to get to the leaf k8s objects.