blob: bc7ba3df2bc7c9bfebf98288b2ca28eed6480bb6 [file] [log] [blame] [view]
# Variables in OpenServerless Task
This document lists general guidelines to define OpenServerless Tasks variable via the `ops` cli.
## General info:
OpenServerless Tasks variable are typically set issuing a command like `ops config VARIABLE=<value>`. These variable are stored under the `~/.ops/config.json` file. Variables name are splitted over the `_` character and the resulting parts are used to compose a json nested object having all the parts, that is given a variable with value `OPERATOR_COMPONENT_MINIO=true` the resulting json persisted into the configuration file will be something like
```json
{
"operator":{
"component":{
"minio":true
}
}
}
```
## General guidelines:
With the above described behavior we have defined some general rules to be adopted when developing/updating OpenServerless Tasks variables
- Avoid to define variable starting with `OPS_` prefix. This prefix is reserved to the `ops` general config itself, and normally defined inside the `opsroot.json`. It is better to clearly distinguish task variable from the `ops` generated/reserved ones.
- Considering the `_` splitting rules, prefer variable names composed by a maximum of 4 parts to avoid too much nested `json` structure. This is to simplify readability of the `config.json` if manually inspected.
- Do not override variable used for configuration, with values obtained after the configuration has been applied (to create/update an Apache OpenServerless instance). This is to guarantee that we can always reconstruct the original `config.json` file. For instance OPS tasks defines an `OPERATOR_CONFIG_APIHOST` that should not be overridden. It is better to define a `OUTPUT_APIHOST` instead.
- Specify volume size parameters with numerical value expressed as GB
- Specify memory size parameters with numerical value expressed as GB
## Variable prefixes category
This is a comprehensive list of variable prefix used in Ops tasks describing their purpose
| Variable Prefix | Purpose |
|---|---|
| OPERATOR_COMPONENT_ | Used to defined which OpenServerless Components needs to be deployed by the Operator |
| OPERATOR_CONFIG_ | Global Ops Operator configuration parameters |
| OPENWHISK_CONTROLLER_ | OpenWhisk Controller Configuration |
| OPENWHISK_INVOKER_ | OpenWhisk Invoker Configuration |
| OPENWHISK_ | OpenWhisk General configuration for limits, triggers etc etc |
| STORAGE_SIZE_ | Used to define various component allocated volumes size |
| SECRET_ | Used to define autogenerated secret |
| OUTPUT_ | Used to define calculated configuration parameters that are result of applying ops tasks against a running OpenServerless instance, if applies (APIHOST is one of them) |