chaostoolkit / chaostoolkit-lib

The Chaos Toolkit core library
https://chaostoolkit.org/
Apache License 2.0
77 stars 46 forks source link

Add dynamic config logic #247

Closed roeiK-wix closed 2 years ago

roeiK-wix commented 2 years ago

This is for loading a dynamic configuration if exists. The dynamic config is a regular activity (probe) in the configuration section. If there's a use-case for setting a configuration dynamically right before the experiment is starting. It executes the probe, and then the return value of this probe will be the config you wish to set. The dictionary needs to have a key named type and as a value probe alongside the rest of the probe props. (No need for the tolerance key).

For example:

    "some_dynamic_config": {
      "name": "some config probe",
      "type": "probe",
      "provider": {
        "type": "python",
        "module": "src.probes",
        "func": "config_probe",
        "arguments": {
            "arg1":"arg1"
        }
      }
    }

some_dynamic_config will be set with the return value of the function config_probe.

Side Note: the probe type can be the same as a regular probe can be, python, os, etc...

The config argument is the configurations with all the env vars configs that are already set. (So basically we can use the configuration that are injected from the environment in the config_probe arguments).

The secrets argument it's in case we need the secrets inside the config_probe.

Lawouach commented 2 years ago

Please rebase this branch from head of master and push again.