chaostoolkit / chaostoolkit-lib

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

Separate rollback from action #157

Closed hyder closed 3 years ago

hyder commented 4 years ago

Hi,

Is it possible to distinguish rollbacks from actions? Currently, when I'm choosing actions, the list of rollback actions are displayed. Likewise for when choosing rollbacks, the list of actions is displayed.

Many thanks

russmiles commented 4 years ago

Hi @hyder,

Is this question related to using chaos init? If it is then this is interesting as currently actions do not imply they are for rollbacks or the method (or for the steady-state hypothesis for that matter, although that block usually only contains probes).

hyder commented 4 years ago

Hi,

Yes. This is when using chaos init. Sorry I should have been clearer in my question.

So, when selection an experimental method, because currently there's no way to distinguish between an experimental method or a rollback, all actions, including rollbacks, are displayed at the time of choosing the method. Likewise, when selecting a rollback, the list of experimental methods are also displayed.

It would be great if we can distinguish between the 2.

russmiles commented 4 years ago

It is a very interesting requirements, and I can certainly see it being useful. The challenge at the moment is that the chaos toolkit does not have any way of identifying actions as being useful for method or rollbacks specifically. Technically, any action could be useful in either case, which is why you see all actions for both. Some actions are naturally better-suited as rollbacks though, but at the moment the extensions (where actions are implemented, such as the Kubernetes extension here: ) do not imply that an action could be best used in the method or the rollbacks. This type of hint could be made, without breaking the current API, but it would have to be carefully thought through to make sure that there was a way of seeing the "recommended" rollback actions, as well as the full list just in case an action that was deemed more likely to be used in a method was able to be applied as a rollback action if needed?

hyder commented 4 years ago

Understood. Just checking my understanding is correct and I have not made a coding mistake for the extension I'm experimenting with (still learning).

Being able to distinguish between methods and rollbacks can greatly help improve the user experience, particularly for extensions with a large number of modules. It would be nice also at the time of selecting probes/methods/rollbacks, one is able to choose from a list of modules first before picking the actual probes/methods/rollbacks.

e.g. in the kubernetes extension, there are currently the following modules: node, pod, service, statefulset.

Instead of returning the full list of probes first, it would be nice if we can select one of the above module, say pod. This then filters the list of probes available for pods only e.g. read_pod_logs, pods_in_phase, pods_in_conditions etc. Likewise, when selecting methods/rollbacks.

Extending this idea a bit further, when defining an experiment, select the module > select available probe from module > select available action from module > select available roll_back from module.

Essentially, I'm suggesting a sort of navigation capability when creating the experiment.

Many thanks again for your detailed explanations.

russmiles commented 4 years ago

Thank you for your well-thought-out ideas! @Lawouach, does this sound like a good candidate to enter the process of discussion with the broader community, as it would perhaps represent something of an adjustment of meaning of the modules/functions that an extension could provide?

Lawouach commented 4 years ago

Hello,

I can certainly see the need considering that chaos init is trivially way too basic and has a rather limited UX. So, we could improve there first already.

However, I am not clear how an extension could signal an action is meant for a method or a rollback to be fair. It's really depending on your experiment. It certainly sounds logical to consider one terminates a thing and then start it again. But, one might argue, as Chaos Engineering grows, more exotic scenarios might come to the fore.

That's the crux of the issue, chaos init simply draws its list from the extensions but extension authors cannot decide for you if it's rollback material or method material.

Maybe, it comes to a bigger need of a meta registry (as a public catalog) of known actions that we could then tag as this or that?

hyder commented 4 years ago

Hi,

In https://github.com/chaostoolkit/chaostoolkit-lib/blob/master/chaoslib/types.py, an activity is currently either a probe or an action. So, perhaps a 3rd type (rollback) can be added?

Then in https://github.com/chaostoolkit/chaostoolkit-lib/blob/master/chaoslib/discovery/discover.py, a corresponding function (discover_rollback) can similarly be added.

Extension developers can then decide whether a particular activity is a probe, an action or a rollback and they can add their rollbacks in a rollbacks.py in the module. The rollbacks can then be loaded into the activities list just like probes and actions:

activities.extend(discover_probes("chaos<extension>.<module>.probes")) activities.extend(discover_actions("chaos<extension>.<module>.actions")) activities.extend(discover_rollbacks("chaos<extension>.<module>.rollbacks"))

What do you think? Is this reasonable?

github-actions[bot] commented 3 years ago

This Issue has not been active in 365 days. To re-activate this Issue, remove the Stale label or comment on it. If not re-activated, this Issue will be closed in 7 days.

github-actions[bot] commented 3 years ago

This Issue was closed because it was not reactivated after 7 days of being marked Stale.