This page serves as a guide to develop either a new Chaos Chart or a new experiment in a Chaos Chart which are published at ChaosHub.
Below are some key points to remember before understanding how to write a new chart or an experiment.
Chaos Charts repository : https://github.com/litmuschaos/chaos-charts
Litmusbooks repository : https://github.com/litmuschaos/litmus/tree/master/experiments
Website rendering code repository: https://github.com/litmuschaos/charthub.litmuschaos.io
Chaos Libraries are written in Ansible programming language. To write new a Chaos Experiment, you need to know Ansible.
A group of Choas Experiments put together in a YAML file. This group or chart has metadata such as
ChaosExperiment is a CRD that specifies the nature of a Chaos Experiment. The YAML file that constitutes a Chaos Experiment CR is stored under a Chaos Chart of ChaosHub. An important parameter of a ChaosExperiment CR is the
Litmus book is an
ansible playbook that encompasses the logic of pre-checks, injecting actual chaos, post-checks and updating the result.
ansible programs inside Litmus books can make use of readily avaialble chaos functions. The chaos functions are available as
ansible functions which are wrapped in one of the chaos libraries. See plugins for more details.
Developing a Chaos Experiment
- Write a new Chaos Chart
- Write a new ChaosExperiment CR YAML
- Write a new Litmus Book
- Test the Chaos Experiment
- Update the documentation
See an example of developing chaos chart for
newApp with a new chaos experiment called
Write a new Chaos Chart
Untar new-chart.tar.gz available in the root folder of the repository.
If you are naming your chart as
newApp, replace all instances of
If you are naming your experiment as
replica-kill, replace all instances of
newApp chaos chart is ready. Next step is to update and verify CR YAML for
Write a new ChaosExperiment CR YAML
If you have extracted or untarred
new-chart.tar.gz, you will have the required templace YAMLs for Chaos Experiment as well. Follow the below steps to prepare your chaos experiment
- Update the reference to Limus
Write a new Litmus Book
Update the documentation
Documentation for your new chart and experiment have to be updated at chaoshub
The below video shows the example creation of
newExp for an application called