chaostoolkit / chaostoolkit-lib

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

Allow configuring scalar parameters #180

Closed benpankow closed 3 years ago

benpankow commented 4 years ago

It would be nice to be able to configure qty or request_timeout parameters for my experiments using the Kubernetes driver. Unfortunately, current variable substitution only works in strings, and the driver does not accept strings as input for these parameters.

It would be helpful if actions/probes would be expected to cast string inputs for non-string parameters. Alternatively, the chaos lib could provide a way to substitute config/secret variables of other types, in particular floats.

davidh83110 commented 3 years ago

But if I configure the qty from env key, it won't be able to convert it to the correct type, all of the passing values will be string only.

    {
        "version": "1.0.0",
        "title": "Randomly kill pods by percentage",
        "description": "Randomly kill pods by percentage.",
        "configuration": {
          "target_terminate_percentage": {
            "type": "env",
            "key": "TARGET_KILL_PERCENTAGE"
          }
       }
    }
apiVersion: v1
kind: Secret
metadata:
  name: chaos-exp-env
  namespace: chaostoolkit-run
stringData:
  TARGET_KILL_PERCENTAGE: "50"
Lawouach commented 3 years ago

Unless i'm mistaken, environment variables are all strings.