Skip to content

Configuration

infctl uses JSON files for configuration. It also accepts JSON with comments (JSONC): // line comments and /* */ block comments are stripped before parsing. Files may use either a .json or .jsonc extension, and the result is still validated as strict JSON. Comment-like text inside string values, such as a URL, is preserved.

It is designed around the idea of pipelines where each pipeline performs a series of steps.

A short, 2 step pipeline configuration can look like :

[
{
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
},
{
"name": "create php configmap",
"function": "RunCommand",
"params": ["./scripts/create_php_configmap_ctl.sh"],
"retryCount": 0,
"shouldAbort": true
}
]

Each Object is a task.

Object task records are executed in a [] list and in sequence.

Each task has a name to be displayed in logs.

Each task calls a Function that is registered within infctl and that accepts params string, which are any parameters to be passed to that function, script or executable. The simplest example being RunCommand which accepts the path to a script or executable as its params. This can be anything but can be as simple as :

Terminal window
echo "hello world"
exit 0

So infctl is unlimited as to what it can use in its pipeline files to achieve any kind of automation.

If a task fails ( the script or program that is run returns a non zero value ) it may be re-tried up to retryCount times.

If a task fails the pipeline will stop running unless shouldAbort is set to false, in which case, the pipeline will continue to run with the next step item in the list.

Comments are stripped before the file is parsed, so pipeline files may be written as JSONC:

[
{
// ensure the namespace used by the smoke test exists
"name": "ensure inf namespace exists",
"function": "k8sNamespaceExists",
"params": ["infctl"],
"retryCount": 0,
"shouldAbort": true
}
]

Files may use a .json or .jsonc extension. Comments are the only supported JSONC addition; the remaining data must still be valid JSON (for example, trailing commas are not allowed).