A list of all native functions that qbec natively supports.
this function is now deprecated. Integrate with helm using external data sources instead
The expandHelmTemplate
function expands a helm chart and returns the resulting objects.
This is EXPERIMENTAL in nature - the API is subject to change in a subsequent release.
It runs the helm template
command, assuming that the helm
binary is already installed and
available in the PATH.
local expandHelmTemplate = std.native('expandHelmTemplate');
expandHelmTemplate("path/to/chart",
{
chartProperty: 'chart-value'
},
{
namespace: 'my-ns',
name: 'my-name',
thisFile: std.thisFile, // important
},
)
.tar.gz
file).--values
argument to the template command.This object supports the following keys:
thisFile
(string) - the current file from which the function is called. Should be set to std.thisFile. Relative references
are resolved with respect to the supplied file path.namespace
(string) - the --namespace
argument to the template commandname
(string) - the --name
argument to the template commandnameTemplate
(string) - the --name-template
argument to the template commandgenerateName
(string) - the --generate-name
argument to the template commandexecute
(array of strings) - the --execute
argument to the template commandkubeVersion
(string) - the --kube-version
argument to the template commandverbose
(bool) - print helm template
command invocation to standard error before executing itThe parseJson
function parses a JSON-encoded string and returns the corresponding object.
local parseJson = std.native('parseJson');
local jsonString = '{ "hello" : "world" }';
parseJson(jsonString) // returns the _object_ { hello: 'world' }
The parseYaml
function parses an input string into an array of YAML documents. It always returns an array
even if there is only one YAML document in the string.
local parseYaml = std.native('parseYaml');
local yamlString = importstr './path/to/yaml/file';
parseYaml(yamlString) // returns all YAML docs as an array
The renderYaml
function takes a single input and returns the corresponding YAML as a string. This YAML is compatible
with the output of qbec fmt
. If the input is an array, it will create multiple YAML documents, one for each element.
To render an array value as a single document wrap the value in a one-element array. Note that top-level nils do not
produce any output.
local renderYaml = std.native('renderYaml');
local oneDoc = renderYaml({ foo: 'bar', bar: 'baz' });
local twoDocs = renderYaml([{ foo: 'bar' }, null, { foo: 'baz' }]);
local arrayAsDoc = renderYaml([[{ foo: 'bar' }, { foo: 'baz' }]]);
{
one: oneDoc,
two: twoDocs,
aDoc: arrayAsDoc,
}