Add one global provider type
See original GitHub issueexperiment-type
: a global JSON experiment key to assign to all providers type key.
Add a feature that can handle the “experiment-type” key in an experiment JSON file.
usage:
"version": "1.0.0",
"title": "a dummy test",
"description": "N/A",
"tags": [],
"experiment-type": "python", <- this is the additional key
"steady-state-hypothesis": {
"title": "a steady state hypo",
"probes": [
{
"type": "probe",
"name": "all_microservices_healthy",
"provider": { <- no need for type key
"module": "chaosk8s.probes",
"func": "all_microservices_healthy",
"arguments": {
"ns": "default"
}
},
"tolerance": "true"
}
]
},
"method": [
{
"type": "action",
"name": "kill_microservice",
"provider": { <- no need for type key
"module": "chaosk8s.actions",
"func": "kill_microservice",
"arguments": {
"name": "true",
"ns": "default",
"label_selector": "N"
}
}
}
]
}
Handling: After loading the experiment JSON file, a recursive function will run all over the keys of the experiment object (to ensure all providers will be assigned no matter what object holds it). Finding all the “provider” dictionaries and add them to the type value from the “experiment-type”. If a type already exists in the provider no assignment will occur (that you will be able to add a different type then the global). If some exception will happen (can’t see any now, but just in case), the function will return the original untouched experiment preserving the original missing type validation error. If an unsupported provider type will be passed, the validation will return the usual error message.
Note
This implementation probably should not be in chaostoolkit.cli
, just a demo to show the concept.
guess somewhere in chaostoolkit-lib
before the validation is happening.
This is the link to my fork with the changes I did. https://github.com/michael-gehtman-wix/chaostoolkit/pull/1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Hey folks, not a bad idea.
This would also require a change on the spec as I believe the
type
is mandatory.That said, your function could actually be a controller that is globally enabled so you wouldn’t even need to change the spec. Just make sure people use the bundle of controls you guys come up with.
That’s reasonable