Package: chaostoolkit-lib
Chaos Toolkit - Chaos Engineering for EveryoneCommunity•ChangeLogPurposeThe purpose of this library is to provide the core of the Chaos Toolkitmodeland functions it needs to render its services.FeaturesThe library provides the followings features:discover capabilities from extensions
Allows you to explore the support from an extension that would help you
initialize an experiment against the system this extension targetsvalidate a given experiment syntax
The validation looks at various keys in the experiment and raises errors
whenever something doesn't look right.
As a nice addition, when a probe calls a Python function with arguments,
it tries to validate the given argument list matches the signature of the
function to apply.run your steady state before and after the method. The former as a gate to
decide if the experiment can be executed. The latter to see if the system
deviated from normal.run probes and actions declared in an experiment
It runs the steps in a experiment method sequentially, applying first steady
probes, then actions and finally close probes.A journal, as a JSON payload, is return of the experiment run.The library supports running probes and actions defined as Python functions,
from importable Python modules, processes and HTTP calls.run experiment's rollbacks when providedLoad secrets from the experiments, the environ orvaultProvides event notification from Chaos Toolkit flow (although the actual
events are published by the CLI itself, not from this library), supported
events are:on experiment validation: started, failed or completedon discovery: started, failed or completedon initialization of experiments: started, failed or completedon experiment runs: started, failed or completedFor each event, the according payload is part of the event as well as a UTC
timestamp.InstallIf you are user of the Chaos Toolkit, you probably do not need to install this
package yourself as it comes along with thechaostoolkit cli.However, should you wish to integrate this library in your own Python code,
please install it as usual:$ pip install -U chaostoolkit-libSpecific dependenciesIn addition to essential dependencies, the package can install a couple of
other extra dependencies for specific use-cases. They are not mandatory and
the library will warn you if you try to use a feature that requires them.VaultIf you needVaultsupport to read secrets from, run the following
command:$ pip install -U chaostoolkit-lib[vault]To authenticate with Vault, you can either:Use a token through thevault_tokenconfiguration keyUse anAppRolevia thevault_role_id,vault_secret_idpair of configuration keysUse aservice accountconfigured with an appropriaterolevia thevault_sa_roleconfiguration key. Thevault_sa_token_path,vault_k8s_mount_point, andvault_secrets_mount_pointconfiguration keys can optionally be specified to point to a location containing a service accounttoken, a different Kubernetes authentication methodmount point, or a different secretsmount point, respectively.JSON PathIf you needJSON Path supportfor tolerance probes in the hypothesis,
also run the following command:$ pip install -U chaostoolkit-lib[jsonpath]ContributeContributors to this project are welcome as this is an open-source effort that
seeksdiscussionsand continuous improvement.From a code perspective, if you wish to contribute, you will need to run a
Python 3.6+ environment. Please, fork this project, write unit tests to cover
the proposed changes, implement the changes, ensure they meet the formatting
standards set out byblack,flake8, andisort, add an entry intoCHANGELOG.md, and then raise a PR to the repository for review.Please refer to theformattingsection for more
information on the formatting standards.The Chaos Toolkit projects require all contributors must sign aDeveloper Certificate of Originon each commit they would like to merge
into the master branch of the repository. Please, make sure you can abide by
the rules of the DCO before submitting a PR.DevelopIf you wish to develop on this project, make sure to install the development
dependencies. To do so, first installpdm.$pdminstall--devNow, you can edit the files and they will be automatically be seen by your
environment, even when running from thechaoscommand locally.TestTo run the tests for the project execute the following:$ pdm run testFormatting and LintingWe useruffto perform linting and code style.Before raising a Pull Request, we recommend you run formatting against your
code with:$pdmrunformatThis will automatically format any code that doesn't adhere to the formatting
standards.As some things are not picked up by the formatting, we also recommend you run:$pdmrunlintTo ensure that any unused import statements/strings that are too long, etc.
are also picked up.