- This repo consists of Litmus Chaos Experiments written in python. The examples in this repo are good indicators of how to construct the experiments in python: complete with steady state checks, chaosresult generation, chaos injection, post chaos checks, create events and reports for observability and configure sinks for these.
NOTE
- This repo can be viewed as an extension to the litmuschaos/litmus repo. The litmus repo will also continue to be the project's community-facing meta repo housing other important project artifacts. In that sense, litmus-py is very similar to and therefore a sister repo of litmus-go which houses examples for experiment business logic written in go.
The Litmus SDK provides a simple way to bootstrap your experiment and helps create the aforementioned artifacts in the appropriate directory (i.e., as per the chaos-category) based on an attributes file provided as input by the chart-developer. The scaffolded files consist of placeholders which can then be filled as desired.
It generates the custom chaos experiments with some default Pre & Post Chaos Checks (AUT & Auxiliary Applications status checks). It can use the existing chaoslib (present inside /chaoslib directory), if available else It will create a new chaoslib inside the corresponding directory.
Refer Litmus-SDK for more details
Litmus-Python chaos experiments are fundamental units within the LitmusChaos architecture. Users can choose between readily available chaos experiments or create new ones to construct a required Chaos Workflow.
To know more about LitmusChaos experiments refer to this.
- Experiment business logic image has to be updated in
spec.definition.image
along with experiment entrypoint and tunable parameters in ChaosEngine (CR) which holds experiment-specific chaos parameters. ChaosExperiment is created by chaos runner which is managed by chaos operator Refer litmus-python pod-delete experiment - Chaos Engine holds experiment-specific parameters. This CR is also updated/patched with the status of the chaos experiments, making it the single source of truth concerning the chaos.
- Now we need to fit Experiment and Engine into the workflow, Chaos Workflow is a set of different operations coupled together to achieve desired chaos impact on a Kubernetes Cluster. LitmusChaos leverages the popular workflow & GitOps tool, Argo, to achieve this.
- Add experiment manifest in
install-experiment
artifacts and engine inrun-chaos
artifacts. - Follow the steps in pod-delete workflow or User guide
- Add experiment manifest in
- Now fork and clone chaos-charts, Enter into workflow directory.
- Workflow can be added as a predefined workflow in Github and users can test by following the given steps:
- Fork and clone chaos-charts, now Enter into workflow directory.
- Follow the same structure for your workflow and push it. For example
- Connect your Git repository with chaos-center ChaosHub
- Schedule your workflow with chaos-center in given manner, by selecting your connected ChaosHub
- To Run your first workflow follow the step-by-step guidelines.
- After scheduling it one can observe the workflow
- To Analyze the workflow follow these guidelines
- Now User can setup own Observablity and Compare it with other scheduled workflows with the help of monitoring dashboard
- It can be scheduled for repeated execution.
- Select edit Schedule to schedule recurrent workflow by selecting proper timing.
- Refer manifest manifest.
Refer the LitmusChaos documentation litmus docs
You can contribute by raising issues, improving the documentation, contributing to the core framework and tooling, etc.
Head over to the Contribution guide