This page serves as a guide to develop either a new ChaosChart or a new experiment in a ChaosChart which are published at ChaosHub.
Below are some key points to remember before understanding how to write a new chart or an experiment.
ChaosCharts repository : https://github.com/litmuschaos/chaos-charts
Litmus-Go repository : https://github.com/litmuschaos/litmus-go/tree/master/experiments
Website rendering code repository: https://github.com/litmuschaos/charthub.litmuschaos.io
The experiments & chaos libraries are typically written in Go, though not mandatory. Ensure that the experiments can be executed in a container & can read/update the litmuschaos custom resources. For example, if you are writing an experiment in Go, use this clientset. Litmus Experiment contains the logic of pre-checks, chaos-injection, litmus-probes, post-checks, and result-updates. Typically, these are accompanied by a Kubernetes job that can execute the respective experiment.
A group of ChaosExperiments put together in a YAML file. Each group or chart has a metadata manifest called
that holds data such as
links etc.., This metadata is rendered on the ChartHub.
A ChaosChart also consists of a
package manifest that is an index of available experiments in the chart.
ChaosExperiment is a CRD that specifies the nature of a ChaosExperiment. The YAML file that constitutes a ChaosExperiment CR is stored under a ChaosChart of ChaosHub and typically consists of low-level chaos parameters specific to that experiment, set to their default values.
Here is an example chaos experiment CR for a pod-delete experiment
Developing a ChaosExperiment
A detailed how-to guide on developing chaos experiments is available here