diff --git a/404.html b/404.html index 830a84cd..9a5eb6fd 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -

404 - Not found

\ No newline at end of file +

404 - Not found

\ No newline at end of file diff --git a/deployment/k8s/operator/index.html b/deployment/k8s/operator/index.html index c60ff60b..8e91d387 100644 --- a/deployment/k8s/operator/index.html +++ b/deployment/k8s/operator/index.html @@ -1,4 +1,4 @@ - Operator -
Skip to content

Deploy Chaos Toolkit as a Kubernetes Operator

Kubernetes operators are a popular approach to create bespoke controllers of any application on top of the Kubernetes API.

The Chaos Toolkit operator listens for experiment declarations and triggers a new Kubernetes pod, running the Chaos Toolkit with the specified experiment.

Deploy the operator

The operator can be found on the Chaos Toolkit incubator.

It is deployed via typical Kubernetes manifests which need to be applied via Kustomize, the native configuration manager.

First, download the Kustomize binary:

curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
+ Operator -      

Deploy Chaos Toolkit as a Kubernetes Operator

Kubernetes operators are a popular approach to create bespoke controllers of any application on top of the Kubernetes API.

The Chaos Toolkit operator listens for experiment declarations and triggers a new Kubernetes pod, running the Chaos Toolkit with the specified experiment.

Deploy the operator

The operator can be found on the Chaos Toolkit incubator.

It is deployed via typical Kubernetes manifests which need to be applied via Kustomize, the native configuration manager.

First, download the Kustomize binary:

curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
 

For macOS, you can also install it via the Homebrew package manager:

brew install kustomize
 

Next, simply run the following:

kustomize build manifests/overlays/generic-rbac | kubectl apply -f -
 

This will build the manifests and apply them on your current default cluster. Notice how we use the RBAC variant of the deployment. If you have other requirements (no-RBAC, pod security or network policies), then check the operator’s documentation to deploy the appropriate variant.

You can install another variant as follows:

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl apply -f -
@@ -284,4 +284,4 @@
   pod:
     image: my/chaostoolkit
 

Tip

Note that the first time the job will create a pod will be at the end of the first period.

Uninstall the operator

To uninstall the operator and its own resources, simply run the following command for the overlay that is deployed.

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl delete -f -
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/addons/index.html b/drivers/addons/index.html index 2065fe69..da4ecdbf 100644 --- a/drivers/addons/index.html +++ b/drivers/addons/index.html @@ -1,4 +1,4 @@ - Common -
Skip to content

Extension chaosaddons

Version 0.8.6
Repository https://github.com/chaostoolkit/chaostoolkit-addons

This project provides a set of commnly requested actions, probes, tolerances or controls that can benefit the community.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-addons
+ Common -      

Extension chaosaddons

Version 0.8.6
Repository https://github.com/chaostoolkit/chaostoolkit-addons

This project provides a set of commnly requested actions, probes, tolerances or controls that can benefit the community.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-addons
 

Develop

Test

To run the tests for the project execute the following:

$ pytest
 

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

Exported Controls

bypass

Sets the dry property on activities that match either by type or by names.

This allows to bypass some activities in certain contexts. For instance, you want to run on development but not in production certain actions.

For instance, to bypass the execution of the say-hello activity:

"controls": [
         {
@@ -157,4 +157,4 @@
   module: chaosaddons.utils.idle
   type: python
 type: ''
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/ansible/index.html b/drivers/ansible/index.html index 49460085..960f9abe 100644 --- a/drivers/ansible/index.html +++ b/drivers/ansible/index.html @@ -1,4 +1,4 @@ - Ansible -
Skip to content

Extension chaosansible

Version IN_PROGESS
Repository https://github.com/Mickael-Roger/chaostoolkit-ansible

Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Please NOTE This extension is in the early stages of development. Please feel free to create an issue in case of needed enhancement or misfunctioning.


Ansible Icon


Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

pip install -U chaostoolkit-ansible
+ Ansible -      

Extension chaosansible

Version IN_PROGESS
Repository https://github.com/Mickael-Roger/chaostoolkit-ansible

Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Please NOTE This extension is in the early stages of development. Please feel free to create an issue in case of needed enhancement or misfunctioning.


Ansible Icon


Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

pip install -U chaostoolkit-ansible
 

Principles

This chaos toolkit driver provides you an easy way to execute probe and/or actions using ansible modules. By using it, you can execute tasks, gather facts, … on remote systems

Usage

Basic

Probes

To use the probes from this package, add the following to your experiment file:

In JSON:

"steady-state-hypothesis": {
     "title": "Tests",
     "probes": [
@@ -253,4 +253,4 @@
   module: chaosansible.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/aws/index.html b/drivers/aws/index.html index b02ba2e3..6c2e8e29 100644 --- a/drivers/aws/index.html +++ b/drivers/aws/index.html @@ -1,4 +1,4 @@ - AWS -
Skip to content

Extension chaosaws

Version 0.23.4
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-aws

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-aws
+ AWS -      

Extension chaosaws

Version 0.23.4
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-aws

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-aws
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
     "name": "stop-an-ec2-instance",
     "provider": {
@@ -3587,4 +3587,4 @@
   module: chaosaws.xray.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/azure/index.html b/drivers/azure/index.html index 2bc558e5..e54ebe6d 100644 --- a/drivers/azure/index.html +++ b/drivers/azure/index.html @@ -1,4 +1,4 @@ - Azure -
Skip to content

Extension chaosazure

Version 0.16.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-azure

Build Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Azure platform.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-azure
+ Azure -      

Extension chaosazure

Version 0.16.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-azure

Build Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Azure platform.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-azure
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
   "type": "action",
   "name": "start-service-factory-chaos",
@@ -1307,4 +1307,4 @@
   module: chaosazure.webapp.actions
   type: python
 type: action
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/cloudfoundry/index.html b/drivers/cloudfoundry/index.html index 049844f2..111101ae 100644 --- a/drivers/cloudfoundry/index.html +++ b/drivers/cloudfoundry/index.html @@ -1,4 +1,4 @@ - Cloud Foundry -
Skip to content

Extension chaoscf

Version 0.7.3
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-cloud-foundry

Build Status Python versions Requirements Status Has wheel

This extension package provides probes and actions for Chaos Engineering experiments against a Cloud Foundry instance using the Chaos Toolkit.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-cloud-foundry
+ Cloud Foundry -      

Extension chaoscf

Version 0.7.3
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-cloud-foundry

Build Status Python versions Requirements Status Has wheel

This extension package provides probes and actions for Chaos Engineering experiments against a Cloud Foundry instance using the Chaos Toolkit.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-cloud-foundry
 

Usage

To use the probes and actions from this package, add a similar payload to your experiment file:

{
     "type": "action",
     "name": "terminate-random-instance",
@@ -641,4 +641,4 @@
   module: chaoscf.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/datadog/index.html b/drivers/datadog/index.html index 48d61299..2d4571da 100644 --- a/drivers/datadog/index.html +++ b/drivers/datadog/index.html @@ -1,4 +1,4 @@ - DataDog -
Skip to content

Extension chaosdatadog

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-datadog

Version License

Build, Test, and Lint Python versions

This project contains Chaos Toolkit activities and tolerances to work with DataDog.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-datadog
+ DataDog -      

Extension chaosdatadog

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-datadog

Version License

Build, Test, and Lint Python versions

This project contains Chaos Toolkit activities and tolerances to work with DataDog.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-datadog
 

Usage

A typical experiment using this extension would look like this:

{
     "version": "1.0.0",
     "title": "Run a, experiment using a DataDog SLO to verify our system",
@@ -162,4 +162,4 @@
       type: tolerance
     type: probe
   title: '...'
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/dynatrace/index.html b/drivers/dynatrace/index.html index cdd6763f..99c6dc3e 100644 --- a/drivers/dynatrace/index.html +++ b/drivers/dynatrace/index.html @@ -1,4 +1,4 @@ - Dynatrace -
Skip to content

Extension chaosdynatrace

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-dynatrace

Build

Dynatrace support for the Chaos Toolkit.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-dynatrace
+ Dynatrace -      

Extension chaosdynatrace

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-dynatrace

Build

Dynatrace support for the Chaos Toolkit.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-dynatrace
 

Usage

To use this package, you must have access to a Dynatrace instance via DynatraceApi and be allowed to connect to it.

the access credentials to the api must be specified in the configuration section

{
 
     "configuration": {
@@ -209,4 +209,4 @@
   module: chaosdynatrace.timeseries.v1.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/gandi/index.html b/drivers/gandi/index.html index 67f3c729..8176b82a 100644 --- a/drivers/gandi/index.html +++ b/drivers/gandi/index.html @@ -1,4 +1,4 @@ - Gandi -
Skip to content

Extension chaosgandi

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-gandi

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-gandi
+ Gandi -      

Extension chaosgandi

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-gandi

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-gandi
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
     "version": "1.0.0",
     "title": "Our domains are not going expiring within a month",
@@ -124,4 +124,4 @@
   module: chaosgandi.domains.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/gcp/index.html b/drivers/gcp/index.html index 088f3bf6..c970e542 100644 --- a/drivers/gcp/index.html +++ b/drivers/gcp/index.html @@ -1,4 +1,4 @@ - Google Cloud Platform -
Skip to content

Extension chaosgcp

Version 0.10.1
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Google Cloud Platform.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install --prefer-binary -U chaostoolkit-google-cloud-platform
+ Google Cloud Platform -      

Extension chaosgcp

Version 0.11.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Google Cloud Platform.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install --prefer-binary -U chaostoolkit-google-cloud-platform
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
     "version": "1.0.0",
     "title": "create and delete a cloud run service",
@@ -787,7 +787,7 @@
   module: chaosgcp.gke.nodepool.actions
   type: python
 type: action
-

lb


inject_traffic_delay

Type action
Module chaosgcp.lb.actions
Name inject_traffic_delay
Return mapping

Add/set delay for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

For instance:

{
+

lb


inject_traffic_delay

Type action
Module chaosgcp.lb.actions
Name inject_traffic_delay
Return mapping

Add/set delay for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

For instance:

{
     "type: "action",
     "name": "add-delay-to-home-page",
     "provider": {
@@ -837,7 +837,7 @@
   module: chaosgcp.lb.actions
   type: python
 type: action
-

inject_traffic_faults

Type action
Module chaosgcp.lb.actions
Name inject_traffic_faults
Return mapping

Add/set HTTP status codes for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

For instance:

{
+

inject_traffic_faults

Type action
Module chaosgcp.lb.actions
Name inject_traffic_faults
Return mapping

Add/set HTTP status codes for a percentage of requests going through a url map on a given path.

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

For instance:

{
     "type: "action",
     "name": "return-503-from-home-page",
     "provider": {
@@ -849,7 +849,7 @@
   "target_name": "allpaths",
   "target_path": "/*",
   "impacted_percentage": 75.0,
-  "configuration": 503,
+  "http_status": 503,
    }
     }
 }
@@ -1214,4 +1214,4 @@
   module: chaosgcp.storage.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/grafana/index.html b/drivers/grafana/index.html index c6bdd38a..65644432 100644 --- a/drivers/grafana/index.html +++ b/drivers/grafana/index.html @@ -1,4 +1,4 @@ - Grafana -
Skip to content

Extension chaosgrafana

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-grafana

Version License

Build codecov Python versions

This project should be used as a starting point to create your own Chaos Toolkit extension.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-grafana
+ Grafana -      

Extension chaosgrafana

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-grafana

Version License

Build codecov Python versions

This project should be used as a starting point to create your own Chaos Toolkit extension.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-grafana
 

Usage

Sending Chaos Toolkit logs to Loki

To send the Chaos Toolkit logs to Loki endpoints, you need to enable the according control as follows:

{
     "secrets": {
         "grafana": {
@@ -39,4 +39,4 @@
   provider:
     module: chaosgrafana.controls.loki
     type: python
-

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

Exported Activities

controls

\ No newline at end of file +

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

Exported Activities

controls

\ No newline at end of file diff --git a/drivers/humio/index.html b/drivers/humio/index.html index 68ba343a..61ae9425 100644 --- a/drivers/humio/index.html +++ b/drivers/humio/index.html @@ -1,4 +1,4 @@ - Humio -
Skip to content

Extension chaoshumio

Version 0.6.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-humio

Build, Test, and Lint Python versions

This project is an extension for the Chaos Toolkit to target Humio.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-humio
+ Humio -      

Extension chaoshumio

Version 0.6.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-humio

Build, Test, and Lint Python versions

This project is an extension for the Chaos Toolkit to target Humio.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-humio
 

Humio Token

To use this extension, you will need one piece of information from Humio, the API token for a user.

Usage

This extension can be used a control on the experiment or a notification plugin of the Chaos Toolkit CLI itself. Usually, only one of these two methods is used at any given time as they serve similar purpose but feel free to combine them. The control approach is deeper because it logs down to the activity whereas notifications are much higher level.

This extension can also be used as a probe to fetch information from Humio.

Query Log Events

To use this extension as a probe as part of your experiment, use it as follows:

{
   "configuration": {
     "humio_url": {
@@ -295,4 +295,4 @@
       type: tolerance
     type: probe
   title: '...'
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/istio/index.html b/drivers/istio/index.html index 92bfb38b..8829c328 100644 --- a/drivers/istio/index.html +++ b/drivers/istio/index.html @@ -1,4 +1,4 @@ - Istio -
Skip to content

Extension chaosistio

Version 0.3.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-istio

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-istio
+ Istio -      

Extension chaosistio

Version 0.3.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-istio

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-istio
 

Usage

Below is an example of using this extension to inject a delay of 5 seconds to a specific user.

Note this example can be applied against the bookinfo Istio sample application.

To run it, simple set the KUBERNETES_CONTEXT environment variable to the target cluster and ensure your local kubeconfig is properly populated for that context. Set also the PRODUCT_PAGE_SERVICE_BASE_URL to the address of the Istio gateway.

For instance:

$ export PRODUCT_PAGE_SERVICE_BASE_URL=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
 
{
     "title": "Network latency does not impact our users",
@@ -315,4 +315,4 @@
   module: chaosistio.fault.actions
   type: python
 type: action
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/k6/index.html b/drivers/k6/index.html index 6a52a9db..b3c6e95a 100644 --- a/drivers/k6/index.html +++ b/drivers/k6/index.html @@ -1,4 +1,4 @@ - k6 -
Skip to content

Extension chaosk6

Version 0.2.0
Repository https://github.com/k6io/chaostoolkit-k6

N/A

Exported Activities

actions


run_script

Type action
Module chaosk6.actions
Name run_script
Return None

Run an arbitrary k6 script with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 ± 50.

– scriptPath : str Full path to the k6 test script vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def run_script(scriptPath: str = None, vus: int = 1, duration: str = '1s'):
+ k6 -      

Extension chaosk6

Version 0.2.0
Repository https://github.com/k6io/chaostoolkit-k6

N/A

Exported Activities

actions


run_script

Type action
Module chaosk6.actions
Name run_script
Return None

Run an arbitrary k6 script with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 ± 50.

– scriptPath : str Full path to the k6 test script vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def run_script(scriptPath: str = None, vus: int = 1, duration: str = '1s'):
     pass
 

Arguments:

Name Type Default Required
scriptPath string null No
vus integer 1 No
duration string “1s” No

Usage:

{
   "name": "run-script",
@@ -62,4 +62,4 @@
   module: chaosk6.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/kubernetes/index.html b/drivers/kubernetes/index.html index b5fa34be..4e5a60f4 100644 --- a/drivers/kubernetes/index.html +++ b/drivers/kubernetes/index.html @@ -1,4 +1,4 @@ - Kubernetes -
Skip to content

Extension chaosk8s

Version 0.28.0
Repository https://github.com/chaostoolkit/chaostoolkit-kubernetes

Build Status Python versions Downloads

This project contains activities, such as probes and actions, you can call from your experiment through the Chaos Toolkit to perform Chaos Engineering against the Kubernetes API: killing a pod, removing a statefulset or node…

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kubernetes
+ Kubernetes -      

Extension chaosk8s

Version 0.28.0
Repository https://github.com/chaostoolkit/chaostoolkit-kubernetes

Build Status Python versions Downloads

This project contains activities, such as probes and actions, you can call from your experiment through the Chaos Toolkit to perform Chaos Engineering against the Kubernetes API: killing a pod, removing a statefulset or node…

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kubernetes
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
     "title": "Do we remain available in face of pod going down?",
     "description": "We expect Kubernetes to handle the situation gracefully when a pod goes down",
@@ -1755,4 +1755,4 @@
   module: chaosk8s.statefulset.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/opentracing/index.html b/drivers/opentracing/index.html index 0e58507a..0bb1e3c8 100644 --- a/drivers/opentracing/index.html +++ b/drivers/opentracing/index.html @@ -1,4 +1,4 @@ - Open Tracing/OpenTelemetry -
Skip to content

Extension chaostracing

Version 0.13.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing

Release Python versions

This project is an extension for the Chaos Toolkit for OpenTracing and OpenTelemetry.

Here is an example of what it could look like with the Jaeger backend.

OpenTracing

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-opentracing
+ Open Tracing/OpenTelemetry -      

Extension chaostracing

Version 0.13.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing

Release Python versions

This project is an extension for the Chaos Toolkit for OpenTracing and OpenTelemetry.

Here is an example of what it could look like with the Jaeger backend.

OpenTracing

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-opentracing
 

Usage

This extension provides two controls to trace your Chaos Toolkit experiment:

  • Open Telemetry
  • Open Tracing (legacy)

The only supported one is Open Telemetry as the Open Tracing is no longer maintained.

Open Telemetry

To enable Open Telemetry tracing, simply add the following control to your experiment:

{
     "controls": [
       {
@@ -159,4 +159,4 @@
   provider:
     module: chaostracing.oltp
     type: python
-

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

Exported Activities

control

metrics

oltp

\ No newline at end of file +

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

Exported Activities

control

metrics

oltp

\ No newline at end of file diff --git a/drivers/overview/index.html b/drivers/overview/index.html index d49affb2..e6088090 100644 --- a/drivers/overview/index.html +++ b/drivers/overview/index.html @@ -1 +1 @@ - Overview -
Skip to content

Drivers Overview

Chaos Toolkit drivers extend the toolkit to be able to cause chaos and probe different types of systems.

\ No newline at end of file + Overview -
Skip to content

Drivers Overview

Chaos Toolkit drivers extend the toolkit to be able to cause chaos and probe different types of systems.

\ No newline at end of file diff --git a/drivers/pixie/index.html b/drivers/pixie/index.html index 60a15a9c..77a64f98 100644 --- a/drivers/pixie/index.html +++ b/drivers/pixie/index.html @@ -1,4 +1,4 @@ - Pixie -
Skip to content

Extension chaospixie

Version 0.1.1
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-pixie

Version License Build, Test, and Lint Python versions

This extension allows you to run Pixie script during your experiments.

Install

This package requires Python 3.8+ as Pixie’s dependency requires it.

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-pixie
+ Pixie -      

Extension chaospixie

Version 0.1.1
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-pixie

Version License Build, Test, and Lint Python versions

This extension allows you to run Pixie script during your experiments.

Install

This package requires Python 3.8+ as Pixie’s dependency requires it.

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-pixie
 

Usage

This extension provides two probes to run Pixie scripts, either directly embedded into the experiment or in a file local to the experiment.

For instance, a complete script:

{
     "version": "1.0.0",
     "title": "Consumer service remains fast under higher traffic load",
@@ -379,4 +379,4 @@
       type: tolerance
     type: probe
   title: '...'
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/prometheus/index.html b/drivers/prometheus/index.html index 25e92ce1..a36c9a52 100644 --- a/drivers/prometheus/index.html +++ b/drivers/prometheus/index.html @@ -1,4 +1,4 @@ - Prometheus -
Skip to content

Extension chaosprometheus

Version 0.5.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-prometheus

Version License Build Python versions

Prometheus support for the Chaos Toolkit.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-prometheus
+ Prometheus -      

Extension chaosprometheus

Version 0.5.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-prometheus

Version License Build Python versions

Prometheus support for the Chaos Toolkit.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-prometheus
 

Usage

To use this package, you must create have access to a Prometheus instance via HTTP and be allowed to connect to it.

This package only exports probes to query for some aspects of your system as monitored by Prometheus.

Here is an example of querying Prometheus at a given moment

{
     "type": "probe",
     "name": "fetch-cpu-just-2mn-ago",
@@ -162,4 +162,4 @@
   module: chaosprometheus.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/reliably/index.html b/drivers/reliably/index.html index e8ada4e5..754e9aec 100644 --- a/drivers/reliably/index.html +++ b/drivers/reliably/index.html @@ -1,4 +1,4 @@ - Reliably -
Skip to content

Extension chaosreliably

Version 0.64.0+editable
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-reliably

Version Python versions License Build

Chaos Toolkit extension for Reliably.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-reliably
+ Reliably -      

Extension chaosreliably

Version 0.66.0+editable
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-reliably

Version Python versions License Build

Chaos Toolkit extension for Reliably.

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-reliably
 

Authentication

To use this package, you must create have registered with Reliably services.

Then you need to set some environment variables as secrets.

  • RELIABLY_TOKEN: the token to authenticate against Reliably’s API
  • RELIABLY_HOST:: the hostname to connect to, default to app.reliably.com
{
     "secrets": {
         "reliably": {
@@ -1235,4 +1235,4 @@
   module: chaosreliably.controls.capture.slack
   type: python
 type: ''
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/service-fabric/index.html b/drivers/service-fabric/index.html index d4f1bf28..1198d165 100644 --- a/drivers/service-fabric/index.html +++ b/drivers/service-fabric/index.html @@ -1,4 +1,4 @@ - Service Fabric -
Skip to content

Extension chaosservicefabric

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-service-fabric

Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Service Fabric platform.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-service-fabric
+ Service Fabric -      

Extension chaosservicefabric

Version 0.2.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-service-fabric

Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Service Fabric platform.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-service-fabric
 

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
     "type": "action",
     "name": "start-service-factory-chaos",
@@ -194,4 +194,4 @@
   module: chaosservicefabric.cluster.actions
   type: python
 type: action
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/slack/index.html b/drivers/slack/index.html index fef3e97d..5b81458a 100644 --- a/drivers/slack/index.html +++ b/drivers/slack/index.html @@ -1,4 +1,4 @@ - Slack -
Skip to content

Extension chaosslack

Version 0.7.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-slack

Build

This project is an extension for the Chaos Toolkit to target Slack.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-slack
+ Slack -      

Extension chaosslack

Version 0.7.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-slack

Build

This project is an extension for the Chaos Toolkit to target Slack.

Install

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-slack
 

Slack App

To use this extension, you need to create a Slack app in your workspace. Please follow the Slack documentation to create a basic app:

https://api.slack.com/apps?new_app=1 https://api.slack.com/tutorials

You can start from this manifest if you want:

display_information:
   name: Chaos Toolkit events
   long_description: Get live feedback information of all your Chaos Engineering
@@ -108,4 +108,4 @@
   module: chaosslack.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/spring/index.html b/drivers/spring/index.html index bedd4285..6a7a317b 100644 --- a/drivers/spring/index.html +++ b/drivers/spring/index.html @@ -1,4 +1,4 @@ - Spring -
Skip to content

Extension chaosspring

Version 0.3.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-spring

Python versions Build Status

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-spring
+ Spring -      

Extension chaosspring

Version 0.3.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-spring

Python versions Build Status

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-spring
 

Usage

Currently this driver supports interactions with a Spring Boot-based service that has included the 2.0.0.-SNAPSHOT release of the Chaos Monkey for Spring Boot. This snapshot includes the necessary Spring Boot Actuator HTTP endpoints so that the Chaos Toolkit to interact with the chaos features at runtime.

Once you have added the Chaos Monkey for Spring Boot and enabled the Spring Boot Actuator HTTP endpoints you can then use the probes and actions from this driver.

To use the probes and actions from this package, add the following to your experiment file:

{
     "name": "enable_chaosmonkey",
     "provider": {
@@ -216,4 +216,4 @@
   module: chaosspring.probes
   type: python
 type: probe
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/terraform/index.html b/drivers/terraform/index.html index 0d26fe7c..c55d09f3 100644 --- a/drivers/terraform/index.html +++ b/drivers/terraform/index.html @@ -1,4 +1,4 @@ - Extension chaosterraform -
Skip to content

Extension chaosterraform

Version 0.0.9
Repository https://github.com/mcastellin/chaostoolkit-terraform

A Chaos Toolkit driver to extend chaos experiments with Terraform

Package Installation

From Python package index

To install the latest chaostoolkit-terraform stable release:

pip install -U chaostoolkit-terraform
+ Extension chaosterraform -      

Extension chaosterraform

Version 0.0.9
Repository https://github.com/mcastellin/chaostoolkit-terraform

A Chaos Toolkit driver to extend chaos experiments with Terraform

Package Installation

From Python package index

To install the latest chaostoolkit-terraform stable release:

pip install -U chaostoolkit-terraform
 

Edge version from the GitHub repository

To install the edge version of the chaostoolkit-terraform package directly from the repository source code:

pip install -U "git+https://github.com/mcastellin/chaostoolkit-terraform.git#egg=chaostoolkit-terraform"
 

Usage

chaostoolkit-terraform provides a control to deploy Terraform modules. The control will automatically create the resources defined in the Terraform stack before experiment execution and destroy them once the experiment is completed.

To activate the chaosterraform.control for your experiments you need to define it in your experiment files (or settings):

title: My experiment
 description: ...
@@ -84,4 +84,4 @@
       arguments:
         outputs:
             alb_dns_name: "application_dns_name"
-

In the example above, the control will map the output value alb_dns_name into a new Chaos Toolkit configuration application_dns_name that can be referenced in the experiment template using the ${application_dns_name} notation.

\ No newline at end of file +

In the example above, the control will map the output value alb_dns_name into a new Chaos Toolkit configuration application_dns_name that can be referenced in the experiment template using the ${application_dns_name} notation.

\ No newline at end of file diff --git a/drivers/toxiproxy/index.html b/drivers/toxiproxy/index.html index f183a9d5..6f74214f 100644 --- a/drivers/toxiproxy/index.html +++ b/drivers/toxiproxy/index.html @@ -1,4 +1,4 @@ - ToxiProxy -
Skip to content

Extension chaostoxi

Version 0.3.1
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-toxiproxy

Build Status Python versions

Welcome to the Chaos Toolkit driver for Toxiproxy! This extension allows you to setup toxy proxy probes and methods from chaostoolkit by leveraging the toxyproxy http management api.

Install

  1. Install the Toxiproxy base client
  2. Install the Toxiproxy CLI

Driver

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-toxiproxy
+ ToxiProxy -      

Extension chaostoxi

Version 0.3.1
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-toxiproxy

Build Status Python versions

Welcome to the Chaos Toolkit driver for Toxiproxy! This extension allows you to setup toxy proxy probes and methods from chaostoolkit by leveraging the toxyproxy http management api.

Install

  1. Install the Toxiproxy base client
  2. Install the Toxiproxy CLI

Driver

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-toxiproxy
 

Usage

Configuration

First, run the Toxiproxy base client locally to create a localhost:8474 host on your computer. Then create a proxy.

Next, to start using the actions and probes all you need to do is add the toxiproxy host with “toxiproxy_host” as the key, and optionally the port with “toxiproxy_port” as the key, to the configuration section in your experiment json. If not provided the port defaults to 8474.

Alternatively, if toxiproxy api is accessible using a reverse proxy, you can use toxiproxy_url setting.

Example using toxiproxy_host in experiment.json

"configuration": {
     "toxiproxy_host" : "10.124.23.183",
     "some_environment_variable": {
@@ -509,4 +509,4 @@
   module: chaostoxi.toxic.actions
   type: python
 type: action
-
\ No newline at end of file +
\ No newline at end of file diff --git a/drivers/wiremock/index.html b/drivers/wiremock/index.html index c7f640d5..a615e742 100644 --- a/drivers/wiremock/index.html +++ b/drivers/wiremock/index.html @@ -1,4 +1,4 @@ - WireMock -
Skip to content

Extension chaoswm

Version 0.1.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock

=====================

Build Status image

Chaos Toolkit driver for WireMock.

Package installation

To install the package from pypi.org:

pip install -U chaostoolkit-wiremock
+ WireMock -      

Extension chaoswm

Version 0.1.2
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock

=====================

Build Status image

Chaos Toolkit driver for WireMock.

Package installation

To install the package from pypi.org:

pip install -U chaostoolkit-wiremock
 

Installation from source

In order to use it, you need python 3.5+ in your environment. Once downloaded the project, cd into it and run:

pip install -r requirements.txt -r requirements-dev.txt
 make clean && make test && make install
 

Configuration

The following keys can be configured in the experiment global configuration section, under the "wiremock" key:

  • host: the wiremock server host
  • port: the wiremock server port
  • contextPath: the contextPath for your wiremock server (optional)
  • timeout: accepted timeout (defaults to 1 sec)
  • down: the delayDistribution section used by the down action

Configuration example:

{
@@ -565,4 +565,4 @@
   module: chaoswm.utils
   type: python
 type: ''
-
\ No newline at end of file +
\ No newline at end of file diff --git a/index.html b/index.html index 1802bba3..684b3385 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ -
Skip to content
Skip to content

The Chaos Engineering toolkit for Developers

Explore and test your systems to discover their weaknesses.

Get started Go to GitHub

Chaos As Code

Declare and store your Chaos Engineering experiments as JSON/YAML files so you can collaborate and orchestrate them as any other piece of code.

Extensible

The Chaos Toolkit is extensible at will for any system through its Open API..

Automation

The Chaos Toolkit loves automation and can be embedded in your favourite CI/CD chain.

Open Source

The Chaos Toolkit is Open Source with an Apache 2 license. No lock-in and powered by its community

Contributed to by awesome engineers from

Sponsors

\ No newline at end of file +

The Chaos Engineering toolkit for Developers

Explore and test your systems to discover their weaknesses.

Get started Go to GitHub

Chaos As Code

Declare and store your Chaos Engineering experiments as JSON/YAML files so you can collaborate and orchestrate them as any other piece of code.

Extensible

The Chaos Toolkit is extensible at will for any system through its Open API..

Automation

The Chaos Toolkit loves automation and can be embedded in your favourite CI/CD chain.

Open Source

The Chaos Toolkit is Open Source with an Apache 2 license. No lock-in and powered by its community

Contributed to by awesome engineers from

Sponsors

\ No newline at end of file diff --git a/reference/api/experiment/index.html b/reference/api/experiment/index.html index 7bcf4fcd..3f582f4f 100644 --- a/reference/api/experiment/index.html +++ b/reference/api/experiment/index.html @@ -1,4 +1,4 @@ - Experiment -
Skip to content

An Open API for Chaos Engineering Experiments

Introduction

The purpose of this specification is to formalize the elements of a Chaos Engineering experiment and offer a way to federate the community around a common syntax and semantic.

As a fairly recent field, Chaos Engineering is a dynamic and its foundations are still emerging. However, it appears certain concepts are settling down enough to start agreeing on a shared understanding.

This specification is not prescriptive and does not aim at forcing the community into one direction, rather it strives at providing a common vocabulary that new practitioners can easily make sense of.

It is necessary to appreciate that this document does not specify what tools, such as the Chaos Monkey or similar, should look like. Instead, this document specifies how Chaos Engineering Experiment could be described, shared and conducted collaboratively.

Conventions Used in This Document

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

The terms “JSON”, “JSON text”, “JSON value”, “member”, “element”, “object”, “array”, “number”, “string”, “boolean”, “true”, “false”, and “null” in this document are to be interpreted as defined in RFC 7159.

Other formats

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

Chaos Engineering Elements

Overview

An Experiment is one possible description of the principles of the Chaos Engineering. The intention of such a description is to provide shared understanding around a hypothesis on how to discover system’s behavior under certain conditions.

An Experiment declares a steady state hypothesis, alongside probes to validate this steady state is met, and a method as a sequence actions and probes, to interact and query the system respectively.

By using a variety of probes, experiments should gather information to sense behaviors in the system, potentially leading to systemic patterns that can be stabilized.

Experiment

A Chaos Engineering experiment, or simply an experiment, describes both the elements and the order in which they should be applied.

An experiment is a JSON object.

An experiment MUST declare:

  • a title property
  • a description property
  • a method property

The experiment’s title and description are meant for humans and therefore should be as descriptive as possible to clarify the experiment’s rationale.

Title and description are JSON strings with no maximum length.

An experiment SHOULD also declare:

  • a steady-state-hypothesis property
  • a rollbacks property

An experiment MAY finally declare:

  • a tags property
  • a secrets property
  • an extension property
  • a contributions property
  • a controls property

Tags provide a way of categorizing experiments. It is a sequence of JSON strings.

Extensions define opaque payloads for vendors to carry valuable information.

Contribution describes valuable properties of the target system, such as “reliability” or “durability”, that an experiment contribute to. This information can be aggregated together with other experiments’ contributions to better appreciate where the focus is put and where it is not.

Controls describe out-of-band capabilities applied during the experiment’s execution.

Steady State Hypothesis

The Steady State Hypothesis element describes what normal looks like in your system before the Method element is applied. If the steady state is not met, the Method element is not applied and the experiment MUST bail out.

The Steady State Hypothesis element is a JSON object.

Steady State Hypothesis element MUST declare:

  • a title property
  • a probes property

The title is meant for humans and therefore should clarify the rationale for this hypothesis.

Each Probe MUST define a tolerance property that acting as a gate mechanism for the experiment to carry on or bail. Any Probe that does not fall into the tolerance zone MUST fail the experiment.

Steady State Hypothesis element MAY declare:

  • a controls property

Controls describe out-of-band capabilities applied during the experiment’s execution.

Steady State Probe Tolerance

Probes of the Steady State Hypothesis MUST declare an additional property named tolerance.

The tolerance property’s value MUST be one of:

  • a scalar: JSON string, number (an integer), boolean
  • a sequence of scalars: JSON string, number, boolean
  • an object

In the case of a scalar or the sequence, the tolerance validation MUST be strict. The value returned by the Probe MUST be checked against the scalar value. The experiment MUST bail when both fail to match.

When the tolerance is a sequence. If it has only two values, those two values represent a lower and upper bound within which the Probe returned value must fall (inclusive).

When the sequence has more than two elements, the Probe returned value must be contained in that sequence.

When the tolerance is an object, it MUST have a type property which MUST be one of the followings: "probe", "regex", "jsonpath" or "range".

When the type property is "probe", the object MUST be a Probe that is applied. The probe should take two arguments, value and secrets where the value is the Probe returned value and secrets a Secret object or null. Its returned status MUST be successful for the tolerance to be considered valid.

When the type property is "regex", the object MUST have a pattern property which MUST be a valid regular expression. The tolerance succeeds if the Probe returned value is matched against the pattern. Object MAY have a target property which MUST be a valid value returned for a given provider.

When the type property is "jsonpath", the object MUST have a path property which MUST be a valid JSON Path. In addition, the object MAY have a expect property which is used to compare each value matched by the JSON Path to that value. The expect property value MUST be a scalar. When the expect property is not present, the tolerance succeeds if the JSON Path matched at least one item.

When the type property is "range", the object MUST have a range property which MUST be a sequence of length two. The first entry of the sequence MUST be the lower bound and the second entry MUST be the upper bound. Both entries MUST be JSON numbers.

In addition, when the Probe returned value is an object with a status property, the tested value is the value of that property.

Some examples of tolerance properties.

A boolean tolerance:

"tolerance": true
+ Experiment -      

An Open API for Chaos Engineering Experiments

Introduction

The purpose of this specification is to formalize the elements of a Chaos Engineering experiment and offer a way to federate the community around a common syntax and semantic.

As a fairly recent field, Chaos Engineering is a dynamic and its foundations are still emerging. However, it appears certain concepts are settling down enough to start agreeing on a shared understanding.

This specification is not prescriptive and does not aim at forcing the community into one direction, rather it strives at providing a common vocabulary that new practitioners can easily make sense of.

It is necessary to appreciate that this document does not specify what tools, such as the Chaos Monkey or similar, should look like. Instead, this document specifies how Chaos Engineering Experiment could be described, shared and conducted collaboratively.

Conventions Used in This Document

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

The terms “JSON”, “JSON text”, “JSON value”, “member”, “element”, “object”, “array”, “number”, “string”, “boolean”, “true”, “false”, and “null” in this document are to be interpreted as defined in RFC 7159.

Other formats

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

Chaos Engineering Elements

Overview

An Experiment is one possible description of the principles of the Chaos Engineering. The intention of such a description is to provide shared understanding around a hypothesis on how to discover system’s behavior under certain conditions.

An Experiment declares a steady state hypothesis, alongside probes to validate this steady state is met, and a method as a sequence actions and probes, to interact and query the system respectively.

By using a variety of probes, experiments should gather information to sense behaviors in the system, potentially leading to systemic patterns that can be stabilized.

Experiment

A Chaos Engineering experiment, or simply an experiment, describes both the elements and the order in which they should be applied.

An experiment is a JSON object.

An experiment MUST declare:

  • a title property
  • a description property
  • a method property

The experiment’s title and description are meant for humans and therefore should be as descriptive as possible to clarify the experiment’s rationale.

Title and description are JSON strings with no maximum length.

An experiment SHOULD also declare:

  • a steady-state-hypothesis property
  • a rollbacks property

An experiment MAY finally declare:

  • a tags property
  • a secrets property
  • an extension property
  • a contributions property
  • a controls property

Tags provide a way of categorizing experiments. It is a sequence of JSON strings.

Extensions define opaque payloads for vendors to carry valuable information.

Contribution describes valuable properties of the target system, such as “reliability” or “durability”, that an experiment contribute to. This information can be aggregated together with other experiments’ contributions to better appreciate where the focus is put and where it is not.

Controls describe out-of-band capabilities applied during the experiment’s execution.

Steady State Hypothesis

The Steady State Hypothesis element describes what normal looks like in your system before the Method element is applied. If the steady state is not met, the Method element is not applied and the experiment MUST bail out.

The Steady State Hypothesis element is a JSON object.

Steady State Hypothesis element MUST declare:

  • a title property
  • a probes property

The title is meant for humans and therefore should clarify the rationale for this hypothesis.

Each Probe MUST define a tolerance property that acting as a gate mechanism for the experiment to carry on or bail. Any Probe that does not fall into the tolerance zone MUST fail the experiment.

Steady State Hypothesis element MAY declare:

  • a controls property

Controls describe out-of-band capabilities applied during the experiment’s execution.

Steady State Probe Tolerance

Probes of the Steady State Hypothesis MUST declare an additional property named tolerance.

The tolerance property’s value MUST be one of:

  • a scalar: JSON string, number (an integer), boolean
  • a sequence of scalars: JSON string, number, boolean
  • an object

In the case of a scalar or the sequence, the tolerance validation MUST be strict. The value returned by the Probe MUST be checked against the scalar value. The experiment MUST bail when both fail to match.

When the tolerance is a sequence. If it has only two values, those two values represent a lower and upper bound within which the Probe returned value must fall (inclusive).

When the sequence has more than two elements, the Probe returned value must be contained in that sequence.

When the tolerance is an object, it MUST have a type property which MUST be one of the followings: "probe", "regex", "jsonpath" or "range".

When the type property is "probe", the object MUST be a Probe that is applied. The probe should take two arguments, value and secrets where the value is the Probe returned value and secrets a Secret object or null. Its returned status MUST be successful for the tolerance to be considered valid.

When the type property is "regex", the object MUST have a pattern property which MUST be a valid regular expression. The tolerance succeeds if the Probe returned value is matched against the pattern. Object MAY have a target property which MUST be a valid value returned for a given provider.

When the type property is "jsonpath", the object MUST have a path property which MUST be a valid JSON Path. In addition, the object MAY have a expect property which is used to compare each value matched by the JSON Path to that value. The expect property value MUST be a scalar. When the expect property is not present, the tolerance succeeds if the JSON Path matched at least one item.

When the type property is "range", the object MUST have a range property which MUST be a sequence of length two. The first entry of the sequence MUST be the lower bound and the second entry MUST be the upper bound. Both entries MUST be JSON numbers.

In addition, when the Probe returned value is an object with a status property, the tested value is the value of that property.

Some examples of tolerance properties.

A boolean tolerance:

"tolerance": true
 
tolerance: true
 

A integer tolerance:

"tolerance": 8
 
tolerance: 8
@@ -614,4 +614,4 @@
       end: now
       step: 1
 rollbacks: []
-
\ No newline at end of file +
\ No newline at end of file diff --git a/reference/api/journal/index.html b/reference/api/journal/index.html index cb8b9dc5..1f18ab96 100644 --- a/reference/api/journal/index.html +++ b/reference/api/journal/index.html @@ -1 +1 @@ - Journal -
Skip to content

Experiment Journal

Introduction

This document describes the syntax and grammar of a Chaos Engineering experiment’s output, called a journal. One should be able to walkthrough the experiment’s run through its journal alone.

This specification makes sense in regards to the Experiment specification itself. It is indeed a mirror to that document.

Conventions Used in This Document

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

The terms “JSON”, “JSON text”, “JSON value”, “member”, “element”, “object”, “array”, “number”, “string”, “boolean”, “true”, “false”, and “null” in this document are to be interpreted as defined in RFC 7159.

Other formats

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

Journal Elements

Overview

A Journal is one potential output of a Chaos Engineering experiment. The objective of such journal is to collect all events that took place during the experiment’s run.

The journal contains static information, such as the experiment that was run, as well as runtime entries.

Format

A journal is a JSON object.

Required Properties

A journal MUST declare:

  • a experiment property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a deviated property

The experiment property MUST be a copy of the run experiment as-is and is therefore a JSON object. It MUST follow the Experiment definition.

The ̀status property MUST be a JSON string, one of:

  • "completed": when the experiment runs fully. It does not indicate the activities in the experiment succeeded, only that they were executed as expected
  • "failed": when one of the activity reports a failed condition
  • "aborted": when the experiment breaks for unforeseen reason
  • "interrupted": when the experiment is interrupted (for instance after a signal is received)

Note

It is important to understand the "completed" status expresses that everything ran all the way. An action may not have resulted in what the operator wanted but it did not fail. Always review the entire journal to fully appreciate the actual outcome of the experiment.

There are two reasons it could be marked as "failed". Either a tolerance failed or if an extension made a check for a condition. So, for instance, let’s say the extension made a HTTP call to your service, that call returned a 400 rather than 200. If the extension was not designed to care for this difference, then the status will be marked as "completed". However, if the extension validated the HTTP response, it may have decided to fail the action which would lead to a Ì€ “failed”` status.

The "aborted" and "interrupted" are different, the former means of a crash somehow (say, because of a bug). The latter indicates a signal was received. Both MUST bail the entire process.

The deviated property MUST be a boolean flag that MUST be set to true when the steady-state was executed after the experimental method but reported that, at least, one of its probes failed to match the expected tolerance.

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

In addition to those required properties, the journal SHOULD also declare the followings:

  • a steady_states property
  • a run property
  • a rollbacks property

The steady_states property MUST be a JSON object defining the result of the steady state hypothesis outcome.

The run property MUST be a JSON array defining the result of each activity in the method element of the experiment.

The rollbacks property MUST be a JSON array defining the result of each action in the rollbacks element of the experiment.

Optional Properties

In addition to those required properties, the journal MAY also declare the followings:

  • a platform property
  • a node property

The platform property MUST be a JSON string defining the machine on which the experiment was executed. The content is free form but may be similar to the output of the uname -a command.

The node property MUST be a JSON string representing the name of the machine where the experiment was run. The content is free form.

Steady State

The steady_states property holds the outcomes of the steady state hypothesis.

The steady_states property MAY declare the following properties:

  • a before property
  • a after property

The before property MUST be a JSON object describing the outcome of the hypothesis run before the method is executed.

The after property MUST be a JSON object describing the outcome of the hypothesis run after the method is executed.

Notice that either of those properties MAY be missing if they were not run.

Steady State Outcomes

Both the before and after properties follow the same definition.

  • a steady_state_met property
  • a probes property

The steady_state_met property MUST be a JSON boolean. It MUST be true if the steady state hypothesis was met, false otherwise.

A steady state is met when all its probes matched their tolerance. A steady state is not met at the first non-matching tolerance probe.

The probes property MUST be a JSON array of probes results.

Each probe result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a tolerance_met property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed probe.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The tolerance_met MUST be a JSON boolean indicating if the probe matched its tolerance or not.

The output MUST be a JSON string or null.

In addition, the probe result MAY contain an additional property:

  • a exception property

This property is set when the probe failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Run

The run property holds the outcomes of the method element.

The run property MUST be a JSON array of activity results.

Each activity result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed probe or action.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

  • a exception property

This property is set when the activity failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks

The rollbacks property holds the outcomes of the rollbacks element.

The rollbacks property MUST be a JSON array of action results.

Each action result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed action.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

  • a exception property

This property is set when the action failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks MUST NOT to be applied when the experiment status is "interrupted".

\ No newline at end of file + Journal -
Skip to content

Experiment Journal

Introduction

This document describes the syntax and grammar of a Chaos Engineering experiment’s output, called a journal. One should be able to walkthrough the experiment’s run through its journal alone.

This specification makes sense in regards to the Experiment specification itself. It is indeed a mirror to that document.

Conventions Used in This Document

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

The terms “JSON”, “JSON text”, “JSON value”, “member”, “element”, “object”, “array”, “number”, “string”, “boolean”, “true”, “false”, and “null” in this document are to be interpreted as defined in RFC 7159.

Other formats

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

Journal Elements

Overview

A Journal is one potential output of a Chaos Engineering experiment. The objective of such journal is to collect all events that took place during the experiment’s run.

The journal contains static information, such as the experiment that was run, as well as runtime entries.

Format

A journal is a JSON object.

Required Properties

A journal MUST declare:

  • a experiment property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a deviated property

The experiment property MUST be a copy of the run experiment as-is and is therefore a JSON object. It MUST follow the Experiment definition.

The ̀status property MUST be a JSON string, one of:

  • "completed": when the experiment runs fully. It does not indicate the activities in the experiment succeeded, only that they were executed as expected
  • "failed": when one of the activity reports a failed condition
  • "aborted": when the experiment breaks for unforeseen reason
  • "interrupted": when the experiment is interrupted (for instance after a signal is received)

Note

It is important to understand the "completed" status expresses that everything ran all the way. An action may not have resulted in what the operator wanted but it did not fail. Always review the entire journal to fully appreciate the actual outcome of the experiment.

There are two reasons it could be marked as "failed". Either a tolerance failed or if an extension made a check for a condition. So, for instance, let’s say the extension made a HTTP call to your service, that call returned a 400 rather than 200. If the extension was not designed to care for this difference, then the status will be marked as "completed". However, if the extension validated the HTTP response, it may have decided to fail the action which would lead to a Ì€ “failed”` status.

The "aborted" and "interrupted" are different, the former means of a crash somehow (say, because of a bug). The latter indicates a signal was received. Both MUST bail the entire process.

The deviated property MUST be a boolean flag that MUST be set to true when the steady-state was executed after the experimental method but reported that, at least, one of its probes failed to match the expected tolerance.

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

In addition to those required properties, the journal SHOULD also declare the followings:

  • a steady_states property
  • a run property
  • a rollbacks property

The steady_states property MUST be a JSON object defining the result of the steady state hypothesis outcome.

The run property MUST be a JSON array defining the result of each activity in the method element of the experiment.

The rollbacks property MUST be a JSON array defining the result of each action in the rollbacks element of the experiment.

Optional Properties

In addition to those required properties, the journal MAY also declare the followings:

  • a platform property
  • a node property

The platform property MUST be a JSON string defining the machine on which the experiment was executed. The content is free form but may be similar to the output of the uname -a command.

The node property MUST be a JSON string representing the name of the machine where the experiment was run. The content is free form.

Steady State

The steady_states property holds the outcomes of the steady state hypothesis.

The steady_states property MAY declare the following properties:

  • a before property
  • a after property

The before property MUST be a JSON object describing the outcome of the hypothesis run before the method is executed.

The after property MUST be a JSON object describing the outcome of the hypothesis run after the method is executed.

Notice that either of those properties MAY be missing if they were not run.

Steady State Outcomes

Both the before and after properties follow the same definition.

  • a steady_state_met property
  • a probes property

The steady_state_met property MUST be a JSON boolean. It MUST be true if the steady state hypothesis was met, false otherwise.

A steady state is met when all its probes matched their tolerance. A steady state is not met at the first non-matching tolerance probe.

The probes property MUST be a JSON array of probes results.

Each probe result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a tolerance_met property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed probe.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The tolerance_met MUST be a JSON boolean indicating if the probe matched its tolerance or not.

The output MUST be a JSON string or null.

In addition, the probe result MAY contain an additional property:

  • a exception property

This property is set when the probe failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Run

The run property holds the outcomes of the method element.

The run property MUST be a JSON array of activity results.

Each activity result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed probe or action.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

  • a exception property

This property is set when the activity failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks

The rollbacks property holds the outcomes of the rollbacks element.

The rollbacks property MUST be a JSON array of action results.

Each action result MUST declare the following properties:

  • a activity property
  • a status property
  • a start property
  • a end property
  • a duration property
  • a output property

The activity property MUST be a JSON object, a raw copy of the executed action.

The status property MUST be a JSON string, one of "succeeded" or "failed".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

  • a exception property

This property is set when the action failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks MUST NOT to be applied when the experiment status is "interrupted".

\ No newline at end of file diff --git a/reference/concepts/index.html b/reference/concepts/index.html index 7dc31578..d8e05e33 100644 --- a/reference/concepts/index.html +++ b/reference/concepts/index.html @@ -1,4 +1,4 @@ - Concepts -
Skip to content

Chaos Engineering Concepts in the Chaos Toolkit

If you haven’t already, we strongly recommend reading the fantastic Chaos Engineering book from O’Reilly Media. This book will give you some fantastic background on the whole Chaos Engineering discipline, and it’s free!

Chaos Engineering is a discipline that allows you to surface weaknesses, and eventually build confidence, in complex and often distributed systems.

The Chaos Toolkit aims to give you the simplest experience for writing and running your own Chaos Engineering experiments. The main concepts are all expressed in an experiment definition, of which the following is an example from the Chaos Toolkit Samples project:

{
+ Concepts -      

Chaos Engineering Concepts in the Chaos Toolkit

If you haven’t already, we strongly recommend reading the fantastic Chaos Engineering book from O’Reilly Media. This book will give you some fantastic background on the whole Chaos Engineering discipline, and it’s free!

Chaos Engineering is a discipline that allows you to surface weaknesses, and eventually build confidence, in complex and often distributed systems.

The Chaos Toolkit aims to give you the simplest experience for writing and running your own Chaos Engineering experiments. The main concepts are all expressed in an experiment definition, of which the following is an example from the Chaos Toolkit Samples project:

{
     "title": "System is resilient to provider's failures",
     "description": "Can our consumer survive gracefully a provider's failure?",
     "tags": [
@@ -85,4 +85,4 @@
       type: http
       url: http://192.168.42.58:31018/invokeConsumedService
 rollbacks: []
-

The key concepts of the Chaos Toolkit are Experiments, Steady State Hypothesis and the experiment’s Method. The Method contains a combination of Probes and Actions.

Experiments

A Chaos Toolkit experiment is provided in a single file and is currently expressed in JSON.

Steady State Hypothesis

A Steady State Hypothesis describes “what normal looks like” for your system in order for the experiment to surface information about weaknesses when compared against the declared “normal” tolerances of what is measured.

The Chaos Toolkit uses the Steady State Hypothesis for two purposes. It is used as a check before an experiment is run that the target system is in a recognised normal state. It is also used as the template for comparison of the state of your system after the experiment has been run, forming the results provided by the experiment’s report.

Method

An experiment’s activities are contained within its Method block.

Probes

A probe is a way of observing a particular set of conditions in the system that is undergoing experimentation.

Actions

An action is a particular activity that needs to be enacted on the system under experimentation.

Rollbacks

An experiment may define a sequence of actions that revert what was undone during the experiment.

Controls

An experiment may declare a set of controls which have an impact over the execution of the experiment itself. Controls are operational elements rather than experimental.

\ No newline at end of file +

The key concepts of the Chaos Toolkit are Experiments, Steady State Hypothesis and the experiment’s Method. The Method contains a combination of Probes and Actions.

Experiments

A Chaos Toolkit experiment is provided in a single file and is currently expressed in JSON.

Steady State Hypothesis

A Steady State Hypothesis describes “what normal looks like” for your system in order for the experiment to surface information about weaknesses when compared against the declared “normal” tolerances of what is measured.

The Chaos Toolkit uses the Steady State Hypothesis for two purposes. It is used as a check before an experiment is run that the target system is in a recognised normal state. It is also used as the template for comparison of the state of your system after the experiment has been run, forming the results provided by the experiment’s report.

Method

An experiment’s activities are contained within its Method block.

Probes

A probe is a way of observing a particular set of conditions in the system that is undergoing experimentation.

Actions

An action is a particular activity that needs to be enacted on the system under experimentation.

Rollbacks

An experiment may define a sequence of actions that revert what was undone during the experiment.

Controls

An experiment may declare a set of controls which have an impact over the execution of the experiment itself. Controls are operational elements rather than experimental.

\ No newline at end of file diff --git a/reference/contributing/index.html b/reference/contributing/index.html index e89c0648..8df8e7fc 100644 --- a/reference/contributing/index.html +++ b/reference/contributing/index.html @@ -1 +1 @@ - Contributing to the Chaos Toolkit -
Skip to content

Contributing to the Chaos Toolkit

The Chaos Toolkit is a free and open source tool and a community-driven set of projects. The community’s input is what makes this project special and a success.

Your input could take the form of raising issues, voting for issues, starring projects, joining us on our community Slack team, submitting pull requests, or even suggesting whole new extension projects.

Whatever you can contribute, we’re listening and want you to help us drive the project forward.

The Chaos Toolkit Incubator

New potential projects should be first incubated in the Chaos Toolkit Incubator until they are ready to be moved into the main Chaos Toolkit suite of projects. Conditions for graduating a project from the Incubator to the main suite of projects include:

  • Correct Licensing and Certification of Origin.
  • A popular starred and used extension to the Chaos Toolkit.
  • Active and prompt project issue resolution.

How to submit your own project to the incubator?

The incubator is a place for community projects to be collected. If you think your extension makes sense as a community project, please don’t hesitate to suggest it. The best place to start is on the community Slack team to announce it.

Generally speaking, you should consider the followings:

  • Can your project be made publicly available? Think it should respect the Developer Certificate of Origin
  • Does it serve your own purpose or can it be used by anyone?
  • What license do you want to set on it? We tend to prefer permissive licenses that are recognized by the Open Source project, such as Apache or BSD
  • Will you be able to provide basic support to the project after you have submitted it? We are not talking about enterprise support but merely basic issues overview and bug fixes from time to time

Notice also that we deal with contributors on a repository basis. Collaborators are external contributors with little permissions to the org and write permissions to the repositories they contribute to. We suggest that accounts should have 2FA enabled. This reduces the security surface risks in case a contributor account is breached.

Licensing and Certification of Origin

Every project in the Chaos Toolkit and the Chaos Toolkit Incubator is licensed under the Apache License, Version 2.0 and abides by the Developer Certificate of Origin on all accepted commits to the master branch.

\ No newline at end of file + Contributing to the Chaos Toolkit -
Skip to content

Contributing to the Chaos Toolkit

The Chaos Toolkit is a free and open source tool and a community-driven set of projects. The community’s input is what makes this project special and a success.

Your input could take the form of raising issues, voting for issues, starring projects, joining us on our community Slack team, submitting pull requests, or even suggesting whole new extension projects.

Whatever you can contribute, we’re listening and want you to help us drive the project forward.

The Chaos Toolkit Incubator

New potential projects should be first incubated in the Chaos Toolkit Incubator until they are ready to be moved into the main Chaos Toolkit suite of projects. Conditions for graduating a project from the Incubator to the main suite of projects include:

  • Correct Licensing and Certification of Origin.
  • A popular starred and used extension to the Chaos Toolkit.
  • Active and prompt project issue resolution.

How to submit your own project to the incubator?

The incubator is a place for community projects to be collected. If you think your extension makes sense as a community project, please don’t hesitate to suggest it. The best place to start is on the community Slack team to announce it.

Generally speaking, you should consider the followings:

  • Can your project be made publicly available? Think it should respect the Developer Certificate of Origin
  • Does it serve your own purpose or can it be used by anyone?
  • What license do you want to set on it? We tend to prefer permissive licenses that are recognized by the Open Source project, such as Apache or BSD
  • Will you be able to provide basic support to the project after you have submitted it? We are not talking about enterprise support but merely basic issues overview and bug fixes from time to time

Notice also that we deal with contributors on a repository basis. Collaborators are external contributors with little permissions to the org and write permissions to the repositories they contribute to. We suggest that accounts should have 2FA enabled. This reduces the security surface risks in case a contributor account is breached.

Licensing and Certification of Origin

Every project in the Chaos Toolkit and the Chaos Toolkit Incubator is licensed under the Apache License, Version 2.0 and abides by the Developer Certificate of Origin on all accepted commits to the master branch.

\ No newline at end of file diff --git a/reference/developing/core/index.html b/reference/developing/core/index.html index db344ab9..b633d3c4 100644 --- a/reference/developing/core/index.html +++ b/reference/developing/core/index.html @@ -1 +1 @@ - Core Projects -
Skip to content

Core Projects

The Chaos Toolkit is made of several projects that work together to provide its service.

chaostoolkit

The chaostoolkit project is the command-line interface (CLI), in other words the command executed by users to run their experiments.

That project tries to remain as shallow as possible, only providing the user interface commands by gluing other projects together.

This project is implemented in Python 3.

chaostoolkit-lib

The chaostoolkit-lib project is the core library which implements the core concepts of the Chaos Toolkit.

This project is implemented in Python 3.

chaostoolkit-documentation

The chaostoolkit-documentation is the documentation source and renderer of the Chaos Toolkit. Namely, that project generates the website you are currently reading.

This project is implemented in Python 3 by generating HTML from Markdown documents.

chaostoolkit-kubernetes

The chaostoolkit-kubernetes project is the Kubernetes extension.

This project is implemented in Python 3.

chaostoolkit-addons

The chaostoolkit-addons project is a set of addons for Chaos Toolkit: useful controls, probes, actions and tolerances.

This project is implemented in Python 3.

chaostoolkit-reporting

The chaostoolkit-reporting project is a plugin for Chaos Toolkit to create PDF/HTMl reports from executions.

This project is implemented in Python 3.

chaostoolkit-bundler

The chaostoolkit-bundler project is a binary package of Chaos Toolkit and its most common extensions. In case you want a drop in Chaos Toolkit for your system.

This project is implemented in Python 3.

\ No newline at end of file + Core Projects -
Skip to content

Core Projects

The Chaos Toolkit is made of several projects that work together to provide its service.

chaostoolkit

The chaostoolkit project is the command-line interface (CLI), in other words the command executed by users to run their experiments.

That project tries to remain as shallow as possible, only providing the user interface commands by gluing other projects together.

This project is implemented in Python 3.

chaostoolkit-lib

The chaostoolkit-lib project is the core library which implements the core concepts of the Chaos Toolkit.

This project is implemented in Python 3.

chaostoolkit-documentation

The chaostoolkit-documentation is the documentation source and renderer of the Chaos Toolkit. Namely, that project generates the website you are currently reading.

This project is implemented in Python 3 by generating HTML from Markdown documents.

chaostoolkit-kubernetes

The chaostoolkit-kubernetes project is the Kubernetes extension.

This project is implemented in Python 3.

chaostoolkit-addons

The chaostoolkit-addons project is a set of addons for Chaos Toolkit: useful controls, probes, actions and tolerances.

This project is implemented in Python 3.

chaostoolkit-reporting

The chaostoolkit-reporting project is a plugin for Chaos Toolkit to create PDF/HTMl reports from executions.

This project is implemented in Python 3.

chaostoolkit-bundler

The chaostoolkit-bundler project is a binary package of Chaos Toolkit and its most common extensions. In case you want a drop in Chaos Toolkit for your system.

This project is implemented in Python 3.

\ No newline at end of file diff --git a/reference/developing/extensions/index.html b/reference/developing/extensions/index.html index 4dd9dfbe..b14abcc4 100644 --- a/reference/developing/extensions/index.html +++ b/reference/developing/extensions/index.html @@ -1 +1 @@ - Extensions Projects -
Skip to content

Extension Projects

In addition to the core projects, the Chaos Toolkit manages some extension projects which provide probes and/or actions for experiments.

Extensions can be found on the incubator GitHub organisation.

\ No newline at end of file + Extensions Projects -
Skip to content

Extension Projects

In addition to the core projects, the Chaos Toolkit manages some extension projects which provide probes and/or actions for experiments.

Extensions can be found on the incubator GitHub organisation.

\ No newline at end of file diff --git a/reference/developing/guidelines/index.html b/reference/developing/guidelines/index.html index 61600861..be3c1a09 100644 --- a/reference/developing/guidelines/index.html +++ b/reference/developing/guidelines/index.html @@ -1,4 +1,4 @@ - Guidelines -
Skip to content

Developer Guidelines

Contributors to the Chaos Toolkit are always welcome. This guide describes the general elements you probably need to know to get started. Once past those elements, you should dive into the code of each project and come discuss on our Slack.

Overview

Programming Environment

The programming environment really is up to you. However, since the Chaos Toolkit is implemented in Python so make sure to have the right tooling for it.

The most basics are:

  • Python 3.6+ installed.
  • A virtual environment so you can deploy the dependencies in a specific environment

If you’re not familiar with Python, you will find a few helpful books online, such The Hitchhiker’s Guide to Python.

The Ultimate Trick

Whenever you code on one of the projects, you should run the following command so that the project you are hacking on is part of your virtual environment without being installed:

cd <project-name>
+ Guidelines -      

Developer Guidelines

Contributors to the Chaos Toolkit are always welcome. This guide describes the general elements you probably need to know to get started. Once past those elements, you should dive into the code of each project and come discuss on our Slack.

Overview

Programming Environment

The programming environment really is up to you. However, since the Chaos Toolkit is implemented in Python so make sure to have the right tooling for it.

The most basics are:

  • Python 3.6+ installed.
  • A virtual environment so you can deploy the dependencies in a specific environment

If you’re not familiar with Python, you will find a few helpful books online, such The Hitchhiker’s Guide to Python.

The Ultimate Trick

Whenever you code on one of the projects, you should run the following command so that the project you are hacking on is part of your virtual environment without being installed:

cd <project-name>
 python setup.py develop
 

Sometimes, your virtual env may be borked and not point to your development directory. In that case, make sure to remove any previously installed version of the project:

pip uninstall <project-name>
 

Then make sure your virtual environment point at your local directory with:

pip freeze
@@ -14,4 +14,4 @@
         logzero.info("Event timestamp " + event["ts"])
         logzero.info("Event payload " + event["payload"])
         logzero.info("Event error " + event.get("error", "N/A"))
-

logzero is a third-party package that the Chaos Toolkit uses to log when it runs.

\ No newline at end of file +

logzero is a third-party package that the Chaos Toolkit uses to log when it runs.

\ No newline at end of file diff --git a/reference/developing/technologies/index.html b/reference/developing/technologies/index.html index ef03e54c..f70cf91e 100644 --- a/reference/developing/technologies/index.html +++ b/reference/developing/technologies/index.html @@ -1 +1 @@ - Technology Choices -
Skip to content

Technology Choices

Python 3

The Chaos Toolkit is implemented in Python 3. A high-level language with a long successfully story for writing great software. It’s a common choice for tooling purpose.

The language supports readability well and has a large ecosystem of libraries. It is also well-spread and easy to install. The choice to not support Python 2 is a look at Python’s present and future.

The choice for a dynamic language was also motivated because the Chaos Toolkit manipulates a lot of strings and that task is made straightforward with Python.

Although Python natively does not generate (though it can be done) standalone binaries like golang would. We do not believe this will harm the project and hope that package managers will eventually provide native installers.

Functional

Well, this project is not truly a functional piece of code but the code relies as little as possible on stateful constructions as provided by classes.

Mutable data structures are used but mostly created and returned from functions rather than modified.

Generally speaking, the project draws inspirations from certain ideas of functional paradigms but does not enforce them strictly. One notable area where the code strays away from these principles is the use of exceptions rather than returning error codes. This may change if the community expresses such an intention.

\ No newline at end of file + Technology Choices -
Skip to content

Technology Choices

Python 3

The Chaos Toolkit is implemented in Python 3. A high-level language with a long successfully story for writing great software. It’s a common choice for tooling purpose.

The language supports readability well and has a large ecosystem of libraries. It is also well-spread and easy to install. The choice to not support Python 2 is a look at Python’s present and future.

The choice for a dynamic language was also motivated because the Chaos Toolkit manipulates a lot of strings and that task is made straightforward with Python.

Although Python natively does not generate (though it can be done) standalone binaries like golang would. We do not believe this will harm the project and hope that package managers will eventually provide native installers.

Functional

Well, this project is not truly a functional piece of code but the code relies as little as possible on stateful constructions as provided by classes.

Mutable data structures are used but mostly created and returned from functions rather than modified.

Generally speaking, the project draws inspirations from certain ideas of functional paradigms but does not enforce them strictly. One notable area where the code strays away from these principles is the use of exceptions rather than returning error codes. This may change if the community expresses such an intention.

\ No newline at end of file diff --git a/reference/developing/values/index.html b/reference/developing/values/index.html index 597b8c8e..54abfccf 100644 --- a/reference/developing/values/index.html +++ b/reference/developing/values/index.html @@ -1 +1 @@ - Key Project Values -
Skip to content

Key Project Values

The following key values of the Chaos Toolkit reflect the mindset the community has when engineering the Chaos Toolkit project. Refer to our Code of Conduct as well.

Simplicity

The Chaos Toolkit aims at being a simple piece of technology both from a user and developer perspective.

To achieve simplicity, the Chaos Toolkit comes as a command line interface driven by a description file. As a user, this means no code and no need to learn a programming language. As a developer, this reduces the functional surface area to consider.

Extensibility

The Chaos Toolkit does not wish to be a monolith and strives to be extended to fully reach its goal through community driven efforts.

By using a description file, the implementation is not prescribed by the Chaos Toolkit project. Although we fully expect the community to eventually settle on certain implementations of probes and actions.

Readability

We believe code readability is a factor for positive maintenance and evolutivity.

Readable code never goes out of fashion. As the code of the Chaos Toolkit is mostly written in Python, best practices such as defined in PEP8.

Diversity

Although not strictly speaking referring to the technological aspect of the project, having diversity in the community will contribute to a better project overall.

\ No newline at end of file + Key Project Values -
Skip to content

Key Project Values

The following key values of the Chaos Toolkit reflect the mindset the community has when engineering the Chaos Toolkit project. Refer to our Code of Conduct as well.

Simplicity

The Chaos Toolkit aims at being a simple piece of technology both from a user and developer perspective.

To achieve simplicity, the Chaos Toolkit comes as a command line interface driven by a description file. As a user, this means no code and no need to learn a programming language. As a developer, this reduces the functional surface area to consider.

Extensibility

The Chaos Toolkit does not wish to be a monolith and strives to be extended to fully reach its goal through community driven efforts.

By using a description file, the implementation is not prescribed by the Chaos Toolkit project. Although we fully expect the community to eventually settle on certain implementations of probes and actions.

Readability

We believe code readability is a factor for positive maintenance and evolutivity.

Readable code never goes out of fashion. As the code of the Chaos Toolkit is mostly written in Python, best practices such as defined in PEP8.

Diversity

Although not strictly speaking referring to the technological aspect of the project, having diversity in the community will contribute to a better project overall.

\ No newline at end of file diff --git a/reference/extending/approaches/index.html b/reference/extending/approaches/index.html index 2750051b..b8fb2e81 100644 --- a/reference/extending/approaches/index.html +++ b/reference/extending/approaches/index.html @@ -1 +1 @@ - Extension Approaches -
Skip to content

Extending the Chaos Toolkit

The Chaos Toolkit is designed to be extended with new probes and actions so that you can work with any failure injection and system observability systems that you choose. The toolkit has a growing number of open source extensions for just this purpose, but the intention is that you may also want to extend the Chaos Toolkit for your own unique, possible closed, systems as well.

The ChaosToolkit currently supports three extension approaches:

You can extend your actions and probes by implementing them using one of these approaches.

Tip

The Chaos Toolkit maintains a set of open-source extensions ready to be integrated into your Chaos experiments.

\ No newline at end of file + Extension Approaches -
Skip to content

Extending the Chaos Toolkit

The Chaos Toolkit is designed to be extended with new probes and actions so that you can work with any failure injection and system observability systems that you choose. The toolkit has a growing number of open source extensions for just this purpose, but the intention is that you may also want to extend the Chaos Toolkit for your own unique, possible closed, systems as well.

The ChaosToolkit currently supports three extension approaches:

You can extend your actions and probes by implementing them using one of these approaches.

Tip

The Chaos Toolkit maintains a set of open-source extensions ready to be integrated into your Chaos experiments.

\ No newline at end of file diff --git a/reference/extending/create-control-extension/index.html b/reference/extending/create-control-extension/index.html index 95841d76..37213de5 100644 --- a/reference/extending/create-control-extension/index.html +++ b/reference/extending/create-control-extension/index.html @@ -1,4 +1,4 @@ - Create Control -
Skip to content

Create a Control Extension

A control extension implements the interface defined by the Chaos Toolkit to support the Controls element of the specification.

Controls are good for changing the experiment or its environment during execution. They have the power to impact the experiment, configuration, secrets on the fly, which is unlike probes and actions.

Controls Interface

When implementing a control module, you must simply define a set of functions that are called by the Chaos Toolkit when executing the experiment.

Tip

All of these functions are optional, only implement the one you need.

from typing import Any, Dict, List
+ Create Control -      

Create a Control Extension

A control extension implements the interface defined by the Chaos Toolkit to support the Controls element of the specification.

Controls are good for changing the experiment or its environment during execution. They have the power to impact the experiment, configuration, secrets on the fly, which is unlike probes and actions.

Controls Interface

When implementing a control module, you must simply define a set of functions that are called by the Chaos Toolkit when executing the experiment.

Tip

All of these functions are optional, only implement the one you need.

from typing import Any, Dict, List
 
 from chaoslib.types import Activity, Configuration, \
     Experiment, Hypothesis, Journal, Run, Secrets, Settings
@@ -203,4 +203,4 @@
                            secrets: Secrets = None, **kwargs):
     if check_stuff(state["output"]):
         raise InterruptExecution("Well things went really bad!")
-

In that case, the experiment’s execution will have its status set to "interrupted" as described here.

\ No newline at end of file +

In that case, the experiment’s execution will have its status set to "interrupted" as described here.

\ No newline at end of file diff --git a/reference/extending/extending-with-python/index.html b/reference/extending/extending-with-python/index.html index 698fd228..07165f73 100644 --- a/reference/extending/extending-with-python/index.html +++ b/reference/extending/extending-with-python/index.html @@ -1,5 +1,5 @@ - Extend with Python -
Skip to content

Extending Chaos Toolkit with Python

Create your new Chaos Toolkit extension project

All Chaos Toolkit extensions follow the same structure and you can benefit from a project template. You can create a repository using that template from the GitHub UI or using the gh.

$ gh repo create mytest --private -p chaostoolkit/chaostoolkit-extension-template
+ Extend with Python -      

Extending Chaos Toolkit with Python

Create your new Chaos Toolkit extension project

All Chaos Toolkit extensions follow the same structure and you can benefit from a project template. You can create a repository using that template from the GitHub UI or using the gh.

$ gh repo create mytest --private -p chaostoolkit/chaostoolkit-extension-template
 

Where to put your code

There are two extension points for a Chaos Toolkit Python extension, and they are captured in two files: actions.py and probes.py.

It is conventional to use the actions.py module as the place where you expose the actions that you would like to conduct as part of your Chaos Toolkit experimental method against the environment you want to inject failure into.

It’s also conventional to use the probes.py module as the place where you can integrate with your system’s existing observability so that those values can be used either for an experiment’s Steady State Hypothesis, or as simple additional data-gathering probes that can be declared throughout an experiment’s method.

Running Discover on a New Extension

Chaos Toolkit extensions often implement functionality that assists in discovering what a system, and the extension against that system, supports. This is executed using the chaos discover command.

When writing your own implementation of discovery you will often want to test the new functionality locally. To do this you should first execute from your extension workspace:

$ python setup.py develop

Then you can exercise your discovery functionality using the --no-install flag on the chaos discover command, for example:

chaos discover --no-install ext-name

Log From Your Extension

You can write to the Chaos Toolkit log by using the logzero package.

from logzero import logger
 
 logger.info("Hello!")
-

Make sure to add logzero as an entry of the requirements.txt file of your extension.

\ No newline at end of file +

Make sure to add logzero as an entry of the requirements.txt file of your extension.

\ No newline at end of file diff --git a/reference/tutorial/index.html b/reference/tutorial/index.html index dcc825b4..2d3f72f0 100644 --- a/reference/tutorial/index.html +++ b/reference/tutorial/index.html @@ -1,4 +1,4 @@ - Get Started with the Chaos Toolkit -
Skip to content

Getting Started with the Chaos Toolkit

When you practice chaos engineering, you are discovering how your system reacts following certain conditions you inject. By doing this in a controlled fashion, you may learn how to change the system accordingly.

This tutorial will quickly give you a tour of the basic elements of an experiment.

Tip

You will find many more in-depth labs on GitHub.

Get Ready

Before you can run the experiment against your system, you will need to have it setup.

Get the Code

You can fetch the code as follows:

git clone https://github.com/chaostoolkit/chaostoolkit-documentation-code
+ Get Started with the Chaos Toolkit -      

Getting Started with the Chaos Toolkit

When you practice chaos engineering, you are discovering how your system reacts following certain conditions you inject. By doing this in a controlled fashion, you may learn how to change the system accordingly.

This tutorial will quickly give you a tour of the basic elements of an experiment.

Tip

You will find many more in-depth labs on GitHub.

Get Ready

Before you can run the experiment against your system, you will need to have it setup.

Get the Code

You can fetch the code as follows:

git clone https://github.com/chaostoolkit/chaostoolkit-documentation-code
 

This particular tutorial is under tutorials/a-simple-walkthrough.

cd chaostoolkit-documentation-code/tutorials/a-simple-walkthrough
 

Third-party binaries

The experiment will use the following binaries, make sure you have them in your PATH:

Install the Application dependencies

Our application is made of a simple set of two microservices that converse with each other over HTTPS.

Tip

It’s recommended that you use a Python virtual environment to keep your project dependencies isolated from any other projects.

As you should already run Python 3 for the toolkit itself, we assume you are set accordingly, please install only the application dependencies:

pip install -U -r requirements.txt
 

Install the Chaos Toolkit

You must install the Chaos Toolkit and its dependencies for the purpose of this tutorial. While we suggest you go through the install section, it boils down to:

pip install -U chaostoolkit
@@ -65,4 +65,4 @@
 [2018-05-14 18:41:11 INFO] Experiment ended with status: failed
 

Each activity is run in the order it appears in the experiment. Notice now how the hypothesis is not met after we swapped the certificates. But, we learn something interesting, even if expected, using an expired certificate does not prevent our services to even start.

Report on your Findings

Review the Journal of the Run

You may now review the journal generated by the run:

cat journal.json
 

It contains the activities runs and the output of each of them.

Generate a Report

You can generate a PDF (or HTML, markdown…) report from the journal if you install the chaostoolkit-reporting plugin first:

chaos report --export-format=pdf journal.json report.pdf
-

Learnings and Responses

In this experiment, we proved what we guessed initially, that an expired certificate will create trouble and break the application for our users. What could be the responses?

  • Use a circuit-breaker to provide a more meaningful, and controlled, answer to the caller
  • Prevent the service to start when the certificate it uses is expired
  • Put some monitoring in place on our certificates and trigger an alert when they get close to their end date
  • Move to Let’s Encrypt and renew our certs automatically

For each of these potential responses, you could create an experiment should they unearth potential new questions.

Next?

An experiment is never the end game. The flow should be continuous and you should create and run experiments regularly.

\ No newline at end of file +

Learnings and Responses

In this experiment, we proved what we guessed initially, that an expired certificate will create trouble and break the application for our users. What could be the responses?

  • Use a circuit-breaker to provide a more meaningful, and controlled, answer to the caller
  • Prevent the service to start when the certificate it uses is expired
  • Put some monitoring in place on our certificates and trigger an alert when they get close to their end date
  • Move to Let’s Encrypt and renew our certs automatically

For each of these potential responses, you could create an experiment should they unearth potential new questions.

Next?

An experiment is never the end game. The flow should be continuous and you should create and run experiments regularly.

\ No newline at end of file diff --git a/reference/tutorials/authoring_operating/index.html b/reference/tutorials/authoring_operating/index.html index f8a2afc8..18732d1e 100644 --- a/reference/tutorials/authoring_operating/index.html +++ b/reference/tutorials/authoring_operating/index.html @@ -1 +1 @@ - Author and Operator -
Skip to content

Authoring vs Operating

The Chaos Toolkit specifies an experimental protocol and format for your chaos engineering capabilities. It is often interesting to distinguish, at least in your mind, two roles.

Author

The author of an experiment is responsible for defining the structure of the experiment and its objective. The author does not have to be the one who comes with the question the experiment tries to produce evidence for. Rather, the author knows how to structure the experiment and ensures the outcome of an experiment’s execution can be interpreted in an objective way.

An author manipulates the following elements: steady-state hypothesis, method, rollbacks.

Operator

The operator of an experiment executes it. This role is not as clear cut as the author’s role and, quite often, both are the same person. However, it is useful to keep in mind what an experiment requires to be operated. Since you may end up with a fleet of Chaos Toolkit experiments running concurrently, the operator should work to ensure the executions happen in a safe and controlled manner.

An operator manipulates the following elements: controls, settings

\ No newline at end of file + Author and Operator -
Skip to content

Authoring vs Operating

The Chaos Toolkit specifies an experimental protocol and format for your chaos engineering capabilities. It is often interesting to distinguish, at least in your mind, two roles.

Author

The author of an experiment is responsible for defining the structure of the experiment and its objective. The author does not have to be the one who comes with the question the experiment tries to produce evidence for. Rather, the author knows how to structure the experiment and ensures the outcome of an experiment’s execution can be interpreted in an objective way.

An author manipulates the following elements: steady-state hypothesis, method, rollbacks.

Operator

The operator of an experiment executes it. This role is not as clear cut as the author’s role and, quite often, both are the same person. However, it is useful to keep in mind what an experiment requires to be operated. Since you may end up with a fleet of Chaos Toolkit experiments running concurrently, the operator should work to ensure the executions happen in a safe and controlled manner.

An operator manipulates the following elements: controls, settings

\ No newline at end of file diff --git a/reference/tutorials/batch/index.html b/reference/tutorials/batch/index.html index 7f28b9ad..1c71454f 100644 --- a/reference/tutorials/batch/index.html +++ b/reference/tutorials/batch/index.html @@ -1,4 +1,4 @@ - Running Chaos Toolkit experiments as AWS Batch Jobs -
Skip to content

Running Chaos Toolkit experiments as AWS Batch Jobs

It is common when using AWS for hosting your infrastructure that you’ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we’re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

Why Batch?

You may have followed our Running Chaos Toolkit from an EC2 instance guide and wonder why we would write a guide for Batch - Batch has some benefits over EC2:

  • Your infrastructure isn’t running all the time
  • You can use Docker images to encapsulate your experiment environment
  • You can submit multiple jobs to run different experiments rather than blocking on one experiment in an EC2 instance

Why not ECS and Fargate?

We sometimes get asked about how to run Chaos Toolkit on ECS with Fargate, whilst we understand why you might want to do this, Chaos Toolkit experiments aren’t analogous to something like a microservice. We don’t run Chaos Toolkit continuously and request it to run jobs, rather we invoke Chaos Toolkit when we want to use it.

Because of this difference in thinking, we recommend you use Batch (With Fargate as the compute provider) to invoke Chaos Toolkit experiments.

The Steps

For the purposes of this guide, we’ll run you through setting up your Chaos Toolkit experiments manually. If however, you’re familiar with the AWS Cloud Development Kit (CDK), we have an example repository deploying the same infrastructure using CDK here.

There are a few pre-requisites required to be able to follow this guide:

  • You’ll need access to the AWS Console (We’re assuming you’re comfortable here)
  • You’ll need AWS CLI installed and configured
  • You’ll need to be able to create EC2 instances (Or have someone do this for you)
  • You’ll need to be able to create IAM Roles and Policies (Or have someone do this for you)
  • You’ll need to be able to create Batch Compute Environments, Jobs, and Queues (Or have someone do this for you)
  • You’ll need to be able to create ECR Repositories and push to them (Or have someone to do this for you)

1. Create your system (an EC2 instance)

Similar to our Running Chaos Toolkit from an EC2 instance guide, we’ll be using an EC2 instance as our ‘system’ to run our experiment against. We’ll setup our SSH to ensure that the EC2 instance is in a running state.

  • Navigate to the EC2 console and select Launch Instance
  • For this guide, we’ll select the Amazon Linux 2 AMI at the top of the list
  • For this guide, we’ll select a t2.micro (But you can choose a larger one)
  • Go onto Configure Instance Details
  • Select the VPC to deploy into via the Network dropdown
  • Select the Subnet to deploy into via the Subnet dropdown
  • Go onto Add Storage - For now, the defaults will be fine
  • Go onto Add Tags - We recommend at minimum, adding a tag {"OWNER": "your-name"}
  • Go onto Configure Security Group
  • Click the X to the right of the SSH rule, you won’t need this
  • Go onto Review and Launch - Select Launch
  • Select Proceed without a key pair, check the tickbox, and click Launch Instances
\ No newline at end of file diff --git a/reference/tutorials/blockchain/index.html b/reference/tutorials/blockchain/index.html index f7526462..407b474e 100644 --- a/reference/tutorials/blockchain/index.html +++ b/reference/tutorials/blockchain/index.html @@ -1,4 +1,4 @@ - Experimenting against a blockchain -
Skip to content

Chaos Engineering experiments against a blockchain

Credits

This article has been authored by Yolanne Lee and you can find the original article code on Yolanne’s repository

Blockchains are interesting concepts to test using chaos engineering principles. This is because they operate based on user usage, taking advantage of a network of participants and internal algorithms to create a distributed, decentralized ledger.

This tutorial will not focus on teaching core blockchain concepts. While the setup may be done by simply pulling from my github repository, you may alternatively invest some time reading through the great tutorial here!

If you choose to proceed with the tutorial, you will need to ensure that your HTTP requests match logically with those in this tutorial.

Ready? Great! Let’s get started.

Setup

First, clone the code using the command below in your command line. This fetches an up-to-date version of all files required to run the experiment.

$ git clone https://github.com/yolannel/CTKBlockchain

Assuming you are running Python 3.6 or higher, you can install all required dependencies via the following command in your command line. Please note that it is highly recommended that you work inside of a virtual environment. A simple explanation of virtual environments may be found here; if you’re running PyCharm or another editor which has in-built venv support then check your project settings!

$ pip install -U -r requirements.txt

Now you’re all set up to dive into the experiments!

Chaos Toolkit and Blockchain

Looking forward

Blockchains are inherently user dependent which is why it presents a unique case to test with Chaos Toolkit. This tutorial will guide you through the thought process of creating two experiments:

  1. Testing a simple transaction
  2. Testing the consensus mechanism

We will follow the above order because the consensus mechanism naturally builds off of the transaction model. If you require additional help at any point regarding the CTK, you can view the documentation.

You can consider an experiment as an automator for the process you’d normally do to test your program: you preset a full task flow so that your testing is repeatable and easy to run. The results of your experiment are also automatically recorded, so you can continuously expose your system to stressors and understand its strengths and weaknesses from reading the records which are automatically recorded in your journal file.

Transaction Experiment

We’ll use this as an introduction to the CTK experiment as well. An experiment is a single json file which tests a functionality of your program. It has several components that must be declared:

  • title
  • This forces you to be organised with your experiments. The title should be clear for anyone reading it to understand what is being performed in the experiment.
  • description
  • Similarly, a more detailed description which clarifies the experiment should be included. In my case, I use this property to describe the expected behaviour of the system so the tester knows right off the bat what is happening.
  • method
  • This is where the majority of your work goes. More details are included below.

When we start to think about creating an experiment, we need to have a well-defined goal of testing. For example, the blockchain should support making a simple transaction which can be mined; before and after mining, the chain should exist and be callable. No rollbacks should be supported since a blockchain should be immutable.

This is the beginning of my experiment:

{
+ Experimenting against a blockchain -      

Chaos Engineering experiments against a blockchain

Credits

This article has been authored by Yolanne Lee and you can find the original article code on Yolanne’s repository

Blockchains are interesting concepts to test using chaos engineering principles. This is because they operate based on user usage, taking advantage of a network of participants and internal algorithms to create a distributed, decentralized ledger.

This tutorial will not focus on teaching core blockchain concepts. While the setup may be done by simply pulling from my github repository, you may alternatively invest some time reading through the great tutorial here!

If you choose to proceed with the tutorial, you will need to ensure that your HTTP requests match logically with those in this tutorial.

Ready? Great! Let’s get started.

Setup

First, clone the code using the command below in your command line. This fetches an up-to-date version of all files required to run the experiment.

$ git clone https://github.com/yolannel/CTKBlockchain

Assuming you are running Python 3.6 or higher, you can install all required dependencies via the following command in your command line. Please note that it is highly recommended that you work inside of a virtual environment. A simple explanation of virtual environments may be found here; if you’re running PyCharm or another editor which has in-built venv support then check your project settings!

$ pip install -U -r requirements.txt

Now you’re all set up to dive into the experiments!

Chaos Toolkit and Blockchain

Looking forward

Blockchains are inherently user dependent which is why it presents a unique case to test with Chaos Toolkit. This tutorial will guide you through the thought process of creating two experiments:

  1. Testing a simple transaction
  2. Testing the consensus mechanism

We will follow the above order because the consensus mechanism naturally builds off of the transaction model. If you require additional help at any point regarding the CTK, you can view the documentation.

You can consider an experiment as an automator for the process you’d normally do to test your program: you preset a full task flow so that your testing is repeatable and easy to run. The results of your experiment are also automatically recorded, so you can continuously expose your system to stressors and understand its strengths and weaknesses from reading the records which are automatically recorded in your journal file.

Transaction Experiment

We’ll use this as an introduction to the CTK experiment as well. An experiment is a single json file which tests a functionality of your program. It has several components that must be declared:

  • title
  • This forces you to be organised with your experiments. The title should be clear for anyone reading it to understand what is being performed in the experiment.
  • description
  • Similarly, a more detailed description which clarifies the experiment should be included. In my case, I use this property to describe the expected behaviour of the system so the tester knows right off the bat what is happening.
  • method
  • This is where the majority of your work goes. More details are included below.

When we start to think about creating an experiment, we need to have a well-defined goal of testing. For example, the blockchain should support making a simple transaction which can be mined; before and after mining, the chain should exist and be callable. No rollbacks should be supported since a blockchain should be immutable.

This is the beginning of my experiment:

{
     "title": "Can we make a new transaction?",
     "description": "The system should respond to a transaction request.",
     "tags": ["tx"],
@@ -78,4 +78,4 @@
             }
     }
 }
-
  • To make this experiment os-agnostic, we use python to run a python file through the os.system.
  • module
  • This should be a Python module - in our case, we use the os module since it comes with the core Python libraries.
  • func
  • This should be a function in the specified module that can be run.
  • arguments
  • If a function takes arguments, check the documentation so you know how the arguments are titled and you can list them in the standard JSON format. Here, the argument is a command and the input is '"python -c \"import activity; activity.run(100)\""

The activity.py file run by simulate activity randomly posts transactions from either of the two nodes and occasionally mines a block. For reference, the approximate probability of posting a transaction to any of the two chains is 75% and accordingly, the probability of mining from either of the two chains is 25%.

Finally, we want to resolve the chains. This is an http request which we’ve learned earlier, and I again invite you to try your hand at it!

Running the experiment

In your command line, you should create the blockchain and start both nodes (here we use 127.0.0.1:5000 and 127.0.0.1:5001) before running the experiment:

$ python blockchain.py --port 5000

.. and on a new terminal,

$ python blockchain.py --port 5001

Then, you can run the experiment by using the command:

$ chaos run testConsensus.json

You’ve completed the tutorial!

Some key takeaways

  • The http provider makes it simple to test user requests that are very common in web applications
  • The Python provider is a very powerful tool that can run ‘on its own’ or other Python files
  • The CTK at the core of it tests your system on what could possibly happen
  • This means it is context specific - walking through this tutorial, you have seen how the experiments should be tailored to how the system should work, like how there are no rollback options.
  • On an even more abstracted level, the CTK is an automation tool - note how the consensus test essentially automates a lot of usage and then checks. This actually makes it incredibly powerful even if you aren’t specifically running a chaos experiment because there is a set process that you create which is replicable. Think of experiments as blueprints for what you want to try!

Thanks

Chaos Toolkit is an open source project hosted on Github. If you have any issues then raise them on the Github, and if you’d like to contribute, start here!

The blockchain tutorial linked in the beginning is completely external to this tutorial and all credits go to Daniel van Flymen.

\ No newline at end of file +
  • To make this experiment os-agnostic, we use python to run a python file through the os.system.
  • module
  • This should be a Python module - in our case, we use the os module since it comes with the core Python libraries.
  • func
  • This should be a function in the specified module that can be run.
  • arguments
  • If a function takes arguments, check the documentation so you know how the arguments are titled and you can list them in the standard JSON format. Here, the argument is a command and the input is '"python -c \"import activity; activity.run(100)\""

The activity.py file run by simulate activity randomly posts transactions from either of the two nodes and occasionally mines a block. For reference, the approximate probability of posting a transaction to any of the two chains is 75% and accordingly, the probability of mining from either of the two chains is 25%.

Finally, we want to resolve the chains. This is an http request which we’ve learned earlier, and I again invite you to try your hand at it!

Running the experiment

In your command line, you should create the blockchain and start both nodes (here we use 127.0.0.1:5000 and 127.0.0.1:5001) before running the experiment:

$ python blockchain.py --port 5000

.. and on a new terminal,

$ python blockchain.py --port 5001

Then, you can run the experiment by using the command:

$ chaos run testConsensus.json

You’ve completed the tutorial!

Some key takeaways

  • The http provider makes it simple to test user requests that are very common in web applications
  • The Python provider is a very powerful tool that can run ‘on its own’ or other Python files
  • The CTK at the core of it tests your system on what could possibly happen
  • This means it is context specific - walking through this tutorial, you have seen how the experiments should be tailored to how the system should work, like how there are no rollback options.
  • On an even more abstracted level, the CTK is an automation tool - note how the consensus test essentially automates a lot of usage and then checks. This actually makes it incredibly powerful even if you aren’t specifically running a chaos experiment because there is a set process that you create which is replicable. Think of experiments as blueprints for what you want to try!

Thanks

Chaos Toolkit is an open source project hosted on Github. If you have any issues then raise them on the Github, and if you’d like to contribute, start here!

The blockchain tutorial linked in the beginning is completely external to this tutorial and all credits go to Daniel van Flymen.

\ No newline at end of file diff --git a/reference/tutorials/containerising/index.html b/reference/tutorials/containerising/index.html index 904c92aa..8eaf0554 100644 --- a/reference/tutorials/containerising/index.html +++ b/reference/tutorials/containerising/index.html @@ -1,4 +1,4 @@ - Containerising Chaos Toolkit -
Skip to content

Containerising Chaos Toolkit

You may find yourself in a situation that requires you to run your Chaos Toolkit Experiments from within a container. This may be to encapsulate the dependencies required or to run CTK in a different environment, for whichever reason you have, containerising CTK is straightforward.

Chaos Toolkit provides three images you can use as bases for your own needs:

  • chaostoolkit/chaostoolkit which is tagged latest and per new releases version. It’s based on Python 3.7 Alpine base image. So it’s not suitable for every configuration when you need specific software in your image
  • chaostoolkit/chaostoolkit:basic is based on Python 3.10 Debian Bullseye base image. It only contains Chaos Toolkit as per the previous image but is based on Debian with a more recent Python version
  • chaostoolkit/chaostoolkit:full is based on Python 3.10 Debian Bullseye base image. It contains Chaos Toolkit and a list of extensions and is based on Debian with a more recent Python version

Using the vanilla chaostoolkit image

Chaos Toolkit builds and pushes a Docker Image upon every release of a new version of the chaostoolkit package. This can then be used out of the box by referring to it locally on the command line with:

docker run chaostoolkit/chaostoolkit:latest info core
+ Containerising Chaos Toolkit -      

Containerising Chaos Toolkit

You may find yourself in a situation that requires you to run your Chaos Toolkit Experiments from within a container. This may be to encapsulate the dependencies required or to run CTK in a different environment, for whichever reason you have, containerising CTK is straightforward.

Chaos Toolkit provides three images you can use as bases for your own needs:

  • chaostoolkit/chaostoolkit which is tagged latest and per new releases version. It’s based on Python 3.7 Alpine base image. So it’s not suitable for every configuration when you need specific software in your image
  • chaostoolkit/chaostoolkit:basic is based on Python 3.10 Debian Bullseye base image. It only contains Chaos Toolkit as per the previous image but is based on Debian with a more recent Python version
  • chaostoolkit/chaostoolkit:full is based on Python 3.10 Debian Bullseye base image. It contains Chaos Toolkit and a list of extensions and is based on Debian with a more recent Python version

Using the vanilla chaostoolkit image

Chaos Toolkit builds and pushes a Docker Image upon every release of a new version of the chaostoolkit package. This can then be used out of the box by referring to it locally on the command line with:

docker run chaostoolkit/chaostoolkit:latest info core
 
Unable to find image 'chaostoolkit/chaostoolkit:latest' locally
 latest: Pulling from chaostoolkit/chaostoolkit
 Digest: sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3
@@ -34,4 +34,4 @@
 

Then you’d confirm chaostoolkit-aws is available with:

docker run ctk-aws info extensions
 
NAME                                    VERSION   LICENSE                       DESCRIPTION
 chaostoolkit-aws                        0.16.0    Apache License Version 2.0    AWS
-
\ No newline at end of file +
\ No newline at end of file diff --git a/reference/tutorials/ec2/index.html b/reference/tutorials/ec2/index.html index 7ab32d7a..77f99fa8 100644 --- a/reference/tutorials/ec2/index.html +++ b/reference/tutorials/ec2/index.html @@ -1,4 +1,4 @@ - Running Chaos Toolkit from an EC2 instance -
Skip to content

Running Chaos Toolkit from an EC2 instance

It is common when using AWS for hosting your infrastructure that you’ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we’re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

Why EC2?

The reasons for providing a guide on running Chaos Toolkit from an EC2 instance are simple enough:

  • Most AWS users are comfortable with EC2
  • It is the most analogous service to running something on your own workstation

The Steps

There are a few pre-requisites required to be able to follow this guide:

  • You’ll need access to the AWS Console (We’re assuming you’re comfortable here)
    • Or you’ll need AWS CLI installed and configured
  • You’ll need to be able to create EC2 instances (Or have someone do this for you)
  • You’ll need to be able to create IAM Roles and Policies (Or have someone do this for you)
  • You’ll need to be able to use Systems Manager - Session Manager

1. Create your instance

  • Navigate to the EC2 console and select Launch Instance
  • For this guide, we’ll select the Amazon Linux 2 AMI at the top of the list
  • For this guide, we’ll select a t2.micro (But you can choose a larger one)
  • Go onto Configure Instance Details
  • Select the VPC to deploy into via the Network dropdown
  • Select the Subnet to deploy into via the Subnet dropdown
  • To the right of IAM role, select Create a new IAM role
    • Create an instance profile as per the Creating an instance profile with minimal Session Manager permissions (console) in this Session Manager Documentation
    • Go back to the EC2 wizard and select the newly created role in the dropdown (You may have to click the refresh button)
  • Go onto Add Storage - For now, the defaults will be fine
  • Go onto Add Tags - We recommend at minimum, adding a tag {"OWNER": "your-name"}
  • Go onto Configure Security Group
  • Click the X to the right of the SSH rule, you won’t need this
  • Go onto Review and Launch - Select Launch
  • Select Proceed without a key pair, check the tickbox, and click Launch Instances

To be able to connect to your instance via Session Manager, you’ll first need to create a few IAM components.

  • Create a file named assume-role.json with the following contents:

    {
    + Running Chaos Toolkit from an EC2 instance -      

    Running Chaos Toolkit from an EC2 instance

    It is common when using AWS for hosting your infrastructure that you’ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we’re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

    Why EC2?

    The reasons for providing a guide on running Chaos Toolkit from an EC2 instance are simple enough:

    • Most AWS users are comfortable with EC2
    • It is the most analogous service to running something on your own workstation

    The Steps

    There are a few pre-requisites required to be able to follow this guide:

    • You’ll need access to the AWS Console (We’re assuming you’re comfortable here)
      • Or you’ll need AWS CLI installed and configured
    • You’ll need to be able to create EC2 instances (Or have someone do this for you)
    • You’ll need to be able to create IAM Roles and Policies (Or have someone do this for you)
    • You’ll need to be able to use Systems Manager - Session Manager

    1. Create your instance

    • Navigate to the EC2 console and select Launch Instance
    • For this guide, we’ll select the Amazon Linux 2 AMI at the top of the list
    • For this guide, we’ll select a t2.micro (But you can choose a larger one)
    • Go onto Configure Instance Details
    • Select the VPC to deploy into via the Network dropdown
    • Select the Subnet to deploy into via the Subnet dropdown
    • To the right of IAM role, select Create a new IAM role
      • Create an instance profile as per the Creating an instance profile with minimal Session Manager permissions (console) in this Session Manager Documentation
      • Go back to the EC2 wizard and select the newly created role in the dropdown (You may have to click the refresh button)
    • Go onto Add Storage - For now, the defaults will be fine
    • Go onto Add Tags - We recommend at minimum, adding a tag {"OWNER": "your-name"}
    • Go onto Configure Security Group
    • Click the X to the right of the SSH rule, you won’t need this
    • Go onto Review and Launch - Select Launch
    • Select Proceed without a key pair, check the tickbox, and click Launch Instances

    To be able to connect to your instance via Session Manager, you’ll first need to create a few IAM components.

    • Create a file named assume-role.json with the following contents:

      {
           "Version": "2012-10-17",
           "Statement": [
               {
      @@ -142,4 +142,4 @@
       [2021-08-18 10:24:56 INFO] Let's rollback...
       [2021-08-18 10:24:56 INFO] No declared rollbacks, let's move on.
       [2021-08-18 10:24:56 INFO] Experiment ended with status: completed
      -

      As you’ll notice, your EC2 profile now has the suitable permissions. This should ultimately give you a good sense on how IAM allows you to give specific permissions to the instances running your Chaos Toolkit experiments.

      Summary

      Whilst the experiment within this guide was simple, the guide was not meant to teach you how to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure.

      You should now have an appreciation and the ability to:

      • Create an EC2 instance within your AWS network
      • Securely connect to that instance via Session Manager
        • Negating the need for Security Group policies or SSH access
      • Setup and run Chaos Toolkit from an EC2 instance
      • Modify the IAM policies for your instance to increase/decrease the experiments ability to interact with your systems.

      Notes

      It should be noted that several things could be done differently in this guide to suit your own setup, they could be as follows:

      • Using a containerised setup like prescribed in this guide within your instance
      • Using a git repository (whether pulled or created) to use version control on the instance and keep your experiments in version control
      • Storing experiments/experiment journals/experiment logs in S3 so they’re accessible to others in your organisation
      • Connecting via SSH (if your organisation is less concerned about allowing traffic from your local IP)
    \ No newline at end of file +

    As you’ll notice, your EC2 profile now has the suitable permissions. This should ultimately give you a good sense on how IAM allows you to give specific permissions to the instances running your Chaos Toolkit experiments.

    Summary

    Whilst the experiment within this guide was simple, the guide was not meant to teach you how to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure.

    You should now have an appreciation and the ability to:

    • Create an EC2 instance within your AWS network
    • Securely connect to that instance via Session Manager
      • Negating the need for Security Group policies or SSH access
    • Setup and run Chaos Toolkit from an EC2 instance
    • Modify the IAM policies for your instance to increase/decrease the experiments ability to interact with your systems.

    Notes

    It should be noted that several things could be done differently in this guide to suit your own setup, they could be as follows:

    • Using a containerised setup like prescribed in this guide within your instance
    • Using a git repository (whether pulled or created) to use version control on the instance and keep your experiments in version control
    • Storing experiments/experiment journals/experiment logs in S3 so they’re accessible to others in your organisation
    • Connecting via SSH (if your organisation is less concerned about allowing traffic from your local IP)
\ No newline at end of file diff --git a/reference/tutorials/extend/index.html b/reference/tutorials/extend/index.html index 076fae18..f118638a 100644 --- a/reference/tutorials/extend/index.html +++ b/reference/tutorials/extend/index.html @@ -1,4 +1,4 @@ - An overview of extending the Chaos Toolkit -
Skip to content

Learn the basic of extending the Chaos Toolkit

The Chaos Toolkit comes with a rich catalog of extensions. Sometimes however, this library is not enough. So, how do you go about extending the Chaos Toolkit?

It turns out there are a variety of ways.

Generate a binary and execute it from the experiment

The Chaos Toolkit is written in Python 3, but you may not have the Python skills or willingness to develop it. One quick solution is to write your own small binary (say you are a rust or golang shop) and call it as a process action. Keep in mind that the binary may be used as a probe in the steady-state so ensure its returned value is easily processed via regex or jsonpath tolerance types. At the very least, the process should signal through its exit code if it completed normally (with 0).

For example, let’s create a simple binary with rust. In a file named echo.rs:

use std::env;
+ An overview of extending the Chaos Toolkit -      

Learn the basic of extending the Chaos Toolkit

The Chaos Toolkit comes with a rich catalog of extensions. Sometimes however, this library is not enough. So, how do you go about extending the Chaos Toolkit?

It turns out there are a variety of ways.

Generate a binary and execute it from the experiment

The Chaos Toolkit is written in Python 3, but you may not have the Python skills or willingness to develop it. One quick solution is to write your own small binary (say you are a rust or golang shop) and call it as a process action. Keep in mind that the binary may be used as a probe in the steady-state so ensure its returned value is easily processed via regex or jsonpath tolerance types. At the very least, the process should signal through its exit code if it completed normally (with 0).

For example, let’s create a simple binary with rust. In a file named echo.rs:

use std::env;
 
 fn main() {
     let args: Vec<String> = env::args().collect();
@@ -54,4 +54,4 @@
 
kettle.py experiment.json
 
export PYTHONPATH=`pwd`
 chaos run experiment.json
-

The Python module does not have to live next to the experiment. It can also contain more than one function of course.

\ No newline at end of file +

The Python module does not have to live next to the experiment. It can also contain more than one function of course.

\ No newline at end of file diff --git a/reference/tutorials/run-flow/index.html b/reference/tutorials/run-flow/index.html index 1ee7a97e..21d610f5 100644 --- a/reference/tutorials/run-flow/index.html +++ b/reference/tutorials/run-flow/index.html @@ -1 +1 @@ - Understand the Execution Flow -
Skip to content

Learn all about the experiment execution’s flow

Execution Flow Diagram

The diagram below shows the flow used by Chaos Toolkit when running an experiment:

What’s happening when running an experiment?

Chaos Toolkit runs an experiment as given in the experiment’s file. The default behavior is straightforward, it runs the activities from the file sequentially in the order they are declared.

The first block executed, if found, is the steady-state hypothesis block. In this particular instances, it acts as a sort of a gateway to say “the system is normal and meeting its baseline, you can carry on”. By doing so, we notify the world is in a state which we can comprehend and make sense of.

Then, the method is applied. Usually the method consists of at least an action but can also contain probes and other actions. The first action defines the turbulence we want to introduce into the system and see if it impacts our initial baseline. Other actions should be few in numbers or they may render the reading of the results challenging. Probes are merely data collectors of what is happening in your system as the turbulence is happening. It helps the analysis.

Next, the steady state hypothesis is executed again but, this time, it tells us if our baseline has deviated considering the perturbation.

Finally, rollbacks are applied. They serve to usually undo the condition but should not be misunderstood as a way to put the system back to a normal state when the deviation really triggered a dire chain of events for your system.

One experiment but a variety of execution strategies

Schematically, the execution flow runs the hypothesis, the method, the hypothesis again and finally the rollbacks. However, this flow can somewhat controlled via the Chaos Toolkit runtime flags.

Hypothesis strategies

The default behavior is to execute the hypothesis before and after the method. Unless, the hypothesis fails during the “before” phase. In that case, the execution terminates as "failed" to signal the system wasn’t in an appropriate baseline state for the experiment to make sense.

The chaos run command provides the --hypothesis-strategy flag to change the default behavior.

Sometimes, you have an experiment where you know the state is not appropriate but you want to see if a specific condition could bring it back and make the hypothesis valid after the method was applied. In that case, you should use --hypothesis-strategy=after-method-only.

On the contrary, if you don’t want to assert any deviation, you can decide to run the hypothesis only before with --hypothesis-strategy=before-method-only.

More interesting use cases can then be applied. What if you have a long method and wish to not wait until it finishes to verify the hypothesis. Well, then you can use `--hypothesis-strategy=continuously to indicate that, on top of the default behavior, you want the hypothesis block to be applied during the method periodically. You can change the period, which defaults to every second, with --hypothesis-frequency=10. Notice that, in that case, Chaos Toolkit will not interrupt as soon as a deviation is found. To do that, you need to pass the additional --fail-fast flag.

Finally, you can also use --hypothesis-strategy=during-method-only to have the same behavior as continuously but removing the default verification before and after the method.

Rollback strategies

Rollbacks are always executed save for three conditions:

  • the hypothesis failed on its first pass. Before the method was applied. There is nothing to rollback in that case.
  • the Chaos Toolkit received a signal such as SIGINT. Maybe the operator wants to investigate the system as it is.
  • a control triggered an interruption

You may change that behavior with a chaos run flag.

Pass --rollback-strategy=always to apply rollbacks no matter the state of the execution.

Use --rollback-strategy=never to never play them. This can be useful during authoring of the experiment sometimes.

Use --rollback-strategy=deviated to play rollbacks only if a deviation was found.

Terminating the execution gracefully

Chaos Engineering is a powerful practice that may lead to undesirable side effects in your system. Sometimes, it is expected that an operator, or an automated service, terminates an experiment much earlier to prevent further difficulties.

Let’s start with the default behavior

When an experiment runs to its end it means that, even if a deviation was found, the Chaos Toolkit should leave nothing hanging around, such as zombie processes. Also, if rollbacks were declared and requested to be applied, they will be played. In other words, if your experiment is properly constructed, you should not have to do anything else.

Chaos Toolkit makes no promises that your system will be back to its normal however. The discovery you make along the way usually resolves in impacts that cannot be anticipated.

This means that when an experiment finishes, your system may well be in a very strange state but it does not mean Chaos Toolkit failed at doing its job. In fact, it’s quite the exact nature of the beast: Chaos Engineering is making those pain points very clear to all.

Experiments can be interrupted. In that case, Chaos Toolkit tries its best to abide by the runtime condition that you set. For instance, if you decided to always play the rollbacks, Chaos Toolkit will execute them. The default behavior is not to play them however for the simple reason that if you interrupted an experiment, you may well want to investigate the system and if rollbacks were executed, you may lose some important traces or state.

Digging into the interruption’s flow

When the Chaos Toolkit receives a signal, it starts the termination flow of the experiment:

  • When this happens during the first pass of the steady-state hypothesis block, this means the experiment finishes before its method is applied. In that case, rollbacks do not need to be played in any case.
  • When the signal is caught during the method, remaining activities are not executed and the current running experiment is completed. Rollbacks are played if the strategy requested they are played. Otherwise, they are ignored. If an activity is running in the background, the experiment will wait until it finishes.
  • When the signal is caught during the rollbacks, remaining actions are not played and the experiment finishes.

Reacting to signals, aka being a good citizen

The Chaos Toolkit knows it makes operators confident it will act appropriately upon receiving a variety of signals. It supports therefore the following signals:

  • SIGINT Mostly received when the operator hits Ctrl-C. This triggers the interruption flow.

  • SIGTERM This signal is often used by other processes to indicate the Chaos Toolkit process ought to terminate. For instance, this is the signal sent to Kubernetes pods (with a graceful period before the harsher SIGKILL)

  • SIGUSR1/SIGUSR2 (Unix only) These two signals are rarely sent by operators but are used so that experiment extension author can programmatically terminate the experiment without having to wait for any blocking operation.

In all cases, the termination flow is triggered. The only different one is SIGUSR2 which will always ignore rollbacks and will not wait for background activities to terminate normally. In other words, SIGUSR2 is the only way you can terminate harshly an experiment.

Otherwise, there are no visible difference between SIGINT, SIGTERM and SIGUSR1.

\ No newline at end of file + Understand the Execution Flow -
Skip to content

Learn all about the experiment execution’s flow

Execution Flow Diagram

The diagram below shows the flow used by Chaos Toolkit when running an experiment:

What’s happening when running an experiment?

Chaos Toolkit runs an experiment as given in the experiment’s file. The default behavior is straightforward, it runs the activities from the file sequentially in the order they are declared.

The first block executed, if found, is the steady-state hypothesis block. In this particular instances, it acts as a sort of a gateway to say “the system is normal and meeting its baseline, you can carry on”. By doing so, we notify the world is in a state which we can comprehend and make sense of.

Then, the method is applied. Usually the method consists of at least an action but can also contain probes and other actions. The first action defines the turbulence we want to introduce into the system and see if it impacts our initial baseline. Other actions should be few in numbers or they may render the reading of the results challenging. Probes are merely data collectors of what is happening in your system as the turbulence is happening. It helps the analysis.

Next, the steady state hypothesis is executed again but, this time, it tells us if our baseline has deviated considering the perturbation.

Finally, rollbacks are applied. They serve to usually undo the condition but should not be misunderstood as a way to put the system back to a normal state when the deviation really triggered a dire chain of events for your system.

One experiment but a variety of execution strategies

Schematically, the execution flow runs the hypothesis, the method, the hypothesis again and finally the rollbacks. However, this flow can somewhat controlled via the Chaos Toolkit runtime flags.

Hypothesis strategies

The default behavior is to execute the hypothesis before and after the method. Unless, the hypothesis fails during the “before” phase. In that case, the execution terminates as "failed" to signal the system wasn’t in an appropriate baseline state for the experiment to make sense.

The chaos run command provides the --hypothesis-strategy flag to change the default behavior.

Sometimes, you have an experiment where you know the state is not appropriate but you want to see if a specific condition could bring it back and make the hypothesis valid after the method was applied. In that case, you should use --hypothesis-strategy=after-method-only.

On the contrary, if you don’t want to assert any deviation, you can decide to run the hypothesis only before with --hypothesis-strategy=before-method-only.

More interesting use cases can then be applied. What if you have a long method and wish to not wait until it finishes to verify the hypothesis. Well, then you can use `--hypothesis-strategy=continuously to indicate that, on top of the default behavior, you want the hypothesis block to be applied during the method periodically. You can change the period, which defaults to every second, with --hypothesis-frequency=10. Notice that, in that case, Chaos Toolkit will not interrupt as soon as a deviation is found. To do that, you need to pass the additional --fail-fast flag.

Finally, you can also use --hypothesis-strategy=during-method-only to have the same behavior as continuously but removing the default verification before and after the method.

Rollback strategies

Rollbacks are always executed save for three conditions:

  • the hypothesis failed on its first pass. Before the method was applied. There is nothing to rollback in that case.
  • the Chaos Toolkit received a signal such as SIGINT. Maybe the operator wants to investigate the system as it is.
  • a control triggered an interruption

You may change that behavior with a chaos run flag.

Pass --rollback-strategy=always to apply rollbacks no matter the state of the execution.

Use --rollback-strategy=never to never play them. This can be useful during authoring of the experiment sometimes.

Use --rollback-strategy=deviated to play rollbacks only if a deviation was found.

Terminating the execution gracefully

Chaos Engineering is a powerful practice that may lead to undesirable side effects in your system. Sometimes, it is expected that an operator, or an automated service, terminates an experiment much earlier to prevent further difficulties.

Let’s start with the default behavior

When an experiment runs to its end it means that, even if a deviation was found, the Chaos Toolkit should leave nothing hanging around, such as zombie processes. Also, if rollbacks were declared and requested to be applied, they will be played. In other words, if your experiment is properly constructed, you should not have to do anything else.

Chaos Toolkit makes no promises that your system will be back to its normal however. The discovery you make along the way usually resolves in impacts that cannot be anticipated.

This means that when an experiment finishes, your system may well be in a very strange state but it does not mean Chaos Toolkit failed at doing its job. In fact, it’s quite the exact nature of the beast: Chaos Engineering is making those pain points very clear to all.

Experiments can be interrupted. In that case, Chaos Toolkit tries its best to abide by the runtime condition that you set. For instance, if you decided to always play the rollbacks, Chaos Toolkit will execute them. The default behavior is not to play them however for the simple reason that if you interrupted an experiment, you may well want to investigate the system and if rollbacks were executed, you may lose some important traces or state.

Digging into the interruption’s flow

When the Chaos Toolkit receives a signal, it starts the termination flow of the experiment:

  • When this happens during the first pass of the steady-state hypothesis block, this means the experiment finishes before its method is applied. In that case, rollbacks do not need to be played in any case.
  • When the signal is caught during the method, remaining activities are not executed and the current running experiment is completed. Rollbacks are played if the strategy requested they are played. Otherwise, they are ignored. If an activity is running in the background, the experiment will wait until it finishes.
  • When the signal is caught during the rollbacks, remaining actions are not played and the experiment finishes.

Reacting to signals, aka being a good citizen

The Chaos Toolkit knows it makes operators confident it will act appropriately upon receiving a variety of signals. It supports therefore the following signals:

  • SIGINT Mostly received when the operator hits Ctrl-C. This triggers the interruption flow.

  • SIGTERM This signal is often used by other processes to indicate the Chaos Toolkit process ought to terminate. For instance, this is the signal sent to Kubernetes pods (with a graceful period before the harsher SIGKILL)

  • SIGUSR1/SIGUSR2 (Unix only) These two signals are rarely sent by operators but are used so that experiment extension author can programmatically terminate the experiment without having to wait for any blocking operation.

In all cases, the termination flow is triggered. The only different one is SIGUSR2 which will always ignore rollbacks and will not wait for background activities to terminate normally. In other words, SIGUSR2 is the only way you can terminate harshly an experiment.

Otherwise, there are no visible difference between SIGINT, SIGTERM and SIGUSR1.

\ No newline at end of file diff --git a/reference/tutorials/tolerance/index.html b/reference/tutorials/tolerance/index.html index b511cc31..7a13103e 100644 --- a/reference/tutorials/tolerance/index.html +++ b/reference/tutorials/tolerance/index.html @@ -1,4 +1,4 @@ - Learn all about Steady-State Tolerances -
Skip to content

Learn all about Steady-State Hypothesis Tolerances

A Chaos Engineering experiment starts and ends with a steady-state hypothesis.

The objective is initially to act as a validation gateway whereby, if the steady-state is not met before we execute the method, then the experiment bails out. What can you learn from an unknown state already?

Then, once the method has been applied, the goal is understand if the system coped with the turbulence or if it deviated, implying a weakness may have been uncovered.

To achieve this, the Chaos Toolkit experiment expects you use probes to query your system’s state during the steady-state hypothesis. The validation of the probes’ output is performed by what we call tolerances.

Let’s get started with a basic example

Let’s take the simple experiment below:

{
+ Learn all about Steady-State Tolerances -      

Learn all about Steady-State Hypothesis Tolerances

A Chaos Engineering experiment starts and ends with a steady-state hypothesis.

The objective is initially to act as a validation gateway whereby, if the steady-state is not met before we execute the method, then the experiment bails out. What can you learn from an unknown state already?

Then, once the method has been applied, the goal is understand if the system coped with the turbulence or if it deviated, implying a weakness may have been uncovered.

To achieve this, the Chaos Toolkit experiment expects you use probes to query your system’s state during the steady-state hypothesis. The validation of the probes’ output is performed by what we call tolerances.

Let’s get started with a basic example

Let’s take the simple experiment below:

{
 "title": "Our default language is English",
 "description": "We find the expected English language in the file",
 "steady-state-hypothesis": {
@@ -382,4 +382,4 @@
     with open(path) as f:
         content = f.read()
         return re.compile(search_for).match(value["stdout"]) is not None
-

As you can see, the value argument is not declared but must exist in the signature of the function. It is injected by the Chaos Toolkit and is set to the probe’s output.

\ No newline at end of file +

As you can see, the value argument is not declared but must exist in the signature of the function. It is injected by the Chaos Toolkit and is set to the probe’s output.

\ No newline at end of file diff --git a/reference/usage/cli/index.html b/reference/usage/cli/index.html index f768c20b..c2fc1a99 100644 --- a/reference/usage/cli/index.html +++ b/reference/usage/cli/index.html @@ -1,4 +1,4 @@ - Overview -
Skip to content

Overview

The heart of the Chaos Toolkit is the chaos command line.

Activate the Python virtual environment

If you run the Chaos Toolkit directly, rather than using a container, always ensure you have activated the virtual environment so that it can be found along its dependencies:

source ~/.venvs/chaostk/bin/activate
+ Overview -      

Overview

The heart of the Chaos Toolkit is the chaos command line.

Activate the Python virtual environment

If you run the Chaos Toolkit directly, rather than using a container, always ensure you have activated the virtual environment so that it can be found along its dependencies:

source ~/.venvs/chaostk/bin/activate
 

Once installed, the Chaos Toolkit CLI will display the commands it supports by executing:

chaos --help
 
Usage: chaos [OPTIONS] COMMAND [ARGS]...
 
@@ -25,4 +25,4 @@
   validate  Validate the experiment at SOURCE.
 

Configure the Chaos Toolkit

For the most part, the Chaos Toolkit does not need to be configured. However, if it does, the settings are stored in a YAML file on your local machine.

Tip

Unless you enable one of the features requiring extra configuration, you don’t need to create that file. If a feature requires extra configuration, its documentation will say so.

Create the settings file

The settings file for the Chaos Toolkit should be located under the following path:

$HOME/.chaostoolkit/settings.yaml
 

As this file may hold sensitive data, it is advised to make it readable only for your own user:

chmod 600 $HOME/.chaostoolkit/settings.yaml
-

How to Investigate Issues

When your experiment fails to work as you would expect, you should start looking at the chaostoolkit.log file written to by the chaos command.

This file contains a lot of traces from the Chaos Toolkit core but also any extensions that used the toolkit’s logger.

As new logs are appended to that file, it may grow big. Do not hesitate to wipe it out from time to time.

Please, do make sure to visit our Slack or GitHub when you have a question around how the toolkit does things. The community will be pleased to help you out.

\ No newline at end of file +

How to Investigate Issues

When your experiment fails to work as you would expect, you should start looking at the chaostoolkit.log file written to by the chaos command.

This file contains a lot of traces from the Chaos Toolkit core but also any extensions that used the toolkit’s logger.

As new logs are appended to that file, it may grow big. Do not hesitate to wipe it out from time to time.

Please, do make sure to visit our Slack or GitHub when you have a question around how the toolkit does things. The community will be pleased to help you out.

\ No newline at end of file diff --git a/reference/usage/discover/index.html b/reference/usage/discover/index.html index 6be3ffb5..4858448c 100644 --- a/reference/usage/discover/index.html +++ b/reference/usage/discover/index.html @@ -1,4 +1,4 @@ - Discover -
Skip to content

The chaos discover command

You use the chaos discover command to specify a Chaos Toolkit integration extension and, if supported by the integration, to then explore your target environment in order to build a discovery report that can be used by the chaos init command to help you bootstrap your own chaos engineering experiments.

You can see the options available to you by executing:

chaos discover --help
+ Discover -      

The chaos discover command

You use the chaos discover command to specify a Chaos Toolkit integration extension and, if supported by the integration, to then explore your target environment in order to build a discovery report that can be used by the chaos init command to help you bootstrap your own chaos engineering experiments.

You can see the options available to you by executing:

chaos discover --help
 
Usage: chaos discover [OPTIONS] PACKAGE
 
   Discover capabilities and experiments.
@@ -29,4 +29,4 @@
 [2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.crd.actions
 [2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.crd.probes
 [2021-07-30 11:43:45 INFO] Discovery outcome saved in ./discovery.json
-

The chaos discover command will produce a report saved in ./discovery.json by default, although you can specify where this report is produced by supplying the --discovery-report-path option.

Discovery without System Information

To not probe the target system during the discovery process you can supply the --no-system-info option.

Discovery without Installation of an Integration Extension

If you already have the integration extension installed and available you can speed up the discovery process by specifying the --no-install option.

\ No newline at end of file +

The chaos discover command will produce a report saved in ./discovery.json by default, although you can specify where this report is produced by supplying the --discovery-report-path option.

Discovery without System Information

To not probe the target system during the discovery process you can supply the --no-system-info option.

Discovery without Installation of an Integration Extension

If you already have the integration extension installed and available you can speed up the discovery process by specifying the --no-install option.

\ No newline at end of file diff --git a/reference/usage/init/index.html b/reference/usage/init/index.html index ce7a0595..bdfc762e 100644 --- a/reference/usage/init/index.html +++ b/reference/usage/init/index.html @@ -1,4 +1,4 @@ - Init -
Skip to content

The chaos init command

You use the chaos init command to take a discovery report, usually created by the chaos discover command, to then create an experiment based upon what has been discovered about the integration extension and, if applicable, the target environment.

You can see the options available to you by executing:

chaos init --help
+ Init -      

The chaos init command

You use the chaos init command to take a discovery report, usually created by the chaos discover command, to then create an experiment based upon what has been discovered about the integration extension and, if applicable, the target environment.

You can see the options available to you by executing:

chaos init --help
 
Usage: chaos init [OPTIONS]
 
   Initialize a new experiment from discovered capabilities.
@@ -10,4 +10,4 @@
                           [default: ./experiment.json]
   --help                  Show this message and exit.
 

A tutorial on how to use the chaos init command is available as part of the Chaos Toolkit’s Getting Started tutorials.

Initialise a new experiment

To initialise a new experiment based on what has been discovered you simply need to execute the chaos init command:

chaos init
-
The following is a capture of the output after running chaos init and following the interactive prompts: [2018-01-30 15:54:50 INFO] Let's build a new experiment Experiment's title: My new experiment Add an activity to your method Activity (0 to escape): 1 Kill a microservice by `name` in the namespace `ns`. The microservice is killed by deleting the deployment for it without a graceful period to trigger an abrupt termination. The selected resources are matched by the given `label_selector`. Do you want to use this action? [y/N]: y Argument's value for 'name': Argument's value for 'ns' [default]: Argument's value for 'label_selector' [name in ({name})]: app=webapp-app Do you want to select another activity? [y/N]: N [2018-01-30 15:55:21 INFO] Experiment created and saved in './experiment.json'

By default, the chaos init command will look for a ./discovery.json file and use that as the basis of a new experiment’s initialisation.

You can specify another file to be used by suppling the --discovery-report-path option.

In addition the default output from the init command will be a new Chaos Toolkit experiment definition in a ./experiment.json file. If you would prefer a different filename then this can be specified using the --experiment-path option.

\ No newline at end of file +
The following is a capture of the output after running chaos init and following the interactive prompts: [2018-01-30 15:54:50 INFO] Let's build a new experiment Experiment's title: My new experiment Add an activity to your method Activity (0 to escape): 1 Kill a microservice by `name` in the namespace `ns`. The microservice is killed by deleting the deployment for it without a graceful period to trigger an abrupt termination. The selected resources are matched by the given `label_selector`. Do you want to use this action? [y/N]: y Argument's value for 'name': Argument's value for 'ns' [default]: Argument's value for 'label_selector' [name in ({name})]: app=webapp-app Do you want to select another activity? [y/N]: N [2018-01-30 15:55:21 INFO] Experiment created and saved in './experiment.json'

By default, the chaos init command will look for a ./discovery.json file and use that as the basis of a new experiment’s initialisation.

You can specify another file to be used by suppling the --discovery-report-path option.

In addition the default output from the init command will be a new Chaos Toolkit experiment definition in a ./experiment.json file. If you would prefer a different filename then this can be specified using the --experiment-path option.

\ No newline at end of file diff --git a/reference/usage/install/index.html b/reference/usage/install/index.html index 34942315..c72e9c0d 100644 --- a/reference/usage/install/index.html +++ b/reference/usage/install/index.html @@ -1,7 +1,7 @@ - Install -
Skip to content

How to Install the Chaos Toolkit

Python Requirements

The chaostoolkit CLI is implemented in Python 3 and this requires a working Python installation to run. It officially supports Python 3.7+. It has only been tested against CPython.

Install Python

Install Python for your system:

On MacOS X:

brew install python3
+ Install -      

How to Install the Chaos Toolkit

Python Requirements

The chaostoolkit CLI is implemented in Python 3 and this requires a working Python installation to run. It officially supports Python 3.7+. It has only been tested against CPython.

Install Python

Install Python for your system:

On MacOS X:

brew install python3
 

On Debian/Ubuntu:

sudo apt-get install python3 python3-venv
 

On Windows:

Download the latest binary installer from the Python website.

Create a virtual environment

Dependencies can be installed for your system via its package management but, more likely, you will want to install them yourself in a local virtual environment.

python3 -m venv ~/.venvs/chaostk
 

Make sure to always activate your virtual environment before using it:

source  ~/.venvs/chaostk/bin/activate
 

Tip

You may want to use virtualenvwrapper to make this process much nicer.

Install the CLI

Install chaostoolkit in the virtual environment as follows:

pip install -U chaostoolkit
 

You can verify the command was installed by running:

chaos --version
-

Install Extensions

At this stage, you have installed the chaos command line and its core library. To fully enjoy the Chaos Toolkit, you will also want to install extensions for the various facets of your journey into Chaos Engineering.

\ No newline at end of file +

Install Extensions

At this stage, you have installed the chaos command line and its core library. To fully enjoy the Chaos Toolkit, you will also want to install extensions for the various facets of your journey into Chaos Engineering.

\ No newline at end of file diff --git a/reference/usage/notification/index.html b/reference/usage/notification/index.html index 84615b78..c680de25 100644 --- a/reference/usage/notification/index.html +++ b/reference/usage/notification/index.html @@ -1,4 +1,4 @@ - Get Notifications From The Chaos Toolkit Flow -
Skip to content

Get Notifications From The Chaos Toolkit Flow

The Chaos Toolkit generates events when it is executed. You may benefit from those events to get notified via your chosen notification channels.

Chaos Toolkit Flow Events

The Chaos Toolkit defines the following events:

Discovery flow

  • "discover-started": when the discovery flow has begun
    • Payload: the name of the Chaos Toolkit extension used to discover the system
  • "discover-completed": when the discovery flow has completed
    • Payload: the result of the discovery
  • "discover-failed": when the discovery flow has failed
    • Payload: the name of the Chaos Toolkit extension usd to discover the system
    • Additional Payload: The error

Init flow

  • "init-started": when the init flow has begun
    • Payload: None
  • "init-completed": when the init flow has completed

Run flow

  • "run-started": when the run flow has begun
  • "run-completed": when the run flow has completed
    • Payload: The journal of the experiment’s execution
  • "run-failed": when the run flow has failed
    • Payload: The journal of the experiment’s execution

Validate flow

  • "validate-started": when the validate flow has begun
  • "validate-completed": when the validate flow has completed
  • "validate-failed": when the validate flow has failed
    • Payload: The experiment to validate
    • Additional Payload: The error

Notification Event Structure

The events structure is as follows:

{
+ Get Notifications From The Chaos Toolkit Flow -      

Get Notifications From The Chaos Toolkit Flow

The Chaos Toolkit generates events when it is executed. You may benefit from those events to get notified via your chosen notification channels.

Chaos Toolkit Flow Events

The Chaos Toolkit defines the following events:

Discovery flow

  • "discover-started": when the discovery flow has begun
    • Payload: the name of the Chaos Toolkit extension used to discover the system
  • "discover-completed": when the discovery flow has completed
    • Payload: the result of the discovery
  • "discover-failed": when the discovery flow has failed
    • Payload: the name of the Chaos Toolkit extension usd to discover the system
    • Additional Payload: The error

Init flow

  • "init-started": when the init flow has begun
    • Payload: None
  • "init-completed": when the init flow has completed

Run flow

  • "run-started": when the run flow has begun
  • "run-completed": when the run flow has completed
    • Payload: The journal of the experiment’s execution
  • "run-failed": when the run flow has failed
    • Payload: The journal of the experiment’s execution

Validate flow

  • "validate-started": when the validate flow has begun
  • "validate-completed": when the validate flow has completed
  • "validate-failed": when the validate flow has failed
    • Payload: The experiment to validate
    • Additional Payload: The error

Notification Event Structure

The events structure is as follows:

{
     "name": "run-started|...",
     "payload": "the payload for the given event",
     "phase": "run|discovery|init|validate",
@@ -33,4 +33,4 @@
     module: chaosslack.notification
     token: xop-1235
     channel: general
-

You may define as many channels as you need, for instance for different kind of events.

The token and channel fields are mandatory in this case. The token field must be set to a valid Slack token. You may start with a legacy token before moving on to a Slack App as per Slack guidelines.

The Chaos Toolkit itself does not provide a Slack App at this moment.

The channel must be a name of an existing channel. The payload message sent to Slack is defined in the plugin. If you need to amend it, please open an issue there.

Debugging Notifications

The Chaos Toolkit does its best to not break the experiment when an event could not be pushed. If you do not see the notification you were expecting, you should start investigating in the chaostoolkit.log file. If Chaos Toolkit could handle the issue gracefully, it will log the error at the DEBUG level.

If the error occurs inside the core Chaos Toolkit library, please raise an issue there. Otherwise, raise an issue with the appropriate plugin.

\ No newline at end of file +

You may define as many channels as you need, for instance for different kind of events.

The token and channel fields are mandatory in this case. The token field must be set to a valid Slack token. You may start with a legacy token before moving on to a Slack App as per Slack guidelines.

The Chaos Toolkit itself does not provide a Slack App at this moment.

The channel must be a name of an existing channel. The payload message sent to Slack is defined in the plugin. If you need to amend it, please open an issue there.

Debugging Notifications

The Chaos Toolkit does its best to not break the experiment when an event could not be pushed. If you do not see the notification you were expecting, you should start investigating in the chaostoolkit.log file. If Chaos Toolkit could handle the issue gracefully, it will log the error at the DEBUG level.

If the error occurs inside the core Chaos Toolkit library, please raise an issue there. Otherwise, raise an issue with the appropriate plugin.

\ No newline at end of file diff --git a/reference/usage/report/index.html b/reference/usage/report/index.html index e550779f..add17e67 100644 --- a/reference/usage/report/index.html +++ b/reference/usage/report/index.html @@ -1,4 +1,4 @@ - Report -
Skip to content

The chaos report command

You use the chaos report command to take the journal produced by the chaos run command and produce a report in a specified format.

Due to the many operating system-dependent features that the chaos report command relies upon, the chaos report command is not installed with the Chaos Toolkit CLI. To install the chaos report command you need to install the chaostoolkit-reporting plugin and the dependencies appropriate to your own operating system.

Once the plugin is installed you can see the options available to you by executing:

chaos report --help
+ Report -      

The chaos report command

You use the chaos report command to take the journal produced by the chaos run command and produce a report in a specified format.

Due to the many operating system-dependent features that the chaos report command relies upon, the chaos report command is not installed with the Chaos Toolkit CLI. To install the chaos report command you need to install the chaostoolkit-reporting plugin and the dependencies appropriate to your own operating system.

Once the plugin is installed you can see the options available to you by executing:

chaos report --help
 
Usage: chaos report [OPTIONS] [JOURNAL]... REPORT
 
   Generate a report from the run journal(s).
@@ -8,4 +8,4 @@
   --help                Show this message and exit.
 

A tutorial on how to use the chaos report command is available as part of the Chaos Toolkit’s Getting Started tutorials.

Generating a report

When an experiment completes after using the chaos run command a journal is generated and stored in the chaos-report.json file. A PDF or HTML report may be generated from this journal using the chaostoolkit-reporting library.

The chaos report command expects the path to the chaos-report.json file and a path to the actual report file that you require.

You can export various formats of report by specifying what you want using the --export-format option.

For example, to generate a PDF report you can run the following command:

chaos report --export-format=pdf chaos-report.json report.pdf
 

An HTML report can be produced using:

chaos report --export-format=html5 chaos-report.json report.html
-
\ No newline at end of file +
\ No newline at end of file diff --git a/reference/usage/run/index.html b/reference/usage/run/index.html index 4d5a2b1c..b30c34d2 100644 --- a/reference/usage/run/index.html +++ b/reference/usage/run/index.html @@ -1,4 +1,4 @@ - Run -
Skip to content

The chaos run command

You use the chaos run command to execute your declarative chaos engineering experiments. To see the options that can be passed to the chaos run command, execute:

chaos run --help
+ Run -      

The chaos run command

You use the chaos run command to execute your declarative chaos engineering experiments. To see the options that can be passed to the chaos run command, execute:

chaos run --help
 
Usage: chaos run [OPTIONS] SOURCE
 
   Run the experiment loaded from SOURCE, either a local file or a HTTP
@@ -102,4 +102,4 @@
         }
     }
 }
-

We are not overridding the configuration section and only part of the secrets section.

Finally, should you keep your variables in a .env file, it will only be able to override the configuration.

\ No newline at end of file +

We are not overridding the configuration section and only part of the secrets section.

Finally, should you keep your variables in a .env file, it will only be able to override the configuration.

\ No newline at end of file diff --git a/reference/usage/scheduling/index.html b/reference/usage/scheduling/index.html index c6502a5d..f7eb3fae 100644 --- a/reference/usage/scheduling/index.html +++ b/reference/usage/scheduling/index.html @@ -1 +1 @@ - Schedule -
Skip to content

Scheduling your Experiments

Scheduling is not built into the Chaos Toolkit itself. However it is common to want to run an experiment periodically when you may not be at the keyboard.

In these cases we recommend using a system such as cron to schedule your experiment executions. You can also use a Kubernetes job to give you full control over the lifecycle of that job using the common Kubernetes features.

\ No newline at end of file + Schedule -
Skip to content

Scheduling your Experiments

Scheduling is not built into the Chaos Toolkit itself. However it is common to want to run an experiment periodically when you may not be at the keyboard.

In these cases we recommend using a system such as cron to schedule your experiment executions. You can also use a Kubernetes job to give you full control over the lifecycle of that job using the common Kubernetes features.

\ No newline at end of file diff --git a/reference/usage/upgrade/index.html b/reference/usage/upgrade/index.html index 56edd976..ac1c39ac 100644 --- a/reference/usage/upgrade/index.html +++ b/reference/usage/upgrade/index.html @@ -1,2 +1,2 @@ - Upgrade -
Skip to content

How to Upgrade the Chaos Toolkit

You can update your Chaos Toolkit installation by executing:

pip install -U chaostoolkit
-
\ No newline at end of file + Upgrade -
Skip to content

How to Upgrade the Chaos Toolkit

You can update your Chaos Toolkit installation by executing:

pip install -U chaostoolkit
+
\ No newline at end of file diff --git a/reference/walkthrough/index.html b/reference/walkthrough/index.html index 83a0edb8..56c8ae02 100644 --- a/reference/walkthrough/index.html +++ b/reference/walkthrough/index.html @@ -1 +1 @@ - Chaos Toolkit Labs -
Skip to content

Learning Chaos Toolkit by Practicing

You can find progressive labs here to help you use Chaos Toolkit in much more realistic settings than the base tutorials.

\ No newline at end of file + Chaos Toolkit Labs -
Skip to content

Learning Chaos Toolkit by Practicing

You can find progressive labs here to help you use Chaos Toolkit in much more realistic settings than the base tutorials.

\ No newline at end of file diff --git a/resources/logos/index.html b/resources/logos/index.html index 39f2d888..551daa61 100644 --- a/resources/logos/index.html +++ b/resources/logos/index.html @@ -1 +1 @@ - Logos -
Skip to content
\ No newline at end of file + Logos -
Skip to content
\ No newline at end of file diff --git a/resources/slides/index.html b/resources/slides/index.html index c3a9ed6b..2714ce10 100644 --- a/resources/slides/index.html +++ b/resources/slides/index.html @@ -1 +1 @@ - Slides -
Skip to content

Chaos Toolkit Resources: Slides

The following is a growing collection of slides that can be used by anyone in the community when speaking about the Chaos Toolkit. These resources are licensed under the CC BY 4.0 license so you can use them wherever you like (presentations, web sites etc) as long as you attribute back to the Chaos Toolkit project:

\ No newline at end of file + Slides -
Skip to content

Chaos Toolkit Resources: Slides

The following is a growing collection of slides that can be used by anyone in the community when speaking about the Chaos Toolkit. These resources are licensed under the CC BY 4.0 license so you can use them wherever you like (presentations, web sites etc) as long as you attribute back to the Chaos Toolkit project:

\ No newline at end of file diff --git a/search/search_index.json b/search/search_index.json index 8aac0086..a424e581 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Chaos Engineering Experiments Automation","text":"

The Chaos Toolkit aims to be the simplest and easiest way to explore building your own Chaos Engineering Experiments. It also aims to define a vendor and technology independent way of specifying Chaos Engineering experiments by providing an Open API.

We suggest you start with the tutorials to get a feel for how the Chaos Toolkit can help you automate your Chaos Engineering effort. Once you are ready for your own experiments, have a look at the various driver extensions we support, which ranges from platforms to cloud providers while giving you tools to observe your system as you run your experiments.

Finally, if you came to contribute, you are more than welcome. Start with joining the community and read our references like the Open API which specifies the Chaos Toolkit experiment format.

Above all, have fun!

"},{"location":"deployment/k8s/operator/","title":"Deploy Chaos Toolkit as a Kubernetes Operator","text":"

Kubernetes operators are a popular approach to create bespoke controllers of any application on top of the Kubernetes API.

The Chaos Toolkit operator listens for experiment declarations and triggers a new Kubernetes pod, running the Chaos Toolkit with the specified experiment.

"},{"location":"deployment/k8s/operator/#deploy-the-operator","title":"Deploy the operator","text":"

The operator can be found on the Chaos Toolkit incubator.

It is deployed via typical Kubernetes manifests which need to be applied via Kustomize, the native configuration manager.

First, download the Kustomize binary:

curl -s \"https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh\" | bash\n

For macOS, you can also install it via the Homebrew package manager:

brew install kustomize\n

Next, simply run the following:

kustomize build manifests/overlays/generic-rbac | kubectl apply -f -\n

This will build the manifests and apply them on your current default cluster. Notice how we use the RBAC variant of the deployment. If you have other requirements (no-RBAC, pod security or network policies), then check the operator\u2019s documentation to deploy the appropriate variant.

You can install another variant as follows:

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl apply -f -\n

By now, you should have the operator running in the chaostoolkit-crd.

kubectl -n chaostoolkit-crd get pods\nNAME                                READY   STATUS    RESTARTS   AGE\nchaostoolkit-crd-7ddb9b78d9-dgxx7   1/1     Running   0          35s\n
"},{"location":"deployment/k8s/operator/#what-the-operator-creates-deletes","title":"What the operator creates & deletes","text":"

The operator deployment creates two namespaces, by default: - the chaostoolkit-crd namespace contains the operator pod and Chaos Toolkit experiment definitions - the chaostoolkit-run namespace contains pods running the Chaos Toolkit experiments

When you apply an experiment object, the following other objects are created in the chaostoolkit-run namespace:

On top of that, if you setup a schedule, a cron job object is created too.

In all cases, when you delete the experiment, all these objects are also deleted.

"},{"location":"deployment/k8s/operator/#options","title":"Options","text":"

All the options are hanging under the spec element of the ChaosToolkitExperiment kind object.

apiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\n...\n

None of these options are required.

Option Path Description Value Type Default Value namespace: Namespace where to create the experiment objects string chaostoolkit-run serviceaccount:\u00a0\u00a0name: Name of the service account to attach to the experiment pod string chaostoolkit role:\u00a0\u00a0name: Name of the role to attach to the experiment pod string chaostoolkit-experiment role:\u00a0\u00a0bind: Name of the rolebinding to attach to the experiment pod string chaostoolkit-experiment role:\u00a0\u00a0binds_to_namespaces: List of namespaces to add the role and its binding to list[string] [] pod:\u00a0\u00a0configMapName: Name of the config map to attach to the experiment pod string chaostoolkit-env pod:\u00a0\u00a0image: Name of if the image to use for the pod string chaostoolkit/chaostoolkit:latest pod:\u00a0\u00a0env:\u00a0\u00a0\u00a0\u00a0enabled: Do we mount environment variables from the config map into the pod? boolean true pod:\u00a0\u00a0env:\u00a0\u00a0\u00a0\u00a0secretName: Mount the secrets values from this secret as environment variables string \"\" pod:\u00a0\u00a0settings:\u00a0\u00a0\u00a0\u00a0enabled: Should we mount settings as a file to the pod boolean false pod:\u00a0\u00a0settings:\u00a0\u00a0\u00a0\u00a0secretName: Mount the given secret holding Chaos Toolkit settings as a file to the pod string chaostoolkit-settings pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0asFile: Mount the experiment\u2019s payload as file (if true) or from a URL boolean true pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0configMapName: Name of the config map holding the experiment\u2019s payload string chaostoolkit-experiment pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0configMapExperimentFileName: Name of experiment file mounted into the container string experiment.json pod:\u00a0\u00a0chaosArgs: Replace the default pod\u2019s arguments with these ones list[string] [] schedule:\u00a0\u00a0kind: Cron kind (only CronJob supported) string cronjob schedule:\u00a0\u00a0value: Cron-like schedule syntax string \"\""},{"location":"deployment/k8s/operator/#run-an-experiment","title":"Run an experiment","text":"

Now that your controller is listening, you can ask it to schedule a Chaos Toolkit experiment by applying a resource with the following API:

apiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\n

Below is a basic example, assuming a file named basic.yaml:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment\nnamespace: chaostoolkit-run\ndata:\nexperiment.json: |\n{\n\"title\": \"Hello world!\",\n\"description\": \"Say hello world.\",\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"say-hello\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"echo\",\n\"arguments\": \"hello\"\n}\n}\n]\n}\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\n

First, we will use the default namespace in which the Chaos Toolkit will run.

Then, we need a config map to pass the experiment to execute.

Finally, we simply create a ChaosToolkitExperiment object that the controller picks up and understand as a new experiment to run in its own pod.

Apply it as follows:

kubectl apply -f basic.yaml\n

Then, you can check the Chaos Toolkit experiment has been registered, and will be scheduled to run as soon as possible:

kubectl -n chaostoolkit-crd get ctks\n

Look at the Chaos Toolkit running:

kubectl -n chaostoolkit-run get pods\n

The status of the experiment\u2019s run, if it deviated, defines the status if the pod. So, when the experiment does deviate, the pod should have a status set to Error. Otherwise, the status will be Completed.

"},{"location":"deployment/k8s/operator/#manage-the-chaos-toolkit-experiments","title":"Manage the Chaos Toolkit Experiments","text":""},{"location":"deployment/k8s/operator/#list-and-inspect-experiments","title":"List and inspect experiments","text":"

You can list your experiments as follows:

kubectl -n chaostoolkit-crd get chaosexperiments \n

You can describe one experiment as follows:

kubectl -n chaostoolkit-crd describe chaosexperiment my-chaos-exp \n

You can also use the short names for the custom resource ctks and ctk.

"},{"location":"deployment/k8s/operator/#delete-the-experiment-runs-resources","title":"Delete the experiment run\u2019s resources","text":"

You can delete an experiment and its related resources as follows:

kubectl -n chaostoolkit-crd delete ctk my-chaos-exp \n

However, the custom resources (ConfigMap, Secrets, etc.) won\u2019t be deleted. This command only deletes the resources that the operator creates for the experiment to be able to run.

To delete all the run\u2019s resources, simply delete the objects as follows:

kubectl delete -f basic.yaml\n
"},{"location":"deployment/k8s/operator/#various-configurations","title":"Various configurations","text":"

You may decide to change various aspects of the final pod (such as passing settings as secrets, changing the roles allowed to the pod, even override the entire pod template).

"},{"location":"deployment/k8s/operator/#make-the-operator-more-verbose","title":"Make the operator more verbose","text":"

By default, the operator logs at INFO level. To enable the DEBUG level, you need to change the operator\u2019s deployment command:

In the file manifests/base/common/deployment.yaml:

Change:

  - name: crd\nimage: chaostoolkit/k8scrd:latest\nimagePullPolicy: Always\n

to:

  - name: crd\nimage: chaostoolkit/k8scrd:latest\nimagePullPolicy: Always\ncommand:\n- kopf\nargs:\n- run\n- --verbose\n- --namespace\n- chaostoolkit-crd\n- controller.py\n

Then re-deploy using Kustomize.

"},{"location":"deployment/k8s/operator/#configure-the-toolkit-with-environment-variables","title":"Configure the toolkit with environment variables","text":"

Chaos Toolkit experiments often expect data to be passed as environment variables of the chaos\u2019s command shell.

The operator allows you to specify those values through the config map:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-env\nnamespace: chaostoolkit-run\ndata:\nNAME: \"Jane Doe\"\n

They will be injected into the Chaos Toolkit\u2019s pod as environment variables.

You might need several environment config maps for various experiments. You can tell the operator where to find the config map to be loaded as environment variables.

We\u2019ll assume you defined another config map named my-chaos-env-vars. You can use it by setting the configMapName in the env block of the pod spec:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nconfigMapName: my-chaos-env-vars\n

You can disable loading environment variables into the pod by using the enabled property:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nenabled: false\n

Plain text environment variables might not be secure enough in some use cases, such as database user name & passord, API keys, tokens, etc. You can define multiple encrypted key-value pairs in a Kubernetes secret and load them as environment variables. To to so, you shall indicate the name of the secret with the secretName property.

Assuming you created a generic secret named chaostoolkit-secrets, you can load the values as shown below:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nsecretName: chaostoolkit-secrets\n

All the key-value pairs from the secret will be injected into the Chaos Toolkit\u2019s pod as environment variables.

"},{"location":"deployment/k8s/operator/#handle-multiple-experiment-files","title":"Handle multiple experiment files","text":"

In the basic example, the name of the config map holding the experiment is the default value chaostoolkit-experiment. Usually, you\u2019ll want a more unique name since you\u2019ll probably run multiple experiments from the chaostoolkit-run namespace.

In that case, do it as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment-1234\nnamespace: chaostoolkit-run\ndata:\nexperiment.json: |\n{\n\"title\": \"...\",\n}\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nconfigMapName: chaostoolkit-experiment-1234\n

You need to define the configMapName in the experiment block of the pod spec.

"},{"location":"deployment/k8s/operator/#use-the-experiment-in-yaml-format","title":"Use the experiment in YAML format","text":"

If your experiments are encoded using YAML, you can set it as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment-1234\nnamespace: chaostoolkit-run\ndata:\nexperiment.yaml: |\n---\ntitle: \"...\"\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nconfigMapName: chaostoolkit-experiment-1234\nconfigMapExperimentFileName: experiment.yaml\n
"},{"location":"deployment/k8s/operator/#load-the-experiment-from-a-url","title":"Load the experiment from a URL","text":"

By default, the experiment is read from a file. But you may store it remotely e.g. GitHub and have it available over HTTP. You might want to load it from its remote URL instead.

You can tell the Chaos Toolkit to load it from a remote URL rather than from a local file, as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-env\nnamespace: chaostoolkit-run\ndata:\nEXPERIMENT_URL: \"https://example.com/experiment.json\"\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nasFile: false\n

First, you need to pass the EXPERIMENT_URL environment variable.

Then, tell the operator not to mount the default experiment volume. To do so, you need to set asFile to false in the experiment block of the pod spec.

"},{"location":"deployment/k8s/operator/#run-experiments-in-another-namespace","title":"Run experiments in another namespace","text":"

You may create the namespace in which the resources will be deployed:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: my-other-namespace\n

You need to defined the namespace value at the spec level.

If the namespace already exists, a message will be logged but this will not abort the operation.

However, this namespace will be entirely under your responsibility. No network nor pod securities will be managed in your namespace, if the operator was installed with those variants. You\u2019ll need to manage them yourself.

"},{"location":"deployment/k8s/operator/#pass-chaos-toolkit-settings-as-a-kubernetes-secret","title":"Pass Chaos Toolkit settings as a Kubernetes secret","text":"

Chaos Toolkit reads its settings from a file and you can pass yours by creating a Kubernetes secret named, by default, chaostoolkit-settings.

For instance, assuming you have a Chaos Toolkit settings file, you can create a secret from it as follows:

kubectl -n chaostoolkit-run \\\n    create secret generic chaostoolkit-settings \\\n    --from-file=settings.yaml=./settings.yaml\n

Note, the settings file must be named as settings.yaml within the secret.

Reading settings is disabled by default, so you need to let the operator know it should allow it for that run:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nsettings:\nenabled: true\n

You need to set the variable enabled to truein the settings block of the pod spec.

The default name for that secret is chaostoolkit-settings but you can change it with the secretName variable, as follows:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nsettings:\nenabled: true\nsecretName: my-super-secret\n
"},{"location":"deployment/k8s/operator/#keep-generated-resources-even-when-the-cro-is-deleted","title":"Keep generated resources even when the CRO is deleted","text":"

When you delete the ChaosToolkitExperiment resource, all the allocated resources are deleted too (pod, service account, \u2026). To prevent this, you may set the keep_resources_on_delete property to true at the spec level.

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nkeep_resources_on_delete: true\n

In that case, you are responsible to cleanup all resources.

"},{"location":"deployment/k8s/operator/#pass-your-own-role-to-bind-to-the-service-account","title":"Pass your own role to bind to the service account","text":"

If your cluster has enabled RBAC, then the operator automatically binds a basic role to the service account associated with the chaostoolkit pod. That role allows your experiment to create/get/list/delete other pods in the same namespace.

You probably have more specific requirements, here is how to do it:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nrole:\nname: my-role\n

The property name should be set to the name of the role you have created in the namespace which the experiment is executed in. The service account associated with the pod will be bound to that role.

"},{"location":"deployment/k8s/operator/#override-the-default-chaos-command-arguments","title":"Override the default chaos command arguments","text":"

The pod template executes the chaos run command by default. You may want to extends or change the sub-command to execute when running the pod. You can define the chaos arguments as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nchaosArgs:\n- --verbose\n- run\n- --dry\n- $(EXPERIMENT_PATH)\n

You need to set the list of arguments in the chaosArgs variable at pod spec level.

"},{"location":"deployment/k8s/operator/#label-your-chaos-toolkit-experiment","title":"Label your Chaos Toolkit experiment","text":"

Experiment labels can be defined in the ChaosToolkitExperiment\u2019s metadata. All labels will be forwarded, if not already defined, in the pod running the experiment.

You can define labels as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nlabels:\nenvironment: staging\ntier: backend\ntarget: database\n

These labels can then be used as selectors.

"},{"location":"deployment/k8s/operator/#allow-network-traffic-for-chaos-toolkit-experiments","title":"Allow network traffic for Chaos Toolkit experiments","text":"

When the operator is installed with the network security variant, the chaostoolkit pod has limited network access. The pod is, by default, isolated for ingress connectivity and is limited to only DNS lookup & HTTPS for external traffic.

To allow the pod for other access, you may create another network policy within the chaostoolkit-run namespace for pods matching the app: chaostoolkit label:

---\nkind: NetworkPolicy\napiVersion: networking.k8s.io/v1\nmetadata:\nname: my-custom-network-policy\nnamespace: chaostoolkit-run\nspec:\npodSelector:\nmatchLabels:\napp: chaostoolkit\n
"},{"location":"deployment/k8s/operator/#run-periodic-and-recurring-experiments","title":"Run periodic and recurring experiments","text":"

The operator supports crontab schedule for running Chaos Toolkit experiments periodically on a given schedule.

To do so, you can define a .spec.schedule section, as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nschedule:\nkind: cronJob\nvalue: \"*/1 * * * *\"\n

This example runs a Chaos Toolkit experiment every minute.

You can list your scheduled experiments with the kubernetes\u2019 cronjob resource:

kubectl -n chaostoolkit-run get cronjobs\n
"},{"location":"deployment/k8s/operator/#run-an-experiment-with-specific-extensions","title":"Run an experiment with specific extensions","text":"

The default container image used by the operator is the official Chaos Toolkit image which embeds no Chaos Toolkit extensions.

This means that you will likely need to create your bespoke container image. For instance, to install the Chaos Toolkit Kubernetes extension, create a Dockerfile like this:

FROM chaostoolkit/chaostoolkit\n\nUSER root\nRUN apk update && \\\napk add --virtual build-deps libffi-dev openssl-dev gcc python3-dev \\\nmusl-dev && \\\npip install --no-cache-dir chaostoolkit-addons chaostoolkit-reliably && \\\napk del build-deps\nUSER 1001\n

Then create the image with docker:

docker build --tag my/chaostoolkit -f ./Dockerfile .\n

or, something such as Podman:

podman build --tag my/chaostoolkit -f ./Dockerfile\n

You can check your image contains the installed extensions as follows:

docker run --rm -it my/chaostoolkit info extensions\n

Once this image is pushed to any registry you can access, you need to let the operator know it must use it.

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nimage: my/chaostoolkit\n

Tip

Note that the first time the job will create a pod will be at the end of the first period.

"},{"location":"deployment/k8s/operator/#uninstall-the-operator","title":"Uninstall the operator","text":"

To uninstall the operator and its own resources, simply run the following command for the overlay that is deployed.

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl delete -f -\n
"},{"location":"drivers/addons/","title":"Extension chaosaddons","text":"Version 0.8.6 Repository https://github.com/chaostoolkit/chaostoolkit-addons

This project provides a set of commnly requested actions, probes, tolerances or controls that can benefit the community.

"},{"location":"drivers/addons/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-addons\n
"},{"location":"drivers/addons/#develop","title":"Develop","text":""},{"location":"drivers/addons/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/addons/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/addons/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/addons/#bypass","title":"bypass","text":"

Sets the dry property on activities that match either by type or by names.

This allows to bypass some activities in certain contexts. For instance, you want to run on development but not in production certain actions.

For instance, to bypass the execution of the say-hello activity:

\"controls\": [\n{\n\"name\": \"bypass-actions\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\",\n\"arguments\": {\n\"target_names\": [\n\"say-hello\"\n]\n}\n}\n}\n],\n

For instance, to bypass the execution of all actions in the experiment:

\"controls\": [\n{\n\"name\": \"bypass-actions\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\",\n\"arguments\": {\n\"target_type\": \"action\"\n}\n}\n}\n],\n

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True False Steady-state Hypothesis False False Method False False Rollback False False Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.bypass\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#repeat","title":"repeat","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.repeat\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.repeat\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#safeguards","title":"safeguards","text":"

The safeguard control provides a mechanism to keep an eye on the system while running an experiment to decide if the experiment ought to stop as soon as possible or not.

For instance, let\u2019s say your system detects a dire condition that has nothing to do with this experiment. It may decide it\u2019s time for the experiment to terminate as it could create even more noise or problems.

To use this control, simply add the following to your global (or per experiment) controls block:

\"controls\": [\n{\n\"name\": \"safeguard\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.safeguards\",\n\"arguments\": {\n\"probes\": [\n{\n\"name\": \"safeguard_1\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"background\": true,\n\"tolerance\": true\n},\n{\n\"name\": \"safeguard_2\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"tolerance\": true\n},\n{\n\"name\": \"safeguard_3\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"frequency\": 2,\n\"tolerance\": true\n}\n]\n}\n}\n}\n],\n

In this example, we declare three safeguard probes. The first one will run once in the background as soon as possible. The second one will run once before the experiment starts. The third one will run repeatedly every 2 seconds.

If either of them doesn\u2019t meet its tolerance, the entire execution will terminate as soon as possible and leave the status of the experiment to interrupted.

Probes that do not declare the background or frequency properties are meant to run before the experiment really starts and will block until they are all finished. This offers a mechanism for pre-checking the system\u2019s health.

When the properties are set, the probes run as soon as possible but do not block the experiment from carrying on.

Bear in mind that your probes can also block the process from exiting. This means that while the experiment has ended, your probe could be not returning and therefore blocking the process. Make sure your probe do not make blocking calls for too long.

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control True Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.safeguards\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.safeguards\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#synchronization","title":"synchronization","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.synchronization\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.synchronization\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/addons/#controls","title":"controls","text":""},{"location":"drivers/addons/#utils","title":"utils","text":""},{"location":"drivers/addons/#idle_for","title":"idle_for","text":"Type Module chaosaddons.utils.idle Name idle_for Return null

Pauses the experiment without blocking the process completely.

Signature:

def idle_for(duration: float) -> None:\n    pass\n

Arguments:

Name Type Default Required duration number Yes

Usage:

JSONYAML
{\n\"name\": \"idle-for\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.utils.idle\",\n\"func\": \"idle_for\",\n\"arguments\": {\n\"duration\": null\n}\n}\n}\n
name: idle-for\nprovider:\narguments:\nduration: null\nfunc: idle_for\nmodule: chaosaddons.utils.idle\ntype: python\ntype: ''\n
"},{"location":"drivers/ansible/","title":"Extension chaosansible","text":"Version IN_PROGESS Repository https://github.com/Mickael-Roger/chaostoolkit-ansible

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Please NOTE This extension is in the early stages of development. Please feel free to create an issue in case of needed enhancement or misfunctioning.

"},{"location":"drivers/ansible/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

pip install -U chaostoolkit-ansible\n
"},{"location":"drivers/ansible/#principles","title":"Principles","text":"

This chaos toolkit driver provides you an easy way to execute probe and/or actions using ansible modules. By using it, you can execute tasks, gather facts, \u2026 on remote systems

"},{"location":"drivers/ansible/#usage","title":"Usage","text":""},{"location":"drivers/ansible/#basic","title":"Basic","text":""},{"location":"drivers/ansible/#probes","title":"Probes","text":"

To use the probes from this package, add the following to your experiment file:

In JSON:

\"steady-state-hypothesis\": {\n\"title\": \"Tests\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"test-current-directory\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.*.task\",\n\"expect\": \"/home/me\"\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.probes\",\n\"func\": \"chaosansible_probe\",\n\"arguments\": {\n\"host_list\": [\"myserver1\", \"myserver2\"],\n\"facts\": \"yes\",\n\"ansible\": {\n\"module\": \"shell\",\n\"args\": \"pwd\"\n}\n}\n}\n}\n]\n}\n

In YAML:

---\nsteady-state-hypothesis:\ntitle: The current working directory must be /home/me\nprobes:\n- type: probe\nname: test-current-directory\ntolerance:\ntype: jsonpath\ntarget: \"$.*.task\"\npattern: /home/me\nprovider:\ntype: python\nmodule: chaosansible.probes\nfunc: chaosansible_probe\narguments:\nhost_list: [\"myserver1\", \"myserver2\"]\nfacts: True\nansible:\nmodule: shell\nargs: pwd\n

That\u2019s it!

Probes can be gathered by using the stdout of an ansible task or through the ansible gather_facts module. Each time chaostoolkit-ansible runs, it returns a json that can be used in tolerance (using jsonpath, regex, \u2026)

This json is always formatted the same way (Example for a two targets host_list):

{\n\"target1\": {\n\"fact\": \" -> JSON result of the ansible gather_facts\",\n\"task\": \" -> String result containing the stdout value of the task result - Empty when ansible task do not return stdout\"\n},\n\"target2\": {\n\"fact\": \"...\",\n\"task\": \"...\"\n}\n}\n
"},{"location":"drivers/ansible/#actions","title":"Actions","text":"

To use the actions from this package, add the following to your experiment file:

In JSON:

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\", \"server2\"],\n\"become\": true,\n\"ansible\": {\n\"module\": \"file\",\n\"args\": {\n\"path\": \"/etc/hosts\",\n\"state\": \"absent\"\n}\n}\n}\n}\n}\n]\n

In YAML:

---\nmethod:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\", \"server2\"]\nbecome: True\nansible:\nmodule: file\nargs: path: /etc/hosts\nstate: absent\n

"},{"location":"drivers/ansible/#detailled-usage","title":"Detailled usage","text":""},{"location":"drivers/ansible/#configuration-block","title":"Configuration block","text":"

The configuration block can be used to specify specific parameters to use. This block can be omit unless you really need to change default ansible parameters to run your experiment

Configuration variables that can be used by this driver are:

In case you need to change one/or many default configuration(s), you can specify your value using the configuration block

Please feel free to ask, if you need access to other ansible configuration parameters

In JSON:

\"configuration\": {\n\"ansible_ssh_private_key\": \"/home/me/.ssh/mykey\"\n}\n

In YAML:

configuration:\nansible_ssh_private_key: \"/home/me/.ssh/mykey\"\n

"},{"location":"drivers/ansible/#arguments","title":"Arguments","text":"

chaosansible_run and chaosansible_probes use arguments (Most argument are classical ansible parameters):

Argument Type Required Default value Description host_list Array localhost List of host to use facts bool false Gather_facts become bool false Escalate privilege to run task run_once bool false Run the task only once on one target num_target str all \u201call\u201d or \u201cx\u201d where x is an integer. Run the task to only x target among the host_list. Ideal to create random event ansible dict {} Execute ansible task. Cf ansible dict format. If ansible is not set, no task except ansible gather_facts (if facts set to True)

Ansible dict format:

Classic ansible task are in the form:

name: task name\nansible-module-name:\nmodule-parameter1: value1\nmodule-parameter2: value2\n

This is translate into chaos experiment file like this: In JSON

  \"ansible\": {\n\"module\": \"ansible-module-name\",\n\"args\": {\n\"module-parameter1\": \"value1\",\n\"module-parameter2\": \"value2\"\n}\n}\n

In YAML

  ansible:\nmodule: ansible-module-name\nargs:\nmodule-parameter1: value1\nmodule-parameter2: value2\n

Example with the ansible mount module (Umount a filesystem):

In JSON

  \"ansible\": {\n\"module\": \"mount\",\n\"args\": {\n\"path\": \"/data\",\n\"state\": \"unmounted\"\n}\n}\n

In YAML

  ansible:\nmodule: mount\nargs:\npath: /data\nstate: unmounted\n

"},{"location":"drivers/ansible/#example-of-usage","title":"Example of usage","text":""},{"location":"drivers/ansible/#delete-etchosts-file-on-2-random-servers-out-of-5","title":"Delete /etc/hosts file on 2 random servers out of 5","text":"

In JSON

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"],\n\"num_target\": \"2\",\n\"become\": true,\n\"ansible\": {\n\"module\": \"file\",\n\"args\": {\n\"path\": \"/etc/hosts\",\n\"state\": \"absent\"\n}\n}\n}\n}\n}\n]\n

In YAML

method:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"]\nbecome: True\nnum_target: \"2\"\nansible:\nmodule: file\nargs: path: /etc/hosts\nstate: absent\n

"},{"location":"drivers/ansible/#run-100-cpu-load-on-3-server-out-of-5","title":"Run 100% cpu load on 3 server out of 5","text":"

In JSON

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"],\n\"num_target\": \"3\",\n\"ansible\": {\n\"module\": \"shell\",\n\"args\": {\n\"cmd\": \"stress-ng --cpu 0 --cpu-method matrixprod -t 60s\",\n}\n}\n}\n}\n}\n]\n

In YAML

method:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"]\nbecome: True\nnum_target: \"3\"\nansible:\nmodule: shell\nargs: cmd: stress-ng --cpu 0 --cpu-method matrixprod -t 60s\n

"},{"location":"drivers/ansible/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/ansible/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/ansible/#test","title":"Test","text":"

To run the tests for the project execute the following:

pytest\n
"},{"location":"drivers/ansible/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/ansible/#actions_1","title":"actions","text":""},{"location":"drivers/ansible/#chaosansible_run","title":"chaosansible_run","text":"Type action Module chaosansible.actions Name chaosansible_run Return None

Run a task through ansible and eventually gather facts from host

Signature:

def chaosansible_run(host_list: list = 'localhost',\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     facts: bool = False,\n                     become: bool = False,\n                     run_once: bool = False,\n                     ansible: dict = {},\n                     num_target: str = 'all',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required host_list list \u201clocalhost\u201d No facts boolean false No become boolean false No run_once boolean false No ansible mapping {} No num_target string \u201call\u201d No

Usage:

{\n\"name\": \"chaosansible-run\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\"\n}\n}\n
name: chaosansible-run\nprovider:\nfunc: chaosansible_run\nmodule: chaosansible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/ansible/#probes_1","title":"probes","text":""},{"location":"drivers/ansible/#chaosansible_probe","title":"chaosansible_probe","text":"Type probe Module chaosansible.probes Name chaosansible_probe Return None

Run a task through ansible and eventually gather facts from host

Signature:

def chaosansible_probe(host_list: list = 'localhost',\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       facts: bool = False,\n                       become: bool = False,\n                       run_once: bool = False,\n                       ansible: dict = {},\n                       num_target: str = 'all',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required host_list list \u201clocalhost\u201d No facts boolean false No become boolean false No run_once boolean false No ansible mapping {} No num_target string \u201call\u201d No

Usage:

{\n\"name\": \"chaosansible-probe\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.probes\",\n\"func\": \"chaosansible_probe\"\n}\n}\n
name: chaosansible-probe\nprovider:\nfunc: chaosansible_probe\nmodule: chaosansible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/","title":"Extension chaosaws","text":"Version 0.23.4 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-aws

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/aws/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-aws\n
"},{"location":"drivers/aws/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"name\": \"stop-an-ec2-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"arguments\": {\n\"instance_id\": \"i-123456\"\n}\n}\n},\n{\n\"name\": \"create-a-new-policy\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"create_policy\",\n\"arguments\": {\n\"name\": \"mypolicy\",\n\"path\": \"user/Jane\",\n\"policy\": {\n\"Version\": \"2012-10-17\",\n\"Statement\": [\n{\n\"Effect\": \"Allow\",\n\"Action\": [\n\"s3:ListAllMyBuckets\",\n\"s3:GetBucketLocation\"\n],\n\"Resource\": \"arn:aws:s3:::*\"\n}\n]\n}\n}\n}\n}\n

Or select one at random from an AZ:

{\n\"name\": \"stop-an-ec2-instance-in-az-at-random\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"arguments\": {\n\"az\": \"us-west-1\"\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/aws/#configuration","title":"Configuration","text":""},{"location":"drivers/aws/#credentials","title":"Credentials","text":"

This extension uses the boto3 library under the hood. This library expects that you have properly configured your environment to connect and authenticate with the AWS services.

"},{"location":"drivers/aws/#use-default-profile-from-awscredentials-or-awsconfig","title":"Use default profile from ~/.aws/credentials or ~/.aws/config","text":"

This is the most basic case, assuming your default profile is properly configured in ~/.aws/credentials (or ~/.aws/config), then you do not need to pass any specific credentials to the experiment.

"},{"location":"drivers/aws/#use-a-non-default-profile-from-awscredentials-or-awsconfig","title":"Use a non-default profile from ~/.aws/credentials or ~/.aws/config","text":"

Assuming you have configure a profile in your ~/.aws/credentials (or ~/.aws/config) file, you may declare it in your experiment as follows:

{\n\"configuration\": {\n\"aws_profile_name\": \"dev\"\n}\n}\n

Your ~/.aws/credentials should look like this:

[dev]\naws_access_key_id = XYZ\naws_secret_access_key = UIOPIY\n

Or, your ~/.aws/config should look like this:

[profile dev]\noutput = json\naws_access_key_id = XYZ\naws_secret_access_key = UIOPIY\n
"},{"location":"drivers/aws/#assume-an-arn-role-from-a-non-default-profile","title":"Assume an ARN role from a non-default profile","text":"

Assuming you have configure a profile in your ~/.aws/config file with a specific ARN role you want to assume during the run:

{\n\"configuration\": {\n\"aws_profile_name\": \"dev\"\n}\n}\n

Your ~/.aws/config should look like this:

[default]\noutput = json\n\n[profile dev]\nrole_arn = arn:aws:iam::XXXXXXX:role/role-name\nsource_profile = default\n
"},{"location":"drivers/aws/#assume-an-arn-role-from-within-the-experiment","title":"Assume an ARN role from within the experiment","text":"

You mays also assume a role by declaring the role ARN in the experiment directly. In that case, the profile has no impact if you also set it.

    \"configuration\": {\n\"aws_assume_role_arn\": \"arn:aws:iam::XXXXXXX:role/role-name\",\n\"aws_assume_role_session_name\": \"my-chaos\"\n}\n

The aws_assume_role_session_name key is optional and will be set to \"ChaosToolkit\" when not provided.

When this approach is used, the extension performs a assume role call against the AWS STS service to fetch credentials dynamically.

"},{"location":"drivers/aws/#pass-credentials-explicitely","title":"Pass credentials explicitely","text":"

You can pass the credentials as a secret to the experiment definition as follows:

{\n\"secrets\": {\n\"aws\": {\n\"aws_access_key_id\": \"your key\",\n\"aws_secret_access_key\": \"access key\",\n\"aws_session_token\": \"token\",\n}\n}\n}\n
Note that the token is optional.

Then, use it as follows:

{\n\"name\": \"stop-an-ec2-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"secrets\": [\"aws\"],\n\"arguments\": {\n\"instance_id\": \"i-123456\"\n}\n}\n}\n
"},{"location":"drivers/aws/#setting-the-region","title":"Setting the region","text":"

In additon to the authentication credentials, you must configure the region against which you want to use.

You can either declare it at the top level of the experiment, add:

{\n\"configuration\": {\n\"aws_region\": \"us-east-1\"\n}\n}\n

or

{\n\"configuration\": {\n\"aws_region\": {\n\"type\": \"env\",\n\"key\": \"AWS_REGION\"\n}\n}\n}\n

But you can also simply set either AWS_REGION or AWS_DEFAULT_REGION in your terminal session without declaring anything in the experiment.

If none of these are set, your experiment will likely fail.

"},{"location":"drivers/aws/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/aws/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/aws/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/aws/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/aws/#add-new-aws-api-support","title":"Add new AWS API Support","text":"

Once you have setup your environment, you can start adding new AWS API support by adding new actions, probes and entire sub-packages for those.

"},{"location":"drivers/aws/#services-supported-by-boto","title":"Services supported by boto","text":"

This package relies on boto3 to wrap the API calls into a fluent Python API. Some newer AWS services are not yet available in boto3, in that case, you should read the next section.

Let\u2019s say you want to support a new action in the EC2 sub-package.

Start by creating a new function in ec2/actions.py:

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import aws_client\nfrom chaosaws.types import AWSResponse\n\ndef reboot_instance(instance_id: str, dry_run: bool=False,\n                    configuration: Configuration=None,\n                    secrets: Secrets=None) -> AWSResponse:\n\"\"\"\n    Reboot a given EC2 instance.\n    \"\"\"\n    client = aws_client('ec2', configuration, secrets)\n    return client.reboot_instances(InstanceIds=[instance_id], DryRun=dry_run)\n

As you can see, the actual code is straightforward. You first create a EC2 client and simply call the appropriate method on that client with the expected arguments. We return the action as-is so that it can be logged by the chaostoolkit, or even be used as part of a steady-state hypothesis probe (if this was a probe, not action that is).

You could decide to make more than one AWS API call but, it is better to keep it simple so that composition is easier from the experiment. Nonetheless, you may also compose those directly into a single action as well for specific use-cases.

Please refer to the Chaos Toolkit documentation to learn more about the configuration and secrets objects.

Once you have implemented that action, you must create at least one unit test for it in the tests/ec2/test_ec2_actions.py test module. For example:

from chaosaws.ec2.actions import reboot_instancex\n\n@patch('chaosaws.ec2.actions.aws_client', autospec=True)\ndef test_reboot_instance(aws_client):\n    client = MagicMock()\n    aws_client.return_value = client\n    inst_id = \"i-1234567890abcdef0\"\n    response = reboot_instance(inst_id)\n    client.reboot_instances.assert_called_with(\n        InstanceIds=[inst_id], DryRun=False)\n

By using the built-in Python module to mock objects, we can mock the EC2 client and assert that we do indeed call the appropriate method with the right arguments. You are encouraged to write more than a single test for various conditions.

Finally, should you choose to add support for a new AWS API resource altogether, you should create the according sub-package.

"},{"location":"drivers/aws/#services-not-supported-by-boto-new-aws-features","title":"Services not supported by boto (new AWS features)","text":"

If the support you want to provide is for a new AWS service that boto does not support yet, this requires direct call to the API endpoint via the requests package. Say we have a new service, not yet supported by boto3

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import signed_api_call\nfrom chaosaws.types import AWSResponse\n\ndef terminate_worker_node(worker_node_id: str,\n                          configuration: Configuration=None,\n                          secrets: Secrets=None) -> AWSResponse:\n\"\"\"\n    Terminate a worker node.\n    \"\"\"\n    params = {\n        \"DryRun\": True,\n        \"WorkerNodeId.1\": worker_node_id\n    }\n    response = signed_api_call(\n        'some-new-service-name', path='/2018-01-01/worker/terminate',\n        method='POST', params=params,\n        configuration=configuration, secrets=secrets)\n    return response.json()\n

Here is an example on existing API call (as a more concrete snippet):

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import signed_api_call\n\ndef stop_instance(instance_id: str, configuration: Configuration=None,\n                  secrets: Secrets=None) -> str:\n    response = signed_api_call(\n        'ec2',\n        configuration=configuration,\n        secrets=secrets,\n        params={\n            \"Action\": \"StopInstances\",\n            \"InstanceId.1\": instance_id,\n            \"Version\": \"2013-06-15\"\n        }\n    )\n\n    # this API returns XML, not JSON\n    return response.text\n

When using the signed_api_call, you are responsible for the right way of passing the parameters. Basically, look at the AWS documentation for each API call.

WARNING: It should be noted that, whenever boto3 implements an API, this package should be updated accordingly, as boto3 is much more versatile and solid.

"},{"location":"drivers/aws/#make-your-new-sub-package-discoverable","title":"Make your new sub-package discoverable","text":"

Finally, if you have created a new sub-package entirely, you need to make its capability discoverable by the chaos toolkit. Simply amend the discover function in the chaosaws/__init__.py. For example, assuming a new eks sub-package, with actions and probes:

    activities.extend(discover_actions(\"chaosaws.eks.actions\"))\n    activities.extend(discover_probes(\"chaosaws.eks.probes\"))\n
"},{"location":"drivers/aws/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/aws/#upload","title":"upload","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaws\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.controls.upload\"\n}\n}\n]\n}\n
controls:\n- name: chaosaws\nprovider:\nmodule: chaosaws.s3.controls.upload\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/aws/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/aws/#asg","title":"asg","text":""},{"location":"drivers/aws/#attach_volume","title":"attach_volume","text":"Type action Module chaosaws.asg.actions Name attach_volume Return list

Attaches ebs volumes that have been previously detached by CTK

: One of: asg_names: list: one or more asg names tags: list: key/value pairs to identify asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def attach_volume(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"attach-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"attach_volume\"\n}\n}\n
name: attach-volume\nprovider:\nfunc: attach_volume\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#change_subnets","title":"change_subnets","text":"Type action Module chaosaws.asg.actions Name change_subnets Return None

Adds/removes subnets on autoscaling groups

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

subnets: a list of subnet IDs to associate to the ASG\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def change_subnets(subnets: List[str],\n                   asg_names: List[str] = None,\n                   tags: List[dict] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required subnets list Yes asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"change-subnets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"change_subnets\",\n\"arguments\": {\n\"subnets\": []\n}\n}\n}\n
name: change-subnets\nprovider:\narguments:\nsubnets: []\nfunc: change_subnets\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_auto_scaling_groups","title":"describe_auto_scaling_groups","text":"Type probe Module chaosaws.asg.probes Name describe_auto_scaling_groups Return mapping

Returns AWS descriptions for provided ASG(s)

Params: OneOf: - asg_names: a list of asg names to describe - tags: a list of key/value pairs to collect ASG(s)

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def describe_auto_scaling_groups(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"describe-auto-scaling-groups\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"describe_auto_scaling_groups\"\n}\n}\n
name: describe-auto-scaling-groups\nprovider:\nfunc: describe_auto_scaling_groups\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#desired_equals_healthy","title":"desired_equals_healthy","text":"Type probe Module chaosaws.asg.probes Name desired_equals_healthy Return boolean

If desired number matches the number of healthy instances for each of the auto-scaling groups

Returns: bool

Signature:

def desired_equals_healthy(asg_names: List[str],\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required asg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"desired-equals-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"desired_equals_healthy\",\n\"arguments\": {\n\"asg_names\": []\n}\n}\n}\n
name: desired-equals-healthy\nprovider:\narguments:\nasg_names: []\nfunc: desired_equals_healthy\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#desired_equals_healthy_tags","title":"desired_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name desired_equals_healthy_tags Return boolean

If desired number matches the number of healthy instances

for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: bool

Signature:

def desired_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required tags list Yes

Usage:

JSONYAML
{\n\"name\": \"desired-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"desired_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: desired-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: desired_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#detach_random_instances","title":"detach_random_instances","text":"Type action Module chaosaws.asg.actions Name detach_random_instances Return mapping

Detaches one or more random instances from an autoscaling group

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

One of:\n

instance_count: integer value of number of instances to detach instance_percent: 1-100, percent of instances to detach

decrement_capacity: boolean value to determine if the desired capacity\nof the autoscaling group should be decreased\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def detach_random_instances(\n        asg_names: List[str] = None,\n        tags: List[dict] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        decrement_capacity: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No decrement_capacity boolean false No

Usage:

JSONYAML
{\n\"name\": \"detach-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"detach_random_instances\"\n}\n}\n
name: detach-random-instances\nprovider:\nfunc: detach_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#detach_random_volume","title":"detach_random_volume","text":"Type action Module chaosaws.asg.actions Name detach_random_volume Return list

Detaches a random (non root) ebs volume from ec2 instances associated to an ASG

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

force: force detach volume (default: true)\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def detach_random_volume(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"detach-random-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"detach_random_volume\"\n}\n}\n
name: detach-random-volume\nprovider:\nfunc: detach_random_volume\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#has_subnets","title":"has_subnets","text":"Type probe Module chaosaws.asg.probes Name has_subnets Return boolean

Determines if the provided autoscaling groups are in the provided subnets

:returns boolean

Signature:

def has_subnets(subnets: List[str],\n                asg_names: List[str] = None,\n                tags: List[Dict[str, str]] = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required subnets list Yes asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"has-subnets\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"has_subnets\",\n\"arguments\": {\n\"subnets\": []\n}\n}\n}\n
name: has-subnets\nprovider:\narguments:\nsubnets: []\nfunc: has_subnets\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#instance_count_by_health","title":"instance_count_by_health","text":"Type probe Module chaosaws.asg.probes Name instance_count_by_health Return integer

Reports the number of instances currently in the ASG by their health status

Params: OneOf: - asg_names: a list of asg names to describe - tags: a list of key/value pairs to collect ASG(s)

- count_healthy: boolean: true for healthy instance count,\n

false for unhealthy instance count

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def instance_count_by_health(asg_names: List[str] = None,\n                             tags: List[Dict[str, str]] = None,\n                             count_healthy: bool = True,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No count_healthy boolean true No

Usage:

JSONYAML
{\n\"name\": \"instance-count-by-health\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"instance_count_by_health\"\n}\n}\n
name: instance-count-by-health\nprovider:\nfunc: instance_count_by_health\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#is_scaling_in_progress","title":"is_scaling_in_progress","text":"Type probe Module chaosaws.asg.probes Name is_scaling_in_progress Return boolean

Check if there is any scaling activity in progress for ASG matching tags

Returns: Boolean

Signature:

def is_scaling_in_progress(tags: List[Dict[str, str]],\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required tags list Yes

Usage:

JSONYAML
{\n\"name\": \"is-scaling-in-progress\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"is_scaling_in_progress\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: is-scaling-in-progress\nprovider:\narguments:\ntags: []\nfunc: is_scaling_in_progress\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#process_is_suspended","title":"process_is_suspended","text":"Type probe Module chaosaws.asg.probes Name process_is_suspended Return boolean

Determines if one or more processes on an ASG are suspended.

:returns Boolean

Signature:

def process_is_suspended(asg_names: List[str] = None,\n                         tags: List[Dict[str, str]] = None,\n                         process_names: List[str] = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"process-is-suspended\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"process_is_suspended\"\n}\n}\n
name: process-is-suspended\nprovider:\nfunc: process_is_suspended\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#resume_processes","title":"resume_processes","text":"Type action Module chaosaws.asg.actions Name resume_processes Return mapping

Resumes 1 or more suspended processes on a list of auto scaling groups.

If no process is specified, all suspended auto scaling processes will be resumed.

For a list of valid processes that can be suspended, reference: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html

: One of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def resume_processes(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        process_names: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"resume-processes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"resume_processes\"\n}\n}\n
name: resume-processes\nprovider:\nfunc: resume_processes\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_random_instances","title":"stop_random_instances","text":"Type action Module chaosaws.asg.actions Name stop_random_instances Return list

Terminates one or more random healthy instances associated to an ALB

A healthy instance is considered one with a status of \u2018InService\u2019

: - force: force stop the instances (default: False)

One Of:\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def stop_random_instances(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        az: str = None,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No az string null No force boolean false No

Usage:

JSONYAML
{\n\"name\": \"stop-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"stop_random_instances\"\n}\n}\n
name: stop-random-instances\nprovider:\nfunc: stop_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#suspend_processes","title":"suspend_processes","text":"Type action Module chaosaws.asg.actions Name suspend_processes Return mapping

Suspends 1 or more processes on a list of auto scaling groups.

If no process is specified, all running auto scaling processes will be suspended.

For a list of valid processes that can be suspended, reference: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html

: One of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def suspend_processes(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        process_names: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"suspend-processes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"suspend_processes\"\n}\n}\n
name: suspend-processes\nprovider:\nfunc: suspend_processes\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_random_instances","title":"terminate_random_instances","text":"Type action Module chaosaws.asg.actions Name terminate_random_instances Return list

Terminates one or more random healthy instances associated to an ALB

A healthy instance is considered one with a status of \u2018InService\u2019

: One Of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

One Of: - instance_count: the number of instances to terminate - instance_percent: the percentage of instances to terminate - az: the availability zone to terminate instances

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def terminate_random_instances(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        az: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No az string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"terminate_random_instances\"\n}\n}\n
name: terminate-random-instances\nprovider:\nfunc: terminate_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#wait_desired_equals_healthy","title":"wait_desired_equals_healthy","text":"Type probe Module chaosaws.asg.probes Name wait_desired_equals_healthy Return integer

Wait until desired number matches the number of healthy instances for each of the auto-scaling groups

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_equals_healthy(\n        asg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        timeout: Union[int, float] = 300,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required asg_names list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-equals-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_equals_healthy\",\n\"arguments\": {\n\"asg_names\": []\n}\n}\n}\n
name: wait-desired-equals-healthy\nprovider:\narguments:\nasg_names: []\nfunc: wait_desired_equals_healthy\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#wait_desired_equals_healthy_tags","title":"wait_desired_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name wait_desired_equals_healthy_tags Return integer

Wait until desired number matches the number of healthy instances for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        timeout: Union[int, float] = 300,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required tags list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: wait-desired-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: wait_desired_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#wait_desired_not_equals_healthy_tags","title":"wait_desired_not_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name wait_desired_not_equals_healthy_tags Return integer

Wait until desired number doesn\u2019t match the number of healthy instances for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_not_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        timeout: Union[int, float] = 300,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required tags list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-not-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_not_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: wait-desired-not-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: wait_desired_not_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#awslambda","title":"awslambda","text":""},{"location":"drivers/aws/#delete_event_source_mapping","title":"delete_event_source_mapping","text":"Type action Module chaosaws.awslambda.actions Name delete_event_source_mapping Return mapping

Delete an event source mapping

:param event_uuid: The identifier of the event source mapping :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def delete_event_source_mapping(\n        event_uuid: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required event_uuid string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-event-source-mapping\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"delete_event_source_mapping\",\n\"arguments\": {\n\"event_uuid\": \"\"\n}\n}\n}\n
name: delete-event-source-mapping\nprovider:\narguments:\nevent_uuid: ''\nfunc: delete_event_source_mapping\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_function_concurrency","title":"delete_function_concurrency","text":"Type action Module chaosaws.awslambda.actions Name delete_function_concurrency Return mapping

Removes concurrency limit applied to the specified Lambda

Signature:

def delete_function_concurrency(\n        function_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-function-concurrency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"delete_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: delete-function-concurrency\nprovider:\narguments:\nfunction_name: ''\nfunc: delete_function_concurrency\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_function_concurrency","title":"get_function_concurrency","text":"Type probe Module chaosaws.awslambda.probes Name get_function_concurrency Return boolean

Get configuration information of lambda by its function name

Signature:

def get_function_concurrency(\n        function_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-function-concurrency\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-concurrency\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_concurrency\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_function_memory_size","title":"get_function_memory_size","text":"Type probe Module chaosaws.awslambda.probes Name get_function_memory_size Return integer

Get the configured memory size of a lambda function.

The returned memory size is specified in megabytes.

Signature:

def get_function_memory_size(function_name: str,\n                             qualifier: str = None,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"get-function-memory-size\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_memory_size\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-memory-size\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_memory_size\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_function_timeout","title":"get_function_timeout","text":"Type probe Module chaosaws.awslambda.probes Name get_function_timeout Return integer

Get the configured timeout of a lambda function.

The returned timeout is specified in number of seconds.

Signature:

def get_function_timeout(function_name: str,\n                         qualifier: str = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"get-function-timeout\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_timeout\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-timeout\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_timeout\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#invoke_function","title":"invoke_function","text":"Type action Module chaosaws.awslambda.actions Name invoke_function Return mapping

Invokes Lambda.

More information about request arguments are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.invoke

Signature:

def invoke_function(\n        function_name: str,\n        function_arguments: Dict[str, Any] = None,\n        invocation_type: str = 'RequestResponse',\n        client_context: Dict[str, Any] = None,\n        qualifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes function_arguments mapping null No invocation_type string \u201cRequestResponse\u201d No client_context mapping null No qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"invoke-function\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"invoke_function\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: invoke-function\nprovider:\narguments:\nfunction_name: ''\nfunc: invoke_function\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#list_event_source_mapping","title":"list_event_source_mapping","text":"Type probe Module chaosaws.awslambda.probes Name list_event_source_mapping Return mapping

List event source mappings for the provided lambda function or ARN of the event source

:param source_arn: The ARN of the event source :param function_name: The name of the lambda function :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def list_event_source_mapping(\n        source_arn: str = None,\n        function_name: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required source_arn string null No function_name string null No

Usage:

JSONYAML
{\n\"name\": \"list-event-source-mapping\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"list_event_source_mapping\"\n}\n}\n
name: list-event-source-mapping\nprovider:\nfunc: list_event_source_mapping\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#put_function_concurrency","title":"put_function_concurrency","text":"Type action Module chaosaws.awslambda.actions Name put_function_concurrency Return mapping

Throttles Lambda by setting reserved concurrency amount.

Signature:

def put_function_concurrency(\n        function_name: str,\n        concurrent_executions: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes concurrent_executions integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-concurrency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\",\n\"concurrent_executions\": 0\n}\n}\n}\n
name: put-function-concurrency\nprovider:\narguments:\nconcurrent_executions: 0\nfunction_name: ''\nfunc: put_function_concurrency\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_function_memory_size","title":"put_function_memory_size","text":"Type action Module chaosaws.awslambda.actions Name put_function_memory_size Return mapping

Sets the function memory size.

Input memory_size argument is specified in megabytes.

Signature:

def put_function_memory_size(\n        function_name: str,\n        memory_size: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes memory_size integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-memory-size\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_memory_size\",\n\"arguments\": {\n\"function_name\": \"\",\n\"memory_size\": 0\n}\n}\n}\n
name: put-function-memory-size\nprovider:\narguments:\nfunction_name: ''\nmemory_size: 0\nfunc: put_function_memory_size\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_function_timeout","title":"put_function_timeout","text":"Type action Module chaosaws.awslambda.actions Name put_function_timeout Return mapping

Sets the function timeout.

Input timeout argument is specified in seconds.

Signature:

def put_function_timeout(\n        function_name: str,\n        timeout: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes timeout integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-timeout\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_timeout\",\n\"arguments\": {\n\"function_name\": \"\",\n\"timeout\": 0\n}\n}\n}\n
name: put-function-timeout\nprovider:\narguments:\nfunction_name: ''\ntimeout: 0\nfunc: put_function_timeout\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#toggle_event_source_mapping_state","title":"toggle_event_source_mapping_state","text":"Type action Module chaosaws.awslambda.actions Name toggle_event_source_mapping_state Return mapping

Toggle an event source mapping to be disabled or enabled

:param event_uuid: The identifier of the event source mapping :param enabled: Boolean value: true to enable, false to disable :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def toggle_event_source_mapping_state(\n        event_uuid: str,\n        enabled: bool,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required event_uuid string Yes enabled boolean Yes

Usage:

JSONYAML
{\n\"name\": \"toggle-event-source-mapping-state\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"toggle_event_source_mapping_state\",\n\"arguments\": {\n\"event_uuid\": \"\",\n\"enabled\": true\n}\n}\n}\n
name: toggle-event-source-mapping-state\nprovider:\narguments:\nenabled: true\nevent_uuid: ''\nfunc: toggle_event_source_mapping_state\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#cloudwatch","title":"cloudwatch","text":""},{"location":"drivers/aws/#delete_rule","title":"delete_rule","text":"Type action Module chaosaws.cloudwatch.actions Name delete_rule Return mapping

Deletes a CloudWatch rule.

All rule targets must be removed before deleting the rule. Set input argument force to True to force all rule targets to be deleted.

Signature:

def delete_rule(rule_name: str,\n                force: bool = False,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes force boolean false No

Usage:

JSONYAML
{\n\"name\": \"delete-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"delete_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: delete-rule\nprovider:\narguments:\nrule_name: ''\nfunc: delete_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#disable_rule","title":"disable_rule","text":"Type action Module chaosaws.cloudwatch.actions Name disable_rule Return mapping

Disables a CloudWatch rule.

Signature:

def disable_rule(rule_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes

Usage:

JSONYAML
{\n\"name\": \"disable-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"disable_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: disable-rule\nprovider:\narguments:\nrule_name: ''\nfunc: disable_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#enable_rule","title":"enable_rule","text":"Type action Module chaosaws.cloudwatch.actions Name enable_rule Return mapping

Enables a CloudWatch rule.

Signature:

def enable_rule(rule_name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes

Usage:

JSONYAML
{\n\"name\": \"enable-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"enable_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: enable-rule\nprovider:\narguments:\nrule_name: ''\nfunc: enable_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_alarm_state_value","title":"get_alarm_state_value","text":"Type probe Module chaosaws.cloudwatch.probes Name get_alarm_state_value Return string

Return the state value of an alarm.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.describe_alarms

Signature:

def get_alarm_state_value(alarm_name: str,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required alarm_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-alarm-state-value\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_alarm_state_value\",\n\"arguments\": {\n\"alarm_name\": \"\"\n}\n}\n}\n
name: get-alarm-state-value\nprovider:\narguments:\nalarm_name: ''\nfunc: get_alarm_state_value\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_metric_data","title":"get_metric_data","text":"Type probe Module chaosaws.cloudwatch.probes Name get_metric_data Return number

Gets metric data for a given metric in a given time period. This method allows for more data to be retrieved than get_metric_statistics

:params namespace: The AWS metric namespace metric_name: The name of the metric to pull data for One of: dimension_name, dimension_value: Required to search for ONE dimension dimensions: Required to search for dimensions combinations Are expected as a list of dictionary objects: [{\u2018Name\u2019: \u2018Dim1\u2019, \u2018Value\u2019: \u2018Val1\u2019}, {\u2018Name\u2019: \u2018Dim2\u2019, \u2018Value\u2019: \u2018Val2\u2019}, \u2026] unit: The type of unit desired to be collected statistic: The type of data to return. One of: Average, Sum, Minimum, Maximum, SampleCount period: The window in which to pull datapoints for offset: The time (seconds) to offset the endtime (from now) duration: The time (seconds) to set the start time (from now)

Signature:

def get_metric_data(namespace: str,\n                    metric_name: str,\n                    dimension_name: str = None,\n                    dimension_value: str = None,\n                    dimensions: List[Dict[str, str]] = None,\n                    statistic: str = None,\n                    duration: int = 300,\n                    period: int = 60,\n                    offset: int = 0,\n                    unit: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_name string Yes dimension_name string null No dimension_value string null No dimensions list null No statistic string null No duration integer 300 No period integer 60 No offset integer 0 No unit string null No

Usage:

JSONYAML
{\n\"name\": \"get-metric-data\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_metric_data\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_name\": \"\"\n}\n}\n}\n
name: get-metric-data\nprovider:\narguments:\nmetric_name: ''\nnamespace: ''\nfunc: get_metric_data\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_metric_statistics","title":"get_metric_statistics","text":"Type probe Module chaosaws.cloudwatch.probes Name get_metric_statistics Return None

Get the value of a statistical calculation for a given metric.

The period for which the calculation will be performed is specified by a duration and an offset from the current time. Both are specified in seconds.

Example: A duration of 60 seconds and an offset of 30 seconds will yield a statistical value based on the time interval between 30 and 90 seconds in the past.

Is required one of: dimension_name, dimension_value: Required to search for ONE dimension dimensions: Required to search for dimensions combinations Are expected as a list of dictionary objects: [{\u2018Name\u2019: \u2018Dim1\u2019, \u2018Value\u2019: \u2018Val1\u2019}, {\u2018Name\u2019: \u2018Dim2\u2019, \u2018Value\u2019: \u2018Val2\u2019}, \u2026]

More information about input parameters are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.get_metric_statistics

Signature:

def get_metric_statistics(namespace: str,\n                          metric_name: str,\n                          dimension_name: str = None,\n                          dimension_value: str = None,\n                          dimensions: List[Dict[str, str]] = None,\n                          duration: int = 60,\n                          offset: int = 0,\n                          statistic: str = None,\n                          extended_statistic: str = None,\n                          unit: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_name string Yes dimension_name string null No dimension_value string null No dimensions list null No duration integer 60 No offset integer 0 No statistic string null No extended_statistic string null No unit string null No

Usage:

JSONYAML
{\n\"name\": \"get-metric-statistics\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_metric_statistics\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_name\": \"\"\n}\n}\n}\n
name: get-metric-statistics\nprovider:\narguments:\nmetric_name: ''\nnamespace: ''\nfunc: get_metric_statistics\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#put_metric_data","title":"put_metric_data","text":"Type action Module chaosaws.cloudwatch.actions Name put_metric_data Return None

Publish metric data points to CloudWatch

:param namespace: The metric namespace :param metric_data: A list of metric data to submit :param configuration: AWS authentication configuration :param secrets: Additional authentication secrets :return: None

example: namespace=\u2019MyCustomTestMetric\u2019, metric_data=[ { \u2018MetricName\u2019: \u2018MemoryUsagePercent\u2019, \u2018Dimensions\u2019: [ {\u2018Name\u2019: \u2018InstanceId\u2019, \u2018Value\u2019: \u2018i-000000000000\u2019}, {\u2018Name\u2019: \u2018Instance Name\u2019, \u2018Value\u2019: \u2018Test Instance\u2019} ], \u2018Timestamp\u2019: datetime(yyyy, mm, dd, HH, MM, SS), \u2018Value\u2019: 55.55, \u2018Unit\u2019: \u2018Percent\u2019, \u2018StorageResolution\u2019: 60 } ]

For additional information, consult: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.put_metric_data

Signature:

def put_metric_data(namespace: str,\n                    metric_data: List[Dict[str, Any]],\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_data list Yes

Usage:

JSONYAML
{\n\"name\": \"put-metric-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_metric_data\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_data\": []\n}\n}\n}\n
name: put-metric-data\nprovider:\narguments:\nmetric_data: []\nnamespace: ''\nfunc: put_metric_data\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_rule","title":"put_rule","text":"Type action Module chaosaws.cloudwatch.actions Name put_rule Return mapping

Creates or updates a CloudWatch event rule.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_rule for details on input arguments.

Signature:

def put_rule(rule_name: str,\n             schedule_expression: str = None,\n             event_pattern: str = None,\n             state: str = None,\n             description: str = None,\n             role_arn: str = None,\n             configuration: Dict[str, Dict[str, str]] = None,\n             secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes schedule_expression string null No event_pattern string null No state string null No description string null No role_arn string null No

Usage:

JSONYAML
{\n\"name\": \"put-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: put-rule\nprovider:\narguments:\nrule_name: ''\nfunc: put_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_rule_targets","title":"put_rule_targets","text":"Type action Module chaosaws.cloudwatch.actions Name put_rule_targets Return mapping

Creates or update CloudWatch event rule targets.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_targets for details on input arguments.

Signature:

def put_rule_targets(\n        rule_name: str,\n        targets: List[Dict[str, Any]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes targets list Yes

Usage:

JSONYAML
{\n\"name\": \"put-rule-targets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_rule_targets\",\n\"arguments\": {\n\"rule_name\": \"\",\n\"targets\": []\n}\n}\n}\n
name: put-rule-targets\nprovider:\narguments:\nrule_name: ''\ntargets: []\nfunc: put_rule_targets\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#remove_rule_targets","title":"remove_rule_targets","text":"Type action Module chaosaws.cloudwatch.actions Name remove_rule_targets Return mapping

Removes CloudWatch rule targets. If no target ids are provided all targets will be removed.

Signature:

def remove_rule_targets(\n        rule_name: str,\n        target_ids: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes target_ids list null No

Usage:

JSONYAML
{\n\"name\": \"remove-rule-targets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"remove_rule_targets\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: remove-rule-targets\nprovider:\narguments:\nrule_name: ''\nfunc: remove_rule_targets\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#ec2","title":"ec2","text":""},{"location":"drivers/aws/#attach_volume_1","title":"attach_volume","text":"Type action Module chaosaws.ec2.actions Name attach_volume Return list

Attaches a previously detached EBS volume to its associated EC2 instance.

If neither \u2018instance_ids\u2019 or \u2018filters\u2019 are provided, all detached volumes will be reattached to their respective instances

: One of: instance_ids: list: instance ids filters: list: key/value pairs to pull ec2 instances

Signature:

def attach_volume(\n        instance_ids: List[str] = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"attach-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"attach_volume\"\n}\n}\n
name: attach-volume\nprovider:\nfunc: attach_volume\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#count_instances","title":"count_instances","text":"Type probe Module chaosaws.ec2.probes Name count_instances Return integer

Return count of instances matching the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def count_instances(filters: List[Dict[str, Any]],\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filters list Yes

Usage:

JSONYAML
{\n\"name\": \"count-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"count_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: count-instances\nprovider:\narguments:\nfilters: []\nfunc: count_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#count_min_instances","title":"count_min_instances","text":"Type probe Module chaosaws.ec2.probes Name count_min_instances Return boolean

Returns whether minimum number of instances available matching the specified filters.

Signature:

def count_min_instances(filters: List[Dict[str, Any]],\n                        min_count: int = 0,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required filters list Yes min_count integer 0 No

Usage:

JSONYAML
{\n\"name\": \"count-min-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"count_min_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: count-min-instances\nprovider:\narguments:\nfilters: []\nfunc: count_min_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instances","title":"describe_instances","text":"Type probe Module chaosaws.ec2.probes Name describe_instances Return mapping

Describe instances following the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def describe_instances(\n        filters: List[Dict[str, Any]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required filters list Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"describe_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: describe-instances\nprovider:\narguments:\nfilters: []\nfunc: describe_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#detach_random_volume_1","title":"detach_random_volume","text":"Type action Module chaosaws.ec2.actions Name detach_random_volume Return list

Detaches a random ebs volume (non root) from one or more EC2 instances

: One of: instance_ids: a list of one or more ec2 instance ids filters: a list of key/value pairs to pull ec2 instances

force: force detach volume (default: true)\n

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def detach_random_volume(\n        instance_ids: List[str] = None,\n        filters: List[Dict[str, Any]] = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No filters list null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"detach-random-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"detach_random_volume\"\n}\n}\n
name: detach-random-volume\nprovider:\nfunc: detach_random_volume\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#instance_state","title":"instance_state","text":"Type probe Module chaosaws.ec2.probes Name instance_state Return boolean

Determines if EC2 instances match desired state

For additional filter options, please refer to the documentation found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def instance_state(state: str,\n                   instance_ids: List[str] = None,\n                   filters: List[Dict[str, Any]] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required state string Yes instance_ids list null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"instance-state\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"\"\n}\n}\n}\n
name: instance-state\nprovider:\narguments:\nstate: ''\nfunc: instance_state\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#restart_instances","title":"restart_instances","text":"Type action Module chaosaws.ec2.actions Name restart_instances Return list

Restarts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be restarted.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def restart_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"restart-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"restart_instances\"\n}\n}\n
name: restart-instances\nprovider:\nfunc: restart_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#start_instances","title":"start_instances","text":"Type action Module chaosaws.ec2.actions Name start_instances Return list

Starts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be started.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def start_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"start-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"start_instances\"\n}\n}\n
name: start-instances\nprovider:\nfunc: start_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_instance","title":"stop_instance","text":"Type action Module chaosaws.ec2.actions Name stop_instance Return list

Stop a single EC2 instance.

You may provide an instance id explicitly or, if you only specify the AZ, a random instance will be selected. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instance(\n        instance_id: str = None,\n        az: str = None,\n        force: bool = False,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No az string null No force boolean false No filters list null No

Usage:

JSONYAML
{\n\"name\": \"stop-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\"\n}\n}\n
name: stop-instance\nprovider:\nfunc: stop_instance\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_instances","title":"stop_instances","text":"Type action Module chaosaws.ec2.actions Name stop_instances Return list

Stop the given EC2 instances or, if none is provided, all instances of the given availability zone. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No force boolean false No

Usage:

JSONYAML
{\n\"name\": \"stop-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instances\"\n}\n}\n
name: stop-instances\nprovider:\nfunc: stop_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_instance","title":"terminate_instance","text":"Type action Module chaosaws.ec2.actions Name terminate_instance Return list

Terminates a single EC2 instance.

An instance may be targeted by specifying it by instance-id. If only the availability-zone is provided, a random instances in that AZ will be selected and terminated. For more control, please reference the available filters found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instance(\n        instance_id: str = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"terminate-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"terminate_instance\"\n}\n}\n
name: terminate-instance\nprovider:\nfunc: terminate_instance\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_instances","title":"terminate_instances","text":"Type action Module chaosaws.ec2.actions Name terminate_instances Return list

Terminates multiple EC2 instances

A set of instances may be targeted by providing them as the instance-ids.

WARNING: If only an Availability Zone is specified, all instances in that AZ will be terminated.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"terminate-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"terminate_instances\"\n}\n}\n
name: terminate-instances\nprovider:\nfunc: terminate_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#ecs","title":"ecs","text":""},{"location":"drivers/aws/#are_all_desired_tasks_running","title":"are_all_desired_tasks_running","text":"Type probe Module chaosaws.ecs.probes Name are_all_desired_tasks_running Return boolean

Checks to make sure desired and running tasks counts are equal

Signature:

def are_all_desired_tasks_running(\n        cluster: str,\n        service: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"are-all-desired-tasks-running\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"are_all_desired_tasks_running\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: are-all-desired-tasks-running\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: are_all_desired_tasks_running\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_cluster","title":"delete_cluster","text":"Type action Module chaosaws.ecs.actions Name delete_cluster Return mapping

Delete an ECS cluster

:param cluster: The ECS cluster name or ARN :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def delete_cluster(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"delete_cluster\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: delete-cluster\nprovider:\narguments:\ncluster: ''\nfunc: delete_cluster\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_service","title":"delete_service","text":"Type action Module chaosaws.ecs.actions Name delete_service Return mapping

Update a given ECS service by updating it to set the desired count of tasks to 0 then delete it. If not provided, a random one will be picked up regarding service_pattern, if provided, so that only service names matching the pattern would be be used. This should be a valid regex.

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def delete_service(\n        service: str = None,\n        cluster: str = None,\n        service_pattern: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required service string null No cluster string null No service_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"delete_service\"\n}\n}\n
name: delete-service\nprovider:\nfunc: delete_service\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#deregister_container_instance","title":"deregister_container_instance","text":"Type action Module chaosaws.ecs.actions Name deregister_container_instance Return mapping

Deregister an ECS container

Warning: If using \u201cforce\u201d, Any tasks not deleted before deregistration will remain orphaned

:param cluster: The ECS cluster name or ARN or ARN :param instance_id: The container instance id or ARN :param force: Force deregistraion of container instance :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def deregister_container_instance(\n        cluster: str,\n        instance_id: str,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes instance_id string Yes force boolean false No

Usage:

JSONYAML
{\n\"name\": \"deregister-container-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"deregister_container_instance\",\n\"arguments\": {\n\"cluster\": \"\",\n\"instance_id\": \"\"\n}\n}\n}\n
name: deregister-container-instance\nprovider:\narguments:\ncluster: ''\ninstance_id: ''\nfunc: deregister_container_instance\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cluster","title":"describe_cluster","text":"Type probe Module chaosaws.ecs.probes Name describe_cluster Return mapping

Returns AWS response describing the specified cluster

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster has 3 running tasks\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cCluster running task count\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.clusters[0].runningTasksCount, \u201cexpect\u201d: 3 }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_cluster\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d } } } }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_clusters

Signature:

def describe_cluster(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\ncluster: ''\nfunc: describe_cluster\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_service","title":"describe_service","text":"Type probe Module chaosaws.ecs.probes Name describe_service Return mapping

Returns AWS response describing the specified cluster service

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyService pending count is 1\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cService pending count\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.services[0].pendingCount, \u201cexpect\u201d: 1 }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_service\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d, \u201cservice\u201d: \u201cMyService\u201d } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_services

Signature:

def describe_service(\n        cluster: str,\n        service: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_service\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: describe-service\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: describe_service\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_tasks","title":"describe_tasks","text":"Type probe Module chaosaws.ecs.probes Name describe_tasks Return mapping

Returns AWS response describing the tasks for a provided cluster

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster tasks are healthy\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cfirst task is healthy\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.tasks[0].healthStatus, \u201cexpect\u201d: \u201cHEALTHY\u201d }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_tasks\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_tasks

Signature:

def describe_tasks(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-tasks\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_tasks\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: describe-tasks\nprovider:\narguments:\ncluster: ''\nfunc: describe_tasks\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#service_is_deploying","title":"service_is_deploying","text":"Type probe Module chaosaws.ecs.probes Name service_is_deploying Return boolean

Checks to make sure there is not an in progress deployment

Signature:

def service_is_deploying(cluster: str,\n                         service: str,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"service-is-deploying\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"service_is_deploying\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: service-is-deploying\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: service_is_deploying\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#set_service_deployment_configuration","title":"set_service_deployment_configuration","text":"Type action Module chaosaws.ecs.actions Name set_service_deployment_configuration Return mapping

Sets the maximum healthy count and minimum healthy percentage values for a services deployment configuration

:param cluster: The ECS cluster name or ARN :param service: The ECS service name :param maximum_percent: The upper limit on the number of tasks a service is allowed to have in RUNNING or PENDING during deployment :param minimum_healthy_percent: The lower limit on the number of tasks a service must keep in RUNNING to be considered healthy during deployment :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def set_service_deployment_configuration(\n        cluster: str,\n        service: str,\n        maximum_percent: int = 200,\n        minimum_healthy_percent: int = 100,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes maximum_percent integer 200 No minimum_healthy_percent integer 100 No

Usage:

JSONYAML
{\n\"name\": \"set-service-deployment-configuration\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"set_service_deployment_configuration\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: set-service-deployment-configuration\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: set_service_deployment_configuration\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#set_service_placement_strategy","title":"set_service_placement_strategy","text":"Type action Module chaosaws.ecs.actions Name set_service_placement_strategy Return mapping

Sets the service\u2019s instance placement strategy

:param cluster: The ECS cluster name or ARN :param service: The ECS service name :param placement_type: The type of placement strategy to employ (random, spread, or binpack) :param placement_field: The field to apply the strategy against (eg: \u201cattribute:ecs.availability-zone\u201d) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def set_service_placement_strategy(\n        cluster: str,\n        service: str,\n        placement_type: str,\n        placement_field: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes placement_type string Yes placement_field string null No

Usage:

JSONYAML
{\n\"name\": \"set-service-placement-strategy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"set_service_placement_strategy\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\",\n\"placement_type\": \"\"\n}\n}\n}\n
name: set-service-placement-strategy\nprovider:\narguments:\ncluster: ''\nplacement_type: ''\nservice: ''\nfunc: set_service_placement_strategy\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_random_tasks","title":"stop_random_tasks","text":"Type action Module chaosaws.ecs.actions Name stop_random_tasks Return list

Stop a random number of tasks based on given task_count or task_percent

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

:param cluster: The ECS cluster Name :param task_count: The number of tasks to stop :param task_percent: The percentage of total tasks to stop :param service: The ECS service name :param reason: An explanation of why the service was stopped :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: List[Dict[str, Any]]

Signature:

def stop_random_tasks(\n        cluster: str,\n        task_count: int = None,\n        task_percent: int = None,\n        service: str = None,\n        reason: str = 'Chaos Testing',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes task_count integer null No task_percent integer null No service string null No reason string \u201cChaos Testing\u201d No

Usage:

JSONYAML
{\n\"name\": \"stop-random-tasks\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"stop_random_tasks\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: stop-random-tasks\nprovider:\narguments:\ncluster: ''\nfunc: stop_random_tasks\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_task","title":"stop_task","text":"Type action Module chaosaws.ecs.actions Name stop_task Return mapping

Stop a given ECS task instance. If no task_id provided, a random task of the given service is stopped. You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def stop_task(cluster: str = None,\n              task_id: str = None,\n              service: str = None,\n              reason: str = 'Chaos Testing',\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string null No task_id string null No service string null No reason string \u201cChaos Testing\u201d No

Usage:

JSONYAML
{\n\"name\": \"stop-task\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"stop_task\"\n}\n}\n
name: stop-task\nprovider:\nfunc: stop_task\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#tag_resource","title":"tag_resource","text":"Type action Module chaosaws.ecs.actions Name tag_resource Return None

Tags the provided resource(s) with provided tags

** For ECS resources, the long form ARN must be used https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-arn-timeline

Example: { \u201ctags\u201d: [ {\u201ckey\u201d: \u201cMyTagKey\u201d, \u201cvalue\u201d: \u201cMyTagValue\u201d}, {\u201ckey\u201d: \u201cMyOtherTagKey\u201d, \u201cvalue\u201d: \u201cMyOtherTagValue\u201d} ], \u201cresource_arn\u201d: \u201carn:aws:ecs:us-east-1:123456789012:cluster/name\u201d }

:param tags: A list of key/value pairs :param resource_arn: The ARN of the resource to tag. Valid resources: capacity providers, tasks, services, task definitions, clusters, and container instances :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def tag_resource(tags: List[Dict[str, str]],\n                 resource_arn: str,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required tags list Yes resource_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"tag-resource\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"tag_resource\",\n\"arguments\": {\n\"tags\": [],\n\"resource_arn\": \"\"\n}\n}\n}\n
name: tag-resource\nprovider:\narguments:\nresource_arn: ''\ntags: []\nfunc: tag_resource\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#untag_resource","title":"untag_resource","text":"Type action Module chaosaws.ecs.actions Name untag_resource Return None

Removes the given tags from the provided resource

** For ECS resources, the long form ARN must be used https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-arn-timeline

Example: { \u201ctag_keys\u201d: [\u201cMyTagKey\u201d, \u201cMyOtherTagKey\u201d], \u201cresource_arn\u201d: \u201carn:aws:ecs:\u2026:service/cluster-name/service-name\u201d }

:param tag_keys: A list of tag keys to remove :param resource_arn: The ARN of the resource to tag. Valid resources: capacity providers, tasks, services, task definitions, clusters, and container instances :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def untag_resource(tag_keys: List[str],\n                   resource_arn: str,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required tag_keys list Yes resource_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"untag-resource\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"untag_resource\",\n\"arguments\": {\n\"tag_keys\": [],\n\"resource_arn\": \"\"\n}\n}\n}\n
name: untag-resource\nprovider:\narguments:\nresource_arn: ''\ntag_keys: []\nfunc: untag_resource\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#update_container_instances_state","title":"update_container_instances_state","text":"Type action Module chaosaws.ecs.actions Name update_container_instances_state Return mapping

Modify the status of an ACTIVE ECS container instance

:param cluster: The ECS cluster name or ARN :param container_instances: A list of container instance ids for ARNs :param status: The desired instance state (Valid States: ACTIVE, DRAINING) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def update_container_instances_state(\n        cluster: str,\n        container_instances: List[str],\n        status: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes container_instances list Yes status string Yes

Usage:

JSONYAML
{\n\"name\": \"update-container-instances-state\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"update_container_instances_state\",\n\"arguments\": {\n\"cluster\": \"\",\n\"container_instances\": [],\n\"status\": \"\"\n}\n}\n}\n
name: update-container-instances-state\nprovider:\narguments:\ncluster: ''\ncontainer_instances: []\nstatus: ''\nfunc: update_container_instances_state\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#update_desired_count","title":"update_desired_count","text":"Type action Module chaosaws.ecs.actions Name update_desired_count Return mapping

Set the number of desired tasks for an ECS service

:param cluster: The ECS cluster name or ARN or ARN :param service: The ECS service name :param desired_count: The number of instantiation of the tasks to run :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Example: \u201cmethod\u201d: { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cupdate service\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.actions\u201d, \u201cfunc\u201d: \u201cupdate_desired_count\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cmy_cluster_name\u201d, \u201cservice\u201d: \u201cmy_service_name\u201d, \u201cdesired_count\u201d: 6 } } }

Signature:

def update_desired_count(\n        cluster: str,\n        service: str,\n        desired_count: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes desired_count integer Yes

Usage:

JSONYAML
{\n\"name\": \"update-desired-count\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"update_desired_count\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\",\n\"desired_count\": 0\n}\n}\n}\n
name: update-desired-count\nprovider:\narguments:\ncluster: ''\ndesired_count: 0\nservice: ''\nfunc: update_desired_count\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#eks","title":"eks","text":""},{"location":"drivers/aws/#create_cluster","title":"create_cluster","text":"Type action Module chaosaws.eks.actions Name create_cluster Return mapping

Create a new EKS cluster.

Signature:

def create_cluster(\n        name: str,\n        role_arn: str,\n        vpc_config: Dict[str, Any],\n        version: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes role_arn string Yes vpc_config mapping Yes version string null No

Usage:

JSONYAML
{\n\"name\": \"create-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.actions\",\n\"func\": \"create_cluster\",\n\"arguments\": {\n\"name\": \"\",\n\"role_arn\": \"\",\n\"vpc_config\": {}\n}\n}\n}\n
name: create-cluster\nprovider:\narguments:\nname: ''\nrole_arn: ''\nvpc_config: {}\nfunc: create_cluster\nmodule: chaosaws.eks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_cluster_1","title":"delete_cluster","text":"Type action Module chaosaws.eks.actions Name delete_cluster Return mapping

Delete the given EKS cluster.

Signature:

def delete_cluster(\n        name: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string null No

Usage:

JSONYAML
{\n\"name\": \"delete-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.actions\",\n\"func\": \"delete_cluster\"\n}\n}\n
name: delete-cluster\nprovider:\nfunc: delete_cluster\nmodule: chaosaws.eks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cluster_1","title":"describe_cluster","text":"Type probe Module chaosaws.eks.probes Name describe_cluster Return mapping

Describe an EKS cluster.

Signature:

def describe_cluster(\n        name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\nname: ''\nfunc: describe_cluster\nmodule: chaosaws.eks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_clusters","title":"list_clusters","text":"Type probe Module chaosaws.eks.probes Name list_clusters Return mapping

List EKS clusters available to the authenticated account.

Signature:

def list_clusters(configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.probes\",\n\"func\": \"list_clusters\"\n}\n}\n
name: list-clusters\nprovider:\nfunc: list_clusters\nmodule: chaosaws.eks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#elasticache","title":"elasticache","text":""},{"location":"drivers/aws/#count_cache_clusters_from_replication_group","title":"count_cache_clusters_from_replication_group","text":"Type probe Module chaosaws.elasticache.probes Name count_cache_clusters_from_replication_group Return integer

Returns the number of cache clusters that are part of the given ReplicationGroupId :param replication_group_id: The identifier for the replication group to be described :param configuration: Configuration :param secrets: Secrets Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster has 3 nodes\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cCluster running node count\u201d, \u201ctolerance\u201d: 3, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cmodules.elasticache\u201d, \u201cfunc\u201d: \u201ccount_cache_clusters_from_replication_group\u201d, \u201carguments\u201d: { \u201creplication_group_id\u201d: \u201cMyCluster\u201d } } } }

Signature:

def count_cache_clusters_from_replication_group(\n        replication_group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required replication_group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"count-cache-clusters-from-replication-group\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"count_cache_clusters_from_replication_group\",\n\"arguments\": {\n\"replication_group_id\": \"\"\n}\n}\n}\n
name: count-cache-clusters-from-replication-group\nprovider:\narguments:\nreplication_group_id: ''\nfunc: count_cache_clusters_from_replication_group\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_cache_clusters","title":"delete_cache_clusters","text":"Type action Module chaosaws.elasticache.actions Name delete_cache_clusters Return list

Deletes one or more cache clusters and creates a final snapshot

: cluster_ids: list: a list of one or more cache cluster ids final_snapshot_id: str: an identifier to give the final snapshot

Signature:

def delete_cache_clusters(\n        cluster_ids: List[str],\n        final_snapshot_id: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster_ids list Yes final_snapshot_id string null No

Usage:

JSONYAML
{\n\"name\": \"delete-cache-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"delete_cache_clusters\",\n\"arguments\": {\n\"cluster_ids\": []\n}\n}\n}\n
name: delete-cache-clusters\nprovider:\narguments:\ncluster_ids: []\nfunc: delete_cache_clusters\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_replication_groups","title":"delete_replication_groups","text":"Type action Module chaosaws.elasticache.actions Name delete_replication_groups Return list

Deletes one or more replication groups and creates a final snapshot

: group_ids: list: a list of one or more replication group ids final_snapshot_id: str: an identifier to give the final snapshot retain_primary_cluster: bool (default: True): delete only the read replicas associated to the replication group, not the primary

Signature:

def delete_replication_groups(\n        group_ids: List[str],\n        final_snapshot_id: str = None,\n        retain_primary_cluster: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group_ids list Yes final_snapshot_id string null No retain_primary_cluster boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-replication-groups\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"delete_replication_groups\",\n\"arguments\": {\n\"group_ids\": []\n}\n}\n}\n
name: delete-replication-groups\nprovider:\narguments:\ngroup_ids: []\nfunc: delete_replication_groups\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cache_cluster","title":"describe_cache_cluster","text":"Type probe Module chaosaws.elasticache.probes Name describe_cache_cluster Return mapping

Returns cache cluster data for given cluster

:param cluster_id: str: the name of the cache cluster :param show_node_info: bool: show associated nodes (default: False) :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache cluster engine\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.CacheClusters[0].Engine, \u201cexpect\u201d: \u201cmemcached\u201d }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cdescribe_cache_cluster\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elasticache.html#ElastiCache.Client.describe_cache_clusters

Signature:

def describe_cache_cluster(\n        cluster_id: str,\n        show_node_info: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes show_node_info boolean false No

Usage:

JSONYAML
{\n\"name\": \"describe-cache-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"describe_cache_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: describe-cache-cluster\nprovider:\narguments:\ncluster_id: ''\nfunc: describe_cache_cluster\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_cache_node_count","title":"get_cache_node_count","text":"Type probe Module chaosaws.elasticache.probes Name get_cache_node_count Return integer

Returns the number of cache nodes associated to the cluster

:param cluster_id: str: the name of the cache cluster :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache node count\u201d, \u201ctolerance\u201d: 3, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cget_cache_node_count\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Signature:

def get_cache_node_count(cluster_id: str,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cache-node-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"get_cache_node_count\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: get-cache-node-count\nprovider:\narguments:\ncluster_id: ''\nfunc: get_cache_node_count\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_cache_node_status","title":"get_cache_node_status","text":"Type probe Module chaosaws.elasticache.probes Name get_cache_node_status Return string

Returns the status of the given cache cluster

:param cluster_id: str: the name of the cache cluster :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache node status\u201d, \u201ctolerance\u201d: \u201cavailable\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cget_cache_node_status\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Signature:

def get_cache_node_status(cluster_id: str,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cache-node-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"get_cache_node_status\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: get-cache-node-status\nprovider:\narguments:\ncluster_id: ''\nfunc: get_cache_node_status\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#reboot_cache_clusters","title":"reboot_cache_clusters","text":"Type action Module chaosaws.elasticache.actions Name reboot_cache_clusters Return list

Reboots one or more nodes in a cache cluster. If no node ids are supplied, all nodes in the cluster will be rebooted

: cluster_ids: list: a list of one or more cache cluster ids node_ids: list: a list of one or more node ids in to the cluster

Signature:

def reboot_cache_clusters(\n        cluster_ids: List[str],\n        node_ids: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster_ids list Yes node_ids list null No

Usage:

JSONYAML
{\n\"name\": \"reboot-cache-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"reboot_cache_clusters\",\n\"arguments\": {\n\"cluster_ids\": []\n}\n}\n}\n
name: reboot-cache-clusters\nprovider:\narguments:\ncluster_ids: []\nfunc: reboot_cache_clusters\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#test_failover","title":"test_failover","text":"Type action Module chaosaws.elasticache.actions Name test_failover Return list

Tests automatic failover on a single shard (also known as node groups). You can only invoke test_failover for no more than 5 shards in any rolling 24-hour period.

: replication_group_id: str: the name of the replication group (also known as cluster) whose automatic failover is being tested by this operation. node_group_id: str: the name of the node group (also known as shard) in this replication group on which automatic failover is to be tested.

Signature:

def test_failover(\n        replication_group_id: str,\n        node_group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required replication_group_id string Yes node_group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"test-failover\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"test_failover\",\n\"arguments\": {\n\"replication_group_id\": \"\",\n\"node_group_id\": \"\"\n}\n}\n}\n
name: test-failover\nprovider:\narguments:\nnode_group_id: ''\nreplication_group_id: ''\nfunc: test_failover\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#elbv2","title":"elbv2","text":""},{"location":"drivers/aws/#all_targets_healthy","title":"all_targets_healthy","text":"Type probe Module chaosaws.elbv2.probes Name all_targets_healthy Return mapping

Return true/false based on if all targets for listed target groups are healthy

Signature:

def all_targets_healthy(\n        tg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"all-targets-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"all_targets_healthy\",\n\"arguments\": {\n\"tg_names\": []\n}\n}\n}\n
name: all-targets-healthy\nprovider:\narguments:\ntg_names: []\nfunc: all_targets_healthy\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_load_balancer","title":"delete_load_balancer","text":"Type action Module chaosaws.elbv2.actions Name delete_load_balancer Return None

Deletes the provided load balancer(s).

: - load_balancer_names: a list of load balancer names

Signature:

def delete_load_balancer(load_balancer_names: List[str],\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes

Usage:

JSONYAML
{\n\"name\": \"delete-load-balancer\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"delete_load_balancer\",\n\"arguments\": {\n\"load_balancer_names\": []\n}\n}\n}\n
name: delete-load-balancer\nprovider:\narguments:\nload_balancer_names: []\nfunc: delete_load_balancer\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#deregister_target","title":"deregister_target","text":"Type action Module chaosaws.elbv2.actions Name deregister_target Return mapping

Deregisters one random target from target group

Signature:

def deregister_target(\n        tg_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_name string Yes

Usage:

JSONYAML
{\n\"name\": \"deregister-target\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"deregister_target\",\n\"arguments\": {\n\"tg_name\": \"\"\n}\n}\n}\n
name: deregister-target\nprovider:\narguments:\ntg_name: ''\nfunc: deregister_target\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#enable_access_log","title":"enable_access_log","text":"Type action Module chaosaws.elbv2.actions Name enable_access_log Return boolean

Enable or Disable Access logs of ELB

Signature:

def enable_access_log(load_balancer_arn: str,\n                      enable: bool = False,\n                      bucket_name: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required load_balancer_arn string Yes enable boolean false No bucket_name string null No

Usage:

JSONYAML
{\n\"name\": \"enable-access-log\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"enable_access_log\",\n\"arguments\": {\n\"load_balancer_arn\": \"\"\n}\n}\n}\n
name: enable-access-log\nprovider:\narguments:\nload_balancer_arn: ''\nfunc: enable_access_log\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#is_access_log_enabled","title":"is_access_log_enabled","text":"Type probe Module chaosaws.elbv2.probes Name is_access_log_enabled Return mapping

Verify access logging enabled on load balancer

Signature:

def is_access_log_enabled(\n        load_balancer_arn: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"is-access-log-enabled\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"is_access_log_enabled\",\n\"arguments\": {\n\"load_balancer_arn\": \"\"\n}\n}\n}\n
name: is-access-log-enabled\nprovider:\narguments:\nload_balancer_arn: ''\nfunc: is_access_log_enabled\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#set_security_groups","title":"set_security_groups","text":"Type action Module chaosaws.elbv2.actions Name set_security_groups Return list

Changes the security groups for the specified load balancer(s). This action will replace the existing security groups on an application load balancer with the specified security groups.

: - load_balancer_names: a list of load balancer names - security_group_ids: a list of security group ids

returns: [ { \u2018LoadBalancerArn\u2019: \u2018string\u2019, \u2018SecurityGroupIds\u2019: [\u2018sg-0000000\u2019, \u2018sg-0000001\u2019] }, \u2026 ]

Signature:

def set_security_groups(\n        load_balancer_names: List[str],\n        security_group_ids: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes security_group_ids list Yes

Usage:

JSONYAML
{\n\"name\": \"set-security-groups\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"set_security_groups\",\n\"arguments\": {\n\"load_balancer_names\": [],\n\"security_group_ids\": []\n}\n}\n}\n
name: set-security-groups\nprovider:\narguments:\nload_balancer_names: []\nsecurity_group_ids: []\nfunc: set_security_groups\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#set_subnets","title":"set_subnets","text":"Type action Module chaosaws.elbv2.actions Name set_subnets Return list

Changes the subnets for the specified application load balancer(s) This action will replace the existing security groups on an application load balancer with the specified security groups.

: - load_balancer_names: a list of load balancer names - subnet_ids: a list of subnet ids

returns: [ { \u2018LoadBalancerArn\u2019: \u2018string\u2019, \u2018AvailabilityZones\u2019: { \u2018ZoneName\u2019: \u2018string\u2019, \u2018SubnetId\u2019: \u2018string\u2019, \u2018LoadBalancerAddresses\u2019: [ { \u2018IpAddress\u2019: \u2018string\u2019, \u2018AllocationId\u2019: \u2018string\u2019 } ] } }, \u2026 ]

Signature:

def set_subnets(\n        load_balancer_names: List[str],\n        subnet_ids: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes subnet_ids list Yes

Usage:

JSONYAML
{\n\"name\": \"set-subnets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"set_subnets\",\n\"arguments\": {\n\"load_balancer_names\": [],\n\"subnet_ids\": []\n}\n}\n}\n
name: set-subnets\nprovider:\narguments:\nload_balancer_names: []\nsubnet_ids: []\nfunc: set_subnets\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#targets_health_count","title":"targets_health_count","text":"Type probe Module chaosaws.elbv2.probes Name targets_health_count Return mapping

Count of healthy/unhealthy targets per targetgroup

Signature:

def targets_health_count(\n        tg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"targets-health-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"targets_health_count\",\n\"arguments\": {\n\"tg_names\": []\n}\n}\n}\n
name: targets-health-count\nprovider:\narguments:\ntg_names: []\nfunc: targets_health_count\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#emr","title":"emr","text":""},{"location":"drivers/aws/#describe_cluster_2","title":"describe_cluster","text":"Type probe Module chaosaws.emr.probes Name describe_cluster Return mapping

Describe a single EMR cluster

:param cluster_id: The cluster id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_cluster(\n        cluster_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\ncluster_id: ''\nfunc: describe_cluster\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instance_fleet","title":"describe_instance_fleet","text":"Type probe Module chaosaws.emr.probes Name describe_instance_fleet Return mapping

Describe a single EMR instance fleet

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_instance_fleet(\n        cluster_id: str,\n        fleet_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance-fleet\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_instance_fleet\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: describe-instance-fleet\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: describe_instance_fleet\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instance_group","title":"describe_instance_group","text":"Type probe Module chaosaws.emr.probes Name describe_instance_group Return mapping

Describe a single EMR instance group

:param cluster_id: The cluster id :param group_id: The instance group id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_instance_group(\n        cluster_id: str,\n        group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance-group\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_instance_group\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: describe-instance-group\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: describe_instance_group\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_cluster_fleet_instances","title":"list_cluster_fleet_instances","text":"Type probe Module chaosaws.emr.probes Name list_cluster_fleet_instances Return mapping

Get a list of instance fleet instances associated to the EMR cluster

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param fleet_type: The instance fleet type :param instance_states: A list of instance states to include :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def list_cluster_fleet_instances(\n        cluster_id: str,\n        fleet_id: str,\n        fleet_type: str = None,\n        instance_states: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes fleet_type string null No instance_states list null No

Usage:

JSONYAML
{\n\"name\": \"list-cluster-fleet-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"list_cluster_fleet_instances\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: list-cluster-fleet-instances\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: list_cluster_fleet_instances\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_cluster_group_instances","title":"list_cluster_group_instances","text":"Type probe Module chaosaws.emr.probes Name list_cluster_group_instances Return mapping

Get a list of instance group instances associated to the EMR cluster

:param cluster_id: The cluster id :param group_id: The instance group id :param group_type: The instance group type :param instance_states: A list of instance states to include :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def list_cluster_group_instances(\n        cluster_id: str,\n        group_id: str,\n        group_type: str = None,\n        instance_states: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes group_type string null No instance_states list null No

Usage:

JSONYAML
{\n\"name\": \"list-cluster-group-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"list_cluster_group_instances\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: list-cluster-group-instances\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: list_cluster_group_instances\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#modify_cluster","title":"modify_cluster","text":"Type action Module chaosaws.emr.actions Name modify_cluster Return mapping

Set the step concurrency level on the provided cluster

:param cluster_id: The cluster id :param concurrency: The number of steps to execute concurrently (1 - 256) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_cluster(\n        cluster_id: str,\n        concurrency: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes concurrency integer Yes

Usage:

JSONYAML
{\n\"name\": \"modify-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"concurrency\": 0\n}\n}\n}\n
name: modify-cluster\nprovider:\narguments:\ncluster_id: ''\nconcurrency: 0\nfunc: modify_cluster\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_fleet","title":"modify_instance_fleet","text":"Type action Module chaosaws.emr.actions Name modify_instance_fleet Return mapping

Modify the on-demand and spot capacities for an instance fleet

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param on_demand_capacity: Target capacity of on-demand units :param spot_capacity: Target capacity of spot units :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_fleet(\n        cluster_id: str,\n        fleet_id: str,\n        on_demand_capacity: int = None,\n        spot_capacity: int = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes on_demand_capacity integer null No spot_capacity integer null No

Usage:

JSONYAML
{\n\"name\": \"modify-instance-fleet\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_fleet\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: modify-instance-fleet\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: modify_instance_fleet\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_groups_instance_count","title":"modify_instance_groups_instance_count","text":"Type action Module chaosaws.emr.actions Name modify_instance_groups_instance_count Return mapping

Modify the number of instances in an instance group

:param cluster_id: The cluster id :param group_id: The instance group id :param instance_count: The target size for the instance group :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_groups_instance_count(\n        cluster_id: str,\n        group_id: str,\n        instance_count: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes instance_count integer Yes

Usage:

JSONYAML
{\n\"name\": \"modify-instance-groups-instance-count\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_groups_instance_count\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\",\n\"instance_count\": 0\n}\n}\n}\n
name: modify-instance-groups-instance-count\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\ninstance_count: 0\nfunc: modify_instance_groups_instance_count\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_groups_shrink_policy","title":"modify_instance_groups_shrink_policy","text":"Type action Module chaosaws.emr.actions Name modify_instance_groups_shrink_policy Return mapping

Modify an instance groups shrink operations

:param cluster_id: The cluster id :param group_id: The instance group id :param decommission_timeout: Timeout for decommissioning an instance :param terminate_instances: Instance id list to terminate when shrinking :param protect_instances: Instance id list to protect when shrinking :param termination_timeout: Override for list of instances to terminate :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_groups_shrink_policy(\n        cluster_id: str,\n        group_id: str,\n        decommission_timeout: int = None,\n        terminate_instances: List[str] = None,\n        protect_instances: List[str] = None,\n        termination_timeout: int = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes decommission_timeout integer null No terminate_instances list null No protect_instances list null No termination_timeout integer null No

Usage:

JSONYAML
{\n\"name\": \"modify-instance-groups-shrink-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_groups_shrink_policy\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: modify-instance-groups-shrink-policy\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: modify_instance_groups_shrink_policy\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#fis","title":"fis","text":""},{"location":"drivers/aws/#get_experiment","title":"get_experiment","text":"Type probe Module chaosaws.fis.probes Name get_experiment Return mapping

Gets information about the specified experiment.

:param experiment_id: str representing the id of the experiment to fetch information of :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon retrieving the experiment information

get_experiment( \u2026 experiment_id=\u201dEXPTUCK2dxepXgkR38\u201d \u2026 ) {\u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u20180665fe39-2213-400b-b7ff-5f1ab9b7a5ea\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Fri, 20 Aug 2021 11:08:27 GMT\u2019, \u2026 \u2018experiment\u2019: {\u2018id\u2019: \u2018EXPTUCK2dxepXgkR38\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

Signature:

def get_experiment(\n        experiment_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-experiment\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.probes\",\n\"func\": \"get_experiment\",\n\"arguments\": {\n\"experiment_id\": \"\"\n}\n}\n}\n
name: get-experiment\nprovider:\narguments:\nexperiment_id: ''\nfunc: get_experiment\nmodule: chaosaws.fis.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#start_experiment","title":"start_experiment","text":"Type action Module chaosaws.fis.actions Name start_experiment Return mapping

Starts running an experiment from the specified experiment template.

:param experiment_template_id: str representing the id of the experiment template to run :param client_token: str representing the unique identifier for this experiment run. If a value is not provided, boto3 generates one for you :param tags: Dict[str, str] representing tags to apply to the experiment that is started :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon starting the experiment

start_experiment( \u2026experiment_template_id=\u201dEXT6oWVA1WrLNy4XS\u201d \u2026 ) { \u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u20181ceaedae-5897-4b64-9ade-9e94449f1262\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Thu, 12 Aug 2021 14:21:19 GMT\u2019, \u2026 \u2018experiment\u2019: {\u2018id\u2019: \u2018EXPXDPecuQBFiZs1Jz\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

start_experiment( \u2026experiment_template_id=\u201dEXT6oWVA1WrLNy4XS\u201d, \u2026client_token=\u201dmy-unique-token\u201d, \u2026tags={\u201ca-key\u201d: \u201ca-value\u201d} \u2026 )

Signature:

def start_experiment(\n        experiment_template_id: str,\n        client_token: str = None,\n        tags: Dict[str, str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_template_id string Yes client_token string null No tags mapping null No

Usage:

JSONYAML
{\n\"name\": \"start-experiment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.actions\",\n\"func\": \"start_experiment\",\n\"arguments\": {\n\"experiment_template_id\": \"\"\n}\n}\n}\n
name: start-experiment\nprovider:\narguments:\nexperiment_template_id: ''\nfunc: start_experiment\nmodule: chaosaws.fis.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_experiment","title":"stop_experiment","text":"Type action Module chaosaws.fis.actions Name stop_experiment Return mapping

Stops the specified experiment.

:param experiment_id: str representing the running experiment to stop :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon stopping the experiment

stop_experiment(experiment_id=\u201dEXPTUCK2dxepXgkR38\u201d) {\u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u2018e5e9f9a9-f4d0-4d72-8704-1f26cc8b6ad6\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Fri, 13 Aug 2021 09:12:17 GMT\u2019, \u2026\u2019experiment\u2019: {\u2018id\u2019: \u2018EXPTUCK2dxepXgkR38\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

Signature:

def stop_experiment(\n        experiment_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_id string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-experiment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.actions\",\n\"func\": \"stop_experiment\",\n\"arguments\": {\n\"experiment_id\": \"\"\n}\n}\n}\n
name: stop-experiment\nprovider:\narguments:\nexperiment_id: ''\nfunc: stop_experiment\nmodule: chaosaws.fis.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#iam","title":"iam","text":""},{"location":"drivers/aws/#attach_role_policy","title":"attach_role_policy","text":"Type action Module chaosaws.iam.actions Name attach_role_policy Return mapping

Attach a role to a policy.

Signature:

def attach_role_policy(\n        arn: str,\n        role_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required arn string Yes role_name string Yes

Usage:

JSONYAML
{\n\"name\": \"attach-role-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"attach_role_policy\",\n\"arguments\": {\n\"arn\": \"\",\n\"role_name\": \"\"\n}\n}\n}\n
name: attach-role-policy\nprovider:\narguments:\narn: ''\nrole_name: ''\nfunc: attach_role_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#create_policy","title":"create_policy","text":"Type action Module chaosaws.iam.actions Name create_policy Return mapping

Create a new IAM policy

Signature:

def create_policy(name: str,\n                  policy: Dict[str, Any],\n                  path: str = '/',\n                  description: str = '',\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes policy mapping Yes path string \u201d/\u201d No description string \u201d\u201c No

Usage:

JSONYAML
{\n\"name\": \"create-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"create_policy\",\n\"arguments\": {\n\"name\": \"\",\n\"policy\": {}\n}\n}\n}\n
name: create-policy\nprovider:\narguments:\nname: ''\npolicy: {}\nfunc: create_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#detach_role_policy","title":"detach_role_policy","text":"Type action Module chaosaws.iam.actions Name detach_role_policy Return mapping

Detach a role from a policy.

Signature:

def detach_role_policy(\n        arn: str,\n        role_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required arn string Yes role_name string Yes

Usage:

JSONYAML
{\n\"name\": \"detach-role-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"detach_role_policy\",\n\"arguments\": {\n\"arn\": \"\",\n\"role_name\": \"\"\n}\n}\n}\n
name: detach-role-policy\nprovider:\narguments:\narn: ''\nrole_name: ''\nfunc: detach_role_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_policy","title":"get_policy","text":"Type probe Module chaosaws.iam.probes Name get_policy Return boolean

Get a policy by its ARN

Signature:

def get_policy(arn: str,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required arn string Yes

Usage:

JSONYAML
{\n\"name\": \"get-policy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.probes\",\n\"func\": \"get_policy\",\n\"arguments\": {\n\"arn\": \"\"\n}\n}\n}\n
name: get-policy\nprovider:\narguments:\narn: ''\nfunc: get_policy\nmodule: chaosaws.iam.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#rds","title":"rds","text":""},{"location":"drivers/aws/#cluster_membership_count","title":"cluster_membership_count","text":"Type probe Module chaosaws.rds.probes Name cluster_membership_count Return integer

Signature:

def cluster_membership_count(cluster_id: str,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"cluster-membership-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"cluster_membership_count\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: cluster-membership-count\nprovider:\narguments:\ncluster_id: ''\nfunc: cluster_membership_count\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#cluster_status","title":"cluster_status","text":"Type probe Module chaosaws.rds.probes Name cluster_status Return Union[str, List[str]]

Signature:

def cluster_status(\n        cluster_id: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Union[str, List[str]]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"cluster-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"cluster_status\"\n}\n}\n
name: cluster-status\nprovider:\nfunc: cluster_status\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_db_cluster","title":"delete_db_cluster","text":"Type action Module chaosaws.rds.actions Name delete_db_cluster Return mapping

Deletes an Aurora DB cluster

Signature:

def delete_db_cluster(\n        db_cluster_identifier: str,\n        skip_final_snapshot: bool = True,\n        db_snapshot_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes skip_final_snapshot boolean true No db_snapshot_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"delete-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: delete-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: delete_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_db_cluster_endpoint","title":"delete_db_cluster_endpoint","text":"Type action Module chaosaws.rds.actions Name delete_db_cluster_endpoint Return mapping

Deletes the custom endpoint of an Aurora cluster

Signature:

def delete_db_cluster_endpoint(\n        db_cluster_identifier: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-db-cluster-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_cluster_endpoint\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: delete-db-cluster-endpoint\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: delete_db_cluster_endpoint\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_db_instance","title":"delete_db_instance","text":"Type action Module chaosaws.rds.actions Name delete_db_instance Return mapping

Deletes a RDS instance

Signature:

def delete_db_instance(\n        db_instance_identifier: str,\n        skip_final_snapshot: bool = True,\n        db_snapshot_identifier: str = None,\n        delete_automated_backups: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes skip_final_snapshot boolean true No db_snapshot_identifier string null No delete_automated_backups boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: delete-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: delete_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#failover_db_cluster","title":"failover_db_cluster","text":"Type action Module chaosaws.rds.actions Name failover_db_cluster Return mapping

Forces a failover for a DB cluster.

Signature:

def failover_db_cluster(\n        db_cluster_identifier: str,\n        target_db_instance_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes target_db_instance_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"failover-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"failover_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: failover-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: failover_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#instance_status","title":"instance_status","text":"Type probe Module chaosaws.rds.probes Name instance_status Return Union[str, List[str]]

Signature:

def instance_status(\n        instance_id: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Union[str, List[str]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"instance-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"instance_status\"\n}\n}\n
name: instance-status\nprovider:\nfunc: instance_status\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#reboot_db_instance","title":"reboot_db_instance","text":"Type action Module chaosaws.rds.actions Name reboot_db_instance Return mapping

Forces a reboot of your DB instance.

Signature:

def reboot_db_instance(\n        db_instance_identifier: str,\n        force_failover: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes force_failover boolean false No

Usage:

JSONYAML
{\n\"name\": \"reboot-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"reboot_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: reboot-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: reboot_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_db_cluster","title":"stop_db_cluster","text":"Type action Module chaosaws.rds.actions Name stop_db_cluster Return mapping

Stop a RDS Cluster

Signature:

def stop_db_cluster(\n        db_cluster_identifier: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"stop_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: stop-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: stop_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_db_instance","title":"stop_db_instance","text":"Type action Module chaosaws.rds.actions Name stop_db_instance Return mapping

Stops a RDS DB instance

Signature:

def stop_db_instance(\n        db_instance_identifier: str,\n        db_snapshot_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes db_snapshot_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"stop-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"stop_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: stop-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: stop_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#route53","title":"route53","text":""},{"location":"drivers/aws/#associate_vpc_with_zone","title":"associate_vpc_with_zone","text":"Type action Module chaosaws.route53.actions Name associate_vpc_with_zone Return mapping

Associate a VPC with a private hosted zone

:param zone_id: The hosted zone id :param vpc_id: The id of the vpc :param vpc_region: The region of the vpc :param configuration: access values used by actions/probes :param comment: a comment regarding the request :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def associate_vpc_with_zone(\n        zone_id: str,\n        vpc_id: str,\n        vpc_region: str,\n        comment: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes vpc_id string Yes vpc_region string Yes comment string null No

Usage:

JSONYAML
{\n\"name\": \"associate-vpc-with-zone\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.actions\",\n\"func\": \"associate_vpc_with_zone\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"vpc_id\": \"\",\n\"vpc_region\": \"\"\n}\n}\n}\n
name: associate-vpc-with-zone\nprovider:\narguments:\nvpc_id: ''\nvpc_region: ''\nzone_id: ''\nfunc: associate_vpc_with_zone\nmodule: chaosaws.route53.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#disassociate_vpc_from_zone","title":"disassociate_vpc_from_zone","text":"Type action Module chaosaws.route53.actions Name disassociate_vpc_from_zone Return mapping

Remove an association between a VPC and a private hosted zone

:param zone_id: The hosted zone id :param vpc_id: The id of the vpc :param vpc_region: The region of the vpc :param comment: A note regarding the disassociation request :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def disassociate_vpc_from_zone(\n        zone_id: str,\n        vpc_id: str,\n        vpc_region: str,\n        comment: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes vpc_id string Yes vpc_region string Yes comment string null No

Usage:

JSONYAML
{\n\"name\": \"disassociate-vpc-from-zone\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.actions\",\n\"func\": \"disassociate_vpc_from_zone\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"vpc_id\": \"\",\n\"vpc_region\": \"\"\n}\n}\n}\n
name: disassociate-vpc-from-zone\nprovider:\narguments:\nvpc_id: ''\nvpc_region: ''\nzone_id: ''\nfunc: disassociate_vpc_from_zone\nmodule: chaosaws.route53.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_dns_answer","title":"get_dns_answer","text":"Type probe Module chaosaws.route53.probes Name get_dns_answer Return mapping

Get the DNS response for the specified record name & type

:param zone_id: The route53 zone id :param record_name: The name of the record to get a response for :param record_type: The type of the record set :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_dns_answer(\n        zone_id: str,\n        record_name: str,\n        record_type: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes record_name string Yes record_type string Yes

Usage:

JSONYAML
{\n\"name\": \"get-dns-answer\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_dns_answer\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"record_name\": \"\",\n\"record_type\": \"\"\n}\n}\n}\n
name: get-dns-answer\nprovider:\narguments:\nrecord_name: ''\nrecord_type: ''\nzone_id: ''\nfunc: get_dns_answer\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_health_check_status","title":"get_health_check_status","text":"Type probe Module chaosaws.route53.probes Name get_health_check_status Return mapping

Get the status of the specified health check

:param check_id: The health check id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_health_check_status(\n        check_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required check_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-health-check-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_health_check_status\",\n\"arguments\": {\n\"check_id\": \"\"\n}\n}\n}\n
name: get-health-check-status\nprovider:\narguments:\ncheck_id: ''\nfunc: get_health_check_status\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_hosted_zone","title":"get_hosted_zone","text":"Type probe Module chaosaws.route53.probes Name get_hosted_zone Return mapping

Pull information regarding a specific zone id

:param zone_id: The route53 zone id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_hosted_zone(\n        zone_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-hosted-zone\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_hosted_zone\",\n\"arguments\": {\n\"zone_id\": \"\"\n}\n}\n}\n
name: get-hosted-zone\nprovider:\narguments:\nzone_id: ''\nfunc: get_hosted_zone\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#s3","title":"s3","text":""},{"location":"drivers/aws/#bucket_exists","title":"bucket_exists","text":"Type probe Module chaosaws.s3.probes Name bucket_exists Return boolean

Validate that a bucket exists

:param bucket_name: The name of the S3 bucket :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: boolean

Signature:

def bucket_exists(bucket_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes

Usage:

JSONYAML
{\n\"name\": \"bucket-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.probes\",\n\"func\": \"bucket_exists\",\n\"arguments\": {\n\"bucket_name\": \"\"\n}\n}\n}\n
name: bucket-exists\nprovider:\narguments:\nbucket_name: ''\nfunc: bucket_exists\nmodule: chaosaws.s3.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_object","title":"delete_object","text":"Type action Module chaosaws.s3.actions Name delete_object Return None

Delete an object in a S3 bucket

:param bucket_name: the S3 bucket name :param object_key: the path to the object :param version_id: the version id of the object (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: None

Signature:

def delete_object(bucket_name: str,\n                  object_key: str,\n                  version_id: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_key string Yes version_id string null No

Usage:

JSONYAML
{\n\"name\": \"delete-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.actions\",\n\"func\": \"delete_object\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_key\": \"\"\n}\n}\n}\n
name: delete-object\nprovider:\narguments:\nbucket_name: ''\nobject_key: ''\nfunc: delete_object\nmodule: chaosaws.s3.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#object_exists","title":"object_exists","text":"Type probe Module chaosaws.s3.probes Name object_exists Return boolean

Validate that an object exists in a S3 bucket

:param bucket_name: the name of the S3 bucket :param object_key: the path to the object :param version_id: the version id of the object (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: boolean

Signature:

def object_exists(bucket_name: str,\n                  object_key: str,\n                  version_id: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_key string Yes version_id string null No

Usage:

JSONYAML
{\n\"name\": \"object-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.probes\",\n\"func\": \"object_exists\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_key\": \"\"\n}\n}\n}\n
name: object-exists\nprovider:\narguments:\nbucket_name: ''\nobject_key: ''\nfunc: object_exists\nmodule: chaosaws.s3.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#toggle_versioning","title":"toggle_versioning","text":"Type action Module chaosaws.s3.actions Name toggle_versioning Return null

Toggles versioning on a S3 bucket

If the \u201cstatus\u201d parameter is not provided, the bucket will be scanned to determine if versioning is enabled. If it is enabled, it will be suspended. If it is suspended it will be enabled using basic values unless MFA is provided.

:param bucket_name: The S3 bucket name :param status: \u201cEnabled\u201d to turn on versioning, \u201cSuspended\u201d to disable :param mfa: The authentication device serial number, a space, and the value from the device (optional) :param mfa_delete: Specifies if MFA delete is enabled in the bucket versioning (optional) :param owner: The account ID of the expected bucket owner (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: None

Signature:

def toggle_versioning(bucket_name: str,\n                      mfa_delete: str = None,\n                      status: str = None,\n                      mfa: str = None,\n                      owner: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> None:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes mfa_delete string null No status string null No mfa string null No owner string null No

Usage:

JSONYAML
{\n\"name\": \"toggle-versioning\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.actions\",\n\"func\": \"toggle_versioning\",\n\"arguments\": {\n\"bucket_name\": \"\"\n}\n}\n}\n
name: toggle-versioning\nprovider:\narguments:\nbucket_name: ''\nfunc: toggle_versioning\nmodule: chaosaws.s3.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#controls","title":"controls","text":""},{"location":"drivers/aws/#ssm","title":"ssm","text":""},{"location":"drivers/aws/#create_document","title":"create_document","text":"Type action Module chaosaws.ssm.actions Name create_document Return mapping

creates a Systems Manager (SSM) document. An SSM document defines the actions that SSM performs on your managed. For more information about SSM documents: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.create_document

Signature:

def create_document(\n        path_content: str,\n        name: str,\n        version_name: str = None,\n        document_type: str = None,\n        document_format: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required path_content string Yes name string Yes version_name string null No document_type string null No document_format string null No

Usage:

JSONYAML
{\n\"name\": \"create-document\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"create_document\",\n\"arguments\": {\n\"path_content\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: create-document\nprovider:\narguments:\nname: ''\npath_content: ''\nfunc: create_document\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_document","title":"delete_document","text":"Type action Module chaosaws.ssm.actions Name delete_document Return mapping

creates a Systems Manager (SSM) document.

An SSM document defines the actions that SSM performs on your managed. For more information about SSM documents: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.create_document

Signature:

def delete_document(\n        name: str,\n        version_name: str = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes version_name string null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-document\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"delete_document\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: delete-document\nprovider:\narguments:\nname: ''\nfunc: delete_document\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_parameter","title":"put_parameter","text":"Type action Module chaosaws.ssm.actions Name put_parameter Return mapping

Add or update a parameter in the Systems Manager Parameter Store.

:param name: str name of the parameter :param value: str value of the parameter :param description: str information about the parameter :param type: str type of the paramater value, such as \u2018String\u2019 :param key_id: str KMS key id to use while encrypting the parameter value :param overwrite: bool allow the parameter value to be overwritten :param allowed_pattern: str regex to validate parameter value :param tags: List[Dict[str, str]] metadata about the parameter :param tier: str storage classes such as \u2018Advanced\u2019 to allow larger parameter values :param policies: str storage policies such as expiration in JSON format :param data_type: str data type for String. Allows the validation of AMI IDs :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: dict representing the Version and Tier of the parameter

Configuration within experiment { \u201cname\u201d: \u201cActivate Chaos\u201d, \u201ctype\u201d: \u201caction\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ssm.actions\u201d, \u201cfunc\u201d: \u201cput_parameter\u201d, \u201carguments\u201d: { \u201cname\u201d: \u201cchaos_trigger\u201d, \u201cvalue\u201d: true, \u201coverwrite\u201d: true, \u201ctype\u201d: \u201cSecureString\u201d, } }, }

Signature:

def put_parameter(name: str,\n                  value: str,\n                  description: str = None,\n                  type: str = None,\n                  key_id: str = None,\n                  overwrite: bool = False,\n                  allowed_pattern: str = None,\n                  tags: List[Dict[str, str]] = None,\n                  tier: str = None,\n                  policies: str = None,\n                  data_type: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes value string Yes description string null No type string null No key_id string null No overwrite boolean false No allowed_pattern string null No tags list null No tier string null No policies string null No data_type string null No

Usage:

JSONYAML
{\n\"name\": \"put-parameter\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"put_parameter\",\n\"arguments\": {\n\"name\": \"\",\n\"value\": \"\"\n}\n}\n}\n
name: put-parameter\nprovider:\narguments:\nname: ''\nvalue: ''\nfunc: put_parameter\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#send_command","title":"send_command","text":"Type action Module chaosaws.ssm.actions Name send_command Return mapping

Runs commands on one or more managed instances.

An SSM document defines the actions that SSM performs on your managed. For more information about SSM SendCommand: https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_SendCommand.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.send_command

Signature:

def send_command(document_name: str,\n                 targets: List[Dict[str, Any]] = None,\n                 document_version: str = None,\n                 parameters: Dict[str, Any] = None,\n                 timeout_seconds: int = None,\n                 max_concurrency: str = None,\n                 max_errors: str = None,\n                 region: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required document_name string Yes targets list null No document_version string null No parameters mapping null No timeout_seconds integer null No max_concurrency string null No max_errors string null No region string null No

Usage:

JSONYAML
{\n\"name\": \"send-command\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"send_command\",\n\"arguments\": {\n\"document_name\": \"\"\n}\n}\n}\n
name: send-command\nprovider:\narguments:\ndocument_name: ''\nfunc: send_command\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#xray","title":"xray","text":""},{"location":"drivers/aws/#get_most_recent_trace","title":"get_most_recent_trace","text":"Type probe Module chaosaws.xray.probes Name get_most_recent_trace Return Union[Dict[str, Any], List[Dict[str, Any]]]

Return a list of recent XRay traces within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

Be careful about what you ask for, this can lead to a huge amount of traces being returned. Try to filter using filter_expression.

The response is the AWS response as-is. The content of each segments of the trace are encoded as a json string. By setting raw_segments you ask for the list of segment documents decoded. Useful in an hypothesis scenario with a tolerance set to a jsonpath for instance.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/batch_get_traces.html

Signature:

def get_most_recent_trace(\n    start_time: Union[str, float] = '3 minutes',\n    end_time: Union[str, float] = 'now',\n    time_range_type: str = 'TraceId',\n    filter_expression: str = 'groupname = \"Default\"',\n    sampling: bool = False,\n    sampling_strategy: Optional[Dict[str, float]] = None,\n    raw_segments: bool = False,\n    configuration: Dict[str, Dict[str, str]] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Union[Dict[str, Any], List[Dict[str, Any]]]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No raw_segments boolean false No

Usage:

JSONYAML
{\n\"name\": \"get-most-recent-trace\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_most_recent_trace\"\n}\n}\n
name: get-most-recent-trace\nprovider:\nfunc: get_most_recent_trace\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_service_graph","title":"get_service_graph","text":"Type probe Module chaosaws.xray.probes Name get_service_graph Return Union[Dict[str, Any], List[Dict[str, Any]]]

Return a service graph for a given group at a given moment.

See more information: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/get_service_graph.html

Signature:

def get_service_graph(\n    start_time: Union[str, float] = '3 minutes',\n    end_time: Union[str, float] = 'now',\n    group_name: Optional[str] = 'Default',\n    group_arn: Optional[str] = None,\n    configuration: Dict[str, Dict[str, str]] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Union[Dict[str, Any], List[Dict[str, Any]]]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No group_name object \u201cDefault\u201d No group_arn object null No

Usage:

JSONYAML
{\n\"name\": \"get-service-graph\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_service_graph\"\n}\n}\n
name: get-service-graph\nprovider:\nfunc: get_service_graph\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_traces","title":"get_traces","text":"Type probe Module chaosaws.xray.probes Name get_traces Return mapping

Return a list of recent XRay traces within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

This will never return more than 5 traces as per the limits set by the AWS API. It will always pick the 5 newest.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/batch_get_traces.html

Signature:

def get_traces(start_time: Union[str, float] = '3 minutes',\n               end_time: Union[str, float] = 'now',\n               time_range_type: str = 'TraceId',\n               filter_expression: str = 'groupname = \"Default\"',\n               sampling: bool = False,\n               sampling_strategy: Optional[Dict[str, float]] = None,\n               quantity: int = 5,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No quantity integer 5 No

Usage:

JSONYAML
{\n\"name\": \"get-traces\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_traces\"\n}\n}\n
name: get-traces\nprovider:\nfunc: get_traces\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_traces_summaries","title":"get_traces_summaries","text":"Type probe Module chaosaws.xray.probes Name get_traces_summaries Return mapping

Return a list of recent XRay trace summaries within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

Be careful about what you ask for, this can lead to a huge amount of traces being returned. Try to filter using filter_expression and/or sampling.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/get_trace_summaries.html

Signature:

def get_traces_summaries(\n        start_time: Union[str, float] = '3 minutes',\n        end_time: Union[str, float] = 'now',\n        time_range_type: str = 'TraceId',\n        filter_expression: str = 'groupname = \"Default\"',\n        sampling: bool = False,\n        sampling_strategy: Optional[Dict[str, float]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No

Usage:

JSONYAML
{\n\"name\": \"get-traces-summaries\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_traces_summaries\"\n}\n}\n
name: get-traces-summaries\nprovider:\nfunc: get_traces_summaries\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/","title":"Extension chaosazure","text":"Version 0.16.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-azure

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Azure platform.

"},{"location":"drivers/azure/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-azure\n
"},{"location":"drivers/azure/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vm.actions\",\n\"func\": \"stop_machines\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/azure/#configuration","title":"Configuration","text":"

This extension uses the Azure SDK libraries under the hood. The Azure SDK library expects that you have a tenant and client identifier, as well as a client secret and subscription, that allows you to authenticate with the Azure resource management API.

Configuration values for the Chaos Toolkit Extension for Azure can come from several sources:

The extension will first try to load the configuration from the experiment file. If configuration is not provided in the experiment file, it will try to load it from the Azure credential file.

"},{"location":"drivers/azure/#credentials","title":"Credentials","text":""},{"location":"drivers/azure/#environment-variables","title":"Environment Variables","text":"

You can pass credentials via the following environment variables:

Or:

"},{"location":"drivers/azure/#experiment-secrets","title":"Experiment Secrets","text":"

You may also pass them via the secrets block of the experiment:

{\n\"secrets\": {\n\"azure\": {\n\"client_id\": \"your-super-secret-client-id\",\n\"client_secret\": \"your-even-more-super-secret-client-secret\",\n\"tenant_id\": \"your-tenant-id\"\n}\n}\n}\n

You can retrieve secretes as well from environment or HashiCorp vault.

If you are not working with Public Global Azure, e.g. China Cloud You can set the cloud environment.

{\n\"client_id\": \"your-super-secret-client-id\",\n\"client_secret\": \"your-even-more-super-secret-client-secret\",\n\"tenant_id\": \"your-tenant-id\",\n\"cloud\": \"AZURE_CHINA_CLOUD\"\n}\n

Available cloud names:

Either of these values can be passed via AZURE_CLOUD as well.

"},{"location":"drivers/azure/#azure-credential-file","title":"Azure Credential File","text":"

You may also pass them via the Azure credential file:

You can retrieve a credentials file with your subscription ID already in place by signing in to Azure using the az login command followed by the az ad sp create-for-rbac command

az login\naz ad sp create-for-rbac --sdk-auth > credentials.json\n

credentials.json:

{\n\"subscriptionId\": \"<azure_aubscription_id>\",\n\"tenantId\": \"<tenant_id>\",\n\"clientId\": \"<application_id>\",\n\"clientSecret\": \"<application_secret>\",\n\"activeDirectoryEndpointUrl\": \"https://login.microsoftonline.com\",\n\"resourceManagerEndpointUrl\": \"https://management.azure.com/\",\n\"activeDirectoryGraphResourceId\": \"https://graph.windows.net/\",\n\"sqlManagementEndpointUrl\": \"https://management.core.windows.net:8443/\",\n\"galleryEndpointUrl\": \"https://gallery.azure.com/\",\n\"managementEndpointUrl\": \"https://management.core.windows.net/\"\n}\n

Store the path to the file in an environment variable called AZURE_AUTH_LOCATION and make sure that your experiment does NOT contain secrets section.

"},{"location":"drivers/azure/#subscription","title":"Subscription","text":"

Additionally you need to provide the Azure subscription id.

{\n\"configuration\": {\n\"azure_subscription_id\": \"your-azure-subscription-id\"\n}\n}\n

Configuration may be as well retrieved from an environment.

An old, but deprecated way of doing it was as follows, this still works but should not be favoured over the previous approaches as it\u2019s not the Chaos Toolkit way to pass structured configurations.

{\n\"configuration\": {\n\"azure\": {\n\"subscription_id\": \"your-azure-subscription-id\"\n}\n}\n}\n

Credential file described in the previous \u201cCredential\u201d section contains as well subscription id. If AZURE_AUTH_LOCATION is set and subscription id is NOT set in the experiment definition, extension will try to load it from the credential file.

"},{"location":"drivers/azure/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example for an experiment containing secrets and configuration:

{\n\"version\": \"1.0.0\",\n\"title\": \"...\",\n\"description\": \"...\",\n\"tags\": [\"azure\", \"kubernetes\", \"aks\", \"node\"],\n\"configuration\": {\n\"azure_subscription_id\": \"xxx\"\n},\n\"secrets\": {\n\"azure\": {\n\"client_id\": \"xxx\",\n\"client_secret\": \"xxx\",\n\"tenant_id\": \"xxx\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Services are all available and healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"consumer-service-must-still-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://some-url/\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"restart-node-at-random\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"restart_machines\",\n\"secrets\": [\"azure\"],\n\"config\": [\"azure_subscription_id\"]\n}\n}\n],\n\"rollbacks\": []\n}\n
"},{"location":"drivers/azure/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/azure/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/azure/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/azure/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/azure/#aks","title":"aks","text":""},{"location":"drivers/azure/#count_managed_clusters","title":"count_managed_clusters","text":"Type probe Module chaosazure.aks.probes Name count_managed_clusters Return integer

Return count of Azure managed cluster.

\u2013 filter : str Filter the managed cluster. If the filter is omitted all managed_clusters in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_managed_clusters(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-managed-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.probes\",\n\"func\": \"count_managed_clusters\"\n}\n}\n
name: count-managed-clusters\nprovider:\nfunc: count_managed_clusters\nmodule: chaosazure.aks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_managed_clusters","title":"delete_managed_clusters","text":"Type action Module chaosazure.aks.actions Name delete_managed_clusters Return None

Delete a managed cluster at random from a managed Azure Kubernetes Service.

Be aware: Deleting a managed cluster is an invasive action. You will not be able to recover the managed cluster once you deleted it.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def delete_managed_clusters(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"delete_managed_clusters\"\n}\n}\n
name: delete-managed-clusters\nprovider:\nfunc: delete_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_node","title":"delete_node","text":"Type action Module chaosazure.aks.actions Name delete_node Return None

Delete a node at random from a managed Azure Kubernetes Service.

Be aware: Deleting a node is an invasive action. You will not be able to recover the node once you deleted it.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def delete_node(filter: str = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"delete_node\"\n}\n}\n
name: delete-node\nprovider:\nfunc: delete_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_managed_clusters","title":"describe_managed_clusters","text":"Type probe Module chaosazure.aks.probes Name describe_managed_clusters Return None

Describe Azure managed cluster.

\u2013 filter : str Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_managed_clusters(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-managed-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.probes\",\n\"func\": \"describe_managed_clusters\"\n}\n}\n
name: describe-managed-clusters\nprovider:\nfunc: describe_managed_clusters\nmodule: chaosazure.aks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_node","title":"restart_node","text":"Type action Module chaosazure.aks.actions Name restart_node Return None

Restart a node at random from a managed Azure Kubernetes Service.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def restart_node(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"restart_node\"\n}\n}\n
name: restart-node\nprovider:\nfunc: restart_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_managed_clusters","title":"start_managed_clusters","text":"Type action Module chaosazure.aks.actions Name start_managed_clusters Return None

Start managed cluster at random.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def start_managed_clusters(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"start_managed_clusters\"\n}\n}\n
name: start-managed-clusters\nprovider:\nfunc: start_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_managed_clusters","title":"stop_managed_clusters","text":"Type action Module chaosazure.aks.actions Name stop_managed_clusters Return None

Stop managed cluster at random.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def stop_managed_clusters(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"stop_managed_clusters\"\n}\n}\n
name: stop-managed-clusters\nprovider:\nfunc: stop_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_node","title":"stop_node","text":"Type action Module chaosazure.aks.actions Name stop_node Return None

Stop a node at random from a managed Azure Kubernetes Service.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def stop_node(filter: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"stop_node\"\n}\n}\n
name: stop-node\nprovider:\nfunc: stop_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#application_gateway","title":"application_gateway","text":""},{"location":"drivers/azure/#count_application_gateways","title":"count_application_gateways","text":"Type probe Module chaosazure.application_gateway.probes Name count_application_gateways Return integer

Return count of Azure application gateways.

\u2013 filter : str Filter the application gateways. If the filter is omitted all application_gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_application_gateways(\n        filter: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-application-gateways\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"count_application_gateways\"\n}\n}\n
name: count-application-gateways\nprovider:\nfunc: count_application_gateways\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_application_gateways","title":"delete_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name delete_application_gateways Return None

Delete application gateways at random.

Be aware: Deleting an application gateway is an invasive action. You will not be able to recover the application gateway once you deleted it.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all application_gateways from the group \u2018rg\u2019

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two application_gateways at random from the group \u2018rg\u2019

Signature:

def delete_application_gateways(filter: str = None,\n                                configuration: Dict[str, Dict[str,\n                                                              str]] = None,\n                                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"delete_application_gateways\"\n}\n}\n
name: delete-application-gateways\nprovider:\nfunc: delete_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_routes","title":"delete_routes","text":"Type action Module chaosazure.application_gateway.actions Name delete_routes Return None

Delete routes at random. Be aware: Deleting a route is an invasive action. You will not be able to recover the route once you deleted it.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all routes of all application gateways in the subscription will be selected as potential chaos candidates. name_pattern : str, optional Filter the routes. If the filter is omitted all routes except the first in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_routes(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all route named \u2018chaos-\u2019 in all application gateways from the group \u2018rg\u2019 delete_routes(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all route named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

If all routes are deleted the first will be kept

Signature:

def delete_routes(filter: str = None,\n                  name_pattern: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-routes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"delete_routes\"\n}\n}\n
name: delete-routes\nprovider:\nfunc: delete_routes\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_application_gateways","title":"describe_application_gateways","text":"Type probe Module chaosazure.application_gateway.probes Name describe_application_gateways Return None

Describe Azure application gateways.

\u2013 filter : str Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_application_gateways(filter: str = None,\n                                  configuration: Dict[str, Dict[str,\n                                                                str]] = None,\n                                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-application-gateways\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"describe_application_gateways\"\n}\n}\n
name: describe-application-gateways\nprovider:\nfunc: describe_application_gateways\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_routes","title":"describe_routes","text":"Type probe Module chaosazure.application_gateway.probes Name describe_routes Return None

Describe Azure application gateways routes.

\u2013 filter : str Filter the application_gateways. If the filter is omitted all application gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the routes. If the filter is omitted all routes in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_routes(filter: str = None,\n                    name_pattern: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-routes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"describe_routes\"\n}\n}\n
name: describe-routes\nprovider:\nfunc: describe_routes\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#start_application_gateways","title":"start_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name start_application_gateways Return None

Start application gateway at random.

\u2013 filter : str, optional Filter the application gateway. If the filter is omitted all application gateway in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all application gateways from the group \u2018rg\u2019

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two application gateways at random from the group \u2018rg\u2019

Signature:

def start_application_gateways(filter: str = None,\n                               configuration: Dict[str, Dict[str, str]] = None,\n                               secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"start_application_gateways\"\n}\n}\n
name: start-application-gateways\nprovider:\nfunc: start_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_application_gateways","title":"stop_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name stop_application_gateways Return None

Stop application gateways at random.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all application gateways from the group \u2018rg\u2019

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two application gateways at random from the group \u2018rg\u2019

Signature:

def stop_application_gateways(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"stop_application_gateways\"\n}\n}\n
name: stop-application-gateways\nprovider:\nfunc: stop_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#machine","title":"machine","text":""},{"location":"drivers/azure/#burn_io","title":"burn_io","text":"Type action Module chaosazure.machine.actions Name burn_io Return None

Increases the Disk I/O operations per second of the virtual machine.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional How long the burn lasts. Defaults to 60 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Increase the I/O operations per second of all machines from the group \u2018rg\u2019

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Increase the I/O operations per second of the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Increase the I/O operations per second of two machines at random from the group \u2018rg\u2019

Signature:

def burn_io(filter: str = None,\n            duration: int = 60,\n            timeout: int = 60,\n            configuration: Dict[str, Dict[str, str]] = None,\n            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 60 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"burn-io\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"burn_io\"\n}\n}\n
name: burn-io\nprovider:\nfunc: burn_io\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#count_machines","title":"count_machines","text":"Type probe Module chaosazure.machine.probes Name count_machines Return integer

Return count of Azure virtual machines.

\u2013 filter : str Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_machines(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-machines\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.probes\",\n\"func\": \"count_machines\"\n}\n}\n
name: count-machines\nprovider:\nfunc: count_machines\nmodule: chaosazure.machine.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_machines","title":"delete_machines","text":"Type action Module chaosazure.machine.actions Name delete_machines Return None

Delete virtual machines at random.

Be aware: Deleting a machine is an invasive action. You will not be able to recover the machine once you deleted it.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all machines from the group \u2018rg\u2019

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two machines at random from the group \u2018rg\u2019

Signature:

def delete_machines(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"delete_machines\"\n}\n}\n
name: delete-machines\nprovider:\nfunc: delete_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_machines","title":"describe_machines","text":"Type probe Module chaosazure.machine.probes Name describe_machines Return None

Describe Azure virtual machines.

\u2013 filter : str Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_machines(filter: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-machines\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.probes\",\n\"func\": \"describe_machines\"\n}\n}\n
name: describe-machines\nprovider:\nfunc: describe_machines\nmodule: chaosazure.machine.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#fill_disk","title":"fill_disk","text":"Type action Module chaosazure.machine.actions Name fill_disk Return None

Fill the disk with random data.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional Lifetime of the file created. Defaults to 120 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed. Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds. size : int Size of the file created on the disk. Defaults to 1GB. path : str, optional The absolute path to write the fill file into. Defaults: C:/burn for Windows clients, /root/burn for Linux clients.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Fill all machines from the group \u2018rg\u2019

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Fill the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Fill two machines at random from the group \u2018rg\u2019

Signature:

def fill_disk(filter: str = None,\n              duration: int = 120,\n              timeout: int = 60,\n              size: int = 1000,\n              path: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No size integer 1000 No path string null No

Usage:

JSONYAML
{\n\"name\": \"fill-disk\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"fill_disk\"\n}\n}\n
name: fill-disk\nprovider:\nfunc: fill_disk\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#network_latency","title":"network_latency","text":"Type action Module chaosazure.machine.actions Name network_latency Return None

Increases the response time of the virtual machine.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional How long the latency lasts. Defaults to 60 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds. delay : int Added delay in ms. Defaults to 200. jitter : int Variance of the delay in ms. Defaults to 50.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Increase the latency of all machines from the group \u2018rg\u2019

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Increase the latecy of the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Increase the latency of two machines at random from the group \u2018rg\u2019

Signature:

def network_latency(filter: str = None,\n                    duration: int = 60,\n                    delay: int = 200,\n                    jitter: int = 50,\n                    timeout: int = 60,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 60 No delay integer 200 No jitter integer 50 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"network-latency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"network_latency\"\n}\n}\n
name: network-latency\nprovider:\nfunc: network_latency\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_machines","title":"restart_machines","text":"Type action Module chaosazure.machine.actions Name restart_machines Return None

Restart virtual machines at random.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all machines from the group \u2018rg\u2019

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two machines at random from the group \u2018rg\u2019

Signature:

def restart_machines(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"restart_machines\"\n}\n}\n
name: restart-machines\nprovider:\nfunc: restart_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_machines","title":"start_machines","text":"Type action Module chaosazure.machine.actions Name start_machines Return None

Start virtual machines at random. Thought as a rollback action.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all stopped machines from the group \u2018rg\u2019

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the stopped machine from the group \u2018rg\u2019 having the name \u2018name\u2019

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two stopped machines at random from the group \u2018rg\u2019

Signature:

def start_machines(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"start_machines\"\n}\n}\n
name: start-machines\nprovider:\nfunc: start_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_machines","title":"stop_machines","text":"Type action Module chaosazure.machine.actions Name stop_machines Return None

Stop virtual machines at random.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all machines from the group \u2018rg\u2019

stop_machines(\u201cwhere resourceGroup==\u2019mygroup\u2019 and name=\u2019myname\u2019\u201c, c, s) Stop the machine from the group \u2018mygroup\u2019 having the name \u2018myname\u2019

stop_machines(\u201cwhere resourceGroup==\u2019mygroup\u2019 | sample 2\u201d, c, s) Stop two machines at random from the group \u2018mygroup\u2019

Signature:

def stop_machines(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"stop_machines\"\n}\n}\n
name: stop-machines\nprovider:\nfunc: stop_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stress_cpu","title":"stress_cpu","text":"Type action Module chaosazure.machine.actions Name stress_cpu Return None

Stress CPU up to 100% at virtual machines.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional Duration of the stress test (in seconds) that generates high CPU usage. Defaults to 120 seconds. timeout : int Additional wait time (in seconds) for stress operation to be completed. Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Stress all machines from the group \u2018rg\u2019

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Stress the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Stress two machines at random from the group \u2018rg\u2019

Signature:

def stress_cpu(filter: str = None,\n               duration: int = 120,\n               timeout: int = 60,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"stress-cpu\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"stress_cpu\"\n}\n}\n
name: stress-cpu\nprovider:\nfunc: stress_cpu\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#netapp","title":"netapp","text":""},{"location":"drivers/azure/#count_netapp_volumes","title":"count_netapp_volumes","text":"Type probe Module chaosazure.netapp.probes Name count_netapp_volumes Return integer

Return count of Azure netapp volumes.

\u2013 filter : str Filter the netapp volumes. If the filter is omitted all netapp_volumes in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_netapp_volumes(filter: str = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-netapp-volumes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.probes\",\n\"func\": \"count_netapp_volumes\"\n}\n}\n
name: count-netapp-volumes\nprovider:\nfunc: count_netapp_volumes\nmodule: chaosazure.netapp.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_netapp_volumes","title":"delete_netapp_volumes","text":"Type action Module chaosazure.netapp.actions Name delete_netapp_volumes Return None

Delete netapp volumes at random.

Be aware: Deleting a netapp volume is a invasive action. You will not be able to recover the netapp volume once you deleted it.

\u2013 filter : str, optional Filter the netapp volumes. If the filter is omitted all netapp volumes in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all netapp volumes from the group \u2018rg\u2019

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the netapp volumes from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two netapp volumes at random from the group \u2018rg\u2019

Signature:

def delete_netapp_volumes(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-netapp-volumes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.actions\",\n\"func\": \"delete_netapp_volumes\"\n}\n}\n
name: delete-netapp-volumes\nprovider:\nfunc: delete_netapp_volumes\nmodule: chaosazure.netapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_netapp_volumes","title":"describe_netapp_volumes","text":"Type probe Module chaosazure.netapp.probes Name describe_netapp_volumes Return None

Describe Azure netapp volumes.

\u2013 filter : str Filter the netapp volumes. If the filter is omitted all netapp volumes in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_netapp_volumes(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-netapp-volumes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.probes\",\n\"func\": \"describe_netapp_volumes\"\n}\n}\n
name: describe-netapp-volumes\nprovider:\nfunc: describe_netapp_volumes\nmodule: chaosazure.netapp.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#postgresql","title":"postgresql","text":""},{"location":"drivers/azure/#count_servers","title":"count_servers","text":"Type probe Module chaosazure.postgresql.probes Name count_servers Return integer

Return count of Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"count_servers\"\n}\n}\n
name: count-servers\nprovider:\nfunc: count_servers\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#create_databases","title":"create_databases","text":"Type action Module chaosazure.postgresql.actions Name create_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name : str, required The name of the database to create.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 in all servers from the group \u2018rg\u2019

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def create_databases(filter: str = None,\n                     name: str = None,\n                     charset: str = None,\n                     collation: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name string null No charset string null No collation string null No

Usage:

JSONYAML
{\n\"name\": \"create-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"create_databases\"\n}\n}\n
name: create-databases\nprovider:\nfunc: create_databases\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_databases","title":"delete_databases","text":"Type action Module chaosazure.postgresql.actions Name delete_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name_pattern : str, optional Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all database named \u2018chaos-\u2019 in all servers from the group \u2018rg\u2019

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all database named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def delete_databases(filter: str = None,\n                     name_pattern: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"delete_databases\"\n}\n}\n
name: delete-databases\nprovider:\nfunc: delete_databases\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_servers","title":"delete_servers","text":"Type action Module chaosazure.postgresql.actions Name delete_servers Return None

Delete servers at random.

Be aware: Deleting a server is an invasive action. You will not be able to recover the server once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all servers from the group \u2018rg\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the server from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two servers at random from the group \u2018rg\u2019

Signature:

def delete_servers(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"delete_servers\"\n}\n}\n
name: delete-servers\nprovider:\nfunc: delete_servers\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_databases","title":"describe_databases","text":"Type probe Module chaosazure.postgresql.probes Name describe_databases Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_databases(filter: str = None,\n                       name_pattern: str = None,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-databases\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"describe_databases\"\n}\n}\n
name: describe-databases\nprovider:\nfunc: describe_databases\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_servers","title":"describe_servers","text":"Type probe Module chaosazure.postgresql.probes Name describe_servers Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_servers(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"describe_servers\"\n}\n}\n
name: describe-servers\nprovider:\nfunc: describe_servers\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_servers","title":"restart_servers","text":"Type action Module chaosazure.postgresql.actions Name restart_servers Return None

Restart servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all servers from the group \u2018rg\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the server from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two servers at random from the group \u2018rg\u2019

Signature:

def restart_servers(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"restart_servers\"\n}\n}\n
name: restart-servers\nprovider:\nfunc: restart_servers\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#postgresql_flexible","title":"postgresql_flexible","text":""},{"location":"drivers/azure/#count_servers_1","title":"count_servers","text":"Type probe Module chaosazure.postgresql_flexible.probes Name count_servers Return integer

Return count of Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"count_servers\"\n}\n}\n
name: count-servers\nprovider:\nfunc: count_servers\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#create_databases_1","title":"create_databases","text":"Type action Module chaosazure.postgresql_flexible.actions Name create_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name : str, required The name of the database to create.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 in all servers from the group \u2018rg\u2019

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def create_databases(filter: str = None,\n                     name: str = None,\n                     charset: str = None,\n                     collation: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name string null No charset string null No collation string null No

Usage:

JSONYAML
{\n\"name\": \"create-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"create_databases\"\n}\n}\n
name: create-databases\nprovider:\nfunc: create_databases\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_databases_1","title":"delete_databases","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name_pattern : str, optional Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all database named \u2018chaos-\u2019 in all servers from the group \u2018rg\u2019

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all database named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def delete_databases(filter: str = None,\n                     name_pattern: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_databases\"\n}\n}\n
name: delete-databases\nprovider:\nfunc: delete_databases\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_servers_1","title":"delete_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_servers Return None

Delete servers at random.

Be aware: Deleting a server is an invasive action. You will not be able to recover the server once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all servers from the group \u2018rg\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the server from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two servers at random from the group \u2018rg\u2019

Signature:

def delete_servers(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_servers\"\n}\n}\n
name: delete-servers\nprovider:\nfunc: delete_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_tables","title":"delete_tables","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_tables Return None

Delete a table randomly from all databases in servers matching the filter. Could be used to introduce random failures for resilience testing.

\u2013 filter : str, optional Filter the servers. If the filter is omitted, all servers in the subscription will be considered for potential table deletion. table_name : str, optional Specific table name to delete. If this is omitted, a table will be selected randomly for deletion. database_name : str, optional Specific database name to delete the table from. If this is omitted, a database will be selected randomly from the server for table deletion. configuration : Configuration, optional Azure configuration information. secrets : Secrets, optional Azure secret information for authentication. key_vault_url : str, optional The URL to the Azure Key Vault where the secrets are stored.

Here are some examples of calling delete_tables.

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cusers\u201d, \u201cmydatabase\u201d, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes the table \u2018users\u2019 from the database \u2018mydatabase\u2019 in all servers in the resource group \u2018rg\u2019

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, None, None, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes a random table from a random database in the server named \u2018name\u2019 in the resource group \u2018rg\u2019

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, \u201corders\u201d, \u201cmydatabase\u201d, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes the table \u2018orders\u2019 from the database \u2018mydatabase\u2019 in two random servers in the resource group \u2018rg\u2019

Signature:

def delete_tables(filter: str = None,\n                  table_name: str = None,\n                  database_name: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None,\n                  key_vault_url: str = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No table_name string null No database_name string null No key_vault_url string null No

Usage:

JSONYAML
{\n\"name\": \"delete-tables\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_tables\"\n}\n}\n
name: delete-tables\nprovider:\nfunc: delete_tables\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_databases_1","title":"describe_databases","text":"Type probe Module chaosazure.postgresql_flexible.probes Name describe_databases Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_databases(filter: str = None,\n                       name_pattern: str = None,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-databases\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"describe_databases\"\n}\n}\n
name: describe-databases\nprovider:\nfunc: describe_databases\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_servers_1","title":"describe_servers","text":"Type probe Module chaosazure.postgresql_flexible.probes Name describe_servers Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_servers(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"describe_servers\"\n}\n}\n
name: describe-servers\nprovider:\nfunc: describe_servers\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_servers_1","title":"restart_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name restart_servers Return None

Restart servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all servers from the group \u2018rg\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the server from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two servers at random from the group \u2018rg\u2019

Signature:

def restart_servers(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"restart_servers\"\n}\n}\n
name: restart-servers\nprovider:\nfunc: restart_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_servers","title":"start_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name start_servers Return None

Start servers at random. Thought as a rollback action.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all stopped servers from the group \u2018rg\u2019

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the stopped server from the group \u2018rg\u2019 having the name \u2018name\u2019

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two stopped servers at random from the group \u2018rg\u2019

Signature:

def start_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"start_servers\"\n}\n}\n
name: start-servers\nprovider:\nfunc: start_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_servers","title":"stop_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name stop_servers Return None

Stop servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all servers from the group \u2018rg\u2019

stop_servers(\u201cwhere resourceGroup==\u2019mygroup\u2019 and name=\u2019myname\u2019\u201c, c, s) Stop the server from the group \u2018mygroup\u2019 having the name \u2018myname\u2019

stop_servers(\u201cwhere resourceGroup==\u2019mygroup\u2019 | sample 2\u201d, c, s) Stop two servers at random from the group \u2018mygroup\u2019

Signature:

def stop_servers(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"stop_servers\"\n}\n}\n
name: stop-servers\nprovider:\nfunc: stop_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#storage","title":"storage","text":""},{"location":"drivers/azure/#count_blob_containers","title":"count_blob_containers","text":"Type probe Module chaosazure.storage.probes Name count_blob_containers Return integer

Return count of Azure Blob Containers in filtered Storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all blob containers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_blob_containers(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-blob-containers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"count_blob_containers\"\n}\n}\n
name: count-blob-containers\nprovider:\nfunc: count_blob_containers\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#count_storage_accounts","title":"count_storage_accounts","text":"Type probe Module chaosazure.storage.probes Name count_storage_accounts Return integer

Return count of Azure storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all storage_accounts in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_storage_accounts(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-storage-accounts\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"count_storage_accounts\"\n}\n}\n
name: count-storage-accounts\nprovider:\nfunc: count_storage_accounts\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_blob_containers","title":"delete_blob_containers","text":"Type action Module chaosazure.storage.actions Name delete_blob_containers Return None

Delete blob containers at random.

Be aware: Deleting a blob container is a invasive action. You will not be able to recover the blob container once you deleted it.

\u2013 filter : str, optional Filter the storage account. If the filter is omitted all storage accounts in the subscription will have their blob containers selected as potential chaos candidates. name_pattern : str, optional Filter the blob containers. If the filter is omitted all blob containers will be selected for the probe. Pattern example: \u2018container[0-9]{3}\u2019 number : int, optional Pick the number of blob containers matching the two filters that will be deleted. If the number is omitted all blob containers in the list will be deleted.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all blob containers from the group \u2018rg\u2019

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the blob containers from the group \u2018rg\u2019 under the storage account named \u2018name\u2019

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cchaos-\u201d, c, s) Delete the blob containers from the group \u2018rg\u2019 matching the \u201cchaos-\u201d pattern

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cchaos-\u201d, 3, c, s) Delete 3 blob containers at random from the group \u2018rg\u2019 matching the \u201cchaos-\u201d pattern

Signature:

def delete_blob_containers(filter: str = None,\n                           name_pattern: str = None,\n                           number: int = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No number integer null No

Usage:

JSONYAML
{\n\"name\": \"delete-blob-containers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.actions\",\n\"func\": \"delete_blob_containers\"\n}\n}\n
name: delete-blob-containers\nprovider:\nfunc: delete_blob_containers\nmodule: chaosazure.storage.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_storage_accounts","title":"delete_storage_accounts","text":"Type action Module chaosazure.storage.actions Name delete_storage_accounts Return None

Delete storage accounts at random.

Be aware: Deleting a storage account is a invasive action. You will not be able to recover the storage account once you deleted it.

\u2013 filter : str, optional Filter the storage accounts. If the filter is omitted all storage accounts in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all storage accounts from the group \u2018rg\u2019

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the storage accounts from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two storage accounts at random from the group \u2018rg\u2019

Signature:

def delete_storage_accounts(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-storage-accounts\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.actions\",\n\"func\": \"delete_storage_accounts\"\n}\n}\n
name: delete-storage-accounts\nprovider:\nfunc: delete_storage_accounts\nmodule: chaosazure.storage.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_storage_accounts","title":"describe_storage_accounts","text":"Type probe Module chaosazure.storage.probes Name describe_storage_accounts Return None

Describe Azure storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all storage account in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_storage_accounts(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-storage-accounts\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"describe_storage_accounts\"\n}\n}\n
name: describe-storage-accounts\nprovider:\nfunc: describe_storage_accounts\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#vmss","title":"vmss","text":""},{"location":"drivers/azure/#burn_io_1","title":"burn_io","text":"Type action Module chaosazure.vmss.actions Name burn_io Return None

Increases the Disk I/O operations per second of the VMSS machine. Similar to the burn_io action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 60 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"burn-io\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"burn_io\"\n}\n}\n
name: burn-io\nprovider:\nfunc: burn_io\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#count_instances","title":"count_instances","text":"Type probe Module chaosazure.vmss.probes Name count_instances Return integer

Return count of VMSS instances.

\u2013 filter : str Filter the VMSS instance. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_instances(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.probes\",\n\"func\": \"count_instances\"\n}\n}\n
name: count-instances\nprovider:\nfunc: count_instances\nmodule: chaosazure.vmss.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#deallocate_vmss","title":"deallocate_vmss","text":"Type action Module chaosazure.vmss.actions Name deallocate_vmss Return None

Deallocate a virtual machine scale set instance at random.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"deallocate-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"deallocate_vmss\"\n}\n}\n
name: deallocate-vmss\nprovider:\nfunc: deallocate_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_vmss","title":"delete_vmss","text":"Type action Module chaosazure.vmss.actions Name delete_vmss Return None

Delete a virtual machine scale set instance at random.

Be aware: Deleting a VMSS instance is an invasive action. You will not be able to recover the VMSS instance once you deleted it.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"delete-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"delete_vmss\"\n}\n}\n
name: delete-vmss\nprovider:\nfunc: delete_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#fill_disk_1","title":"fill_disk","text":"Type action Module chaosazure.vmss.actions Name fill_disk Return None

Fill the VMSS machine disk with random data. Similar to the fill_disk action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No size integer 1000 No path string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"fill-disk\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"fill_disk\"\n}\n}\n
name: fill-disk\nprovider:\nfunc: fill_disk\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#network_latency_1","title":"network_latency","text":"Type action Module chaosazure.vmss.actions Name network_latency Return None

Increases the response time of the virtual machine. Similar to the network_latency action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 60 No delay integer 200 No jitter integer 50 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"network-latency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"network_latency\"\n}\n}\n
name: network-latency\nprovider:\nfunc: network_latency\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_vmss","title":"restart_vmss","text":"Type action Module chaosazure.vmss.actions Name restart_vmss Return None

Restart a virtual machine scale set instance at random.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"restart-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"restart_vmss\"\n}\n}\n
name: restart-vmss\nprovider:\nfunc: restart_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_vmss","title":"stop_vmss","text":"Type action Module chaosazure.vmss.actions Name stop_vmss Return None

Stops instances from the filtered scale set either at random or by a defined instance criteria.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 instance_criteria : Iterable[Mapping[str, any]] Allows specification of criteria for selection of a given virtual machine scale set instance. If the instance_criteria is omitted, an instance will be chosen at random. All of the criteria within each item of the Iterable must match, i.e. AND logic is applied. The first item with all matching criterion will be used to select the instance. Criteria example: [ {\u201cname\u201d: \u201cmyVMSSInstance1\u201d}, { \u201cname\u201d: \u201cmyVMSSInstance2\u201d, \u201cinstanceId\u201d: \u201c2\u201d } {\u201cinstanceId\u201d: \u201c3\u201d}, ] If the instances include two items. One with name = myVMSSInstance4 and instanceId = 2. The other with name = myVMSSInstance2 and instanceId = 3. The criteria {\u201cinstanceId\u201d: \u201c3\u201d} will be the first match since both the name and the instanceId did not match on the first criteria.

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"stop-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"stop_vmss\"\n}\n}\n
name: stop-vmss\nprovider:\nfunc: stop_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stress_vmss_instance_cpu","title":"stress_vmss_instance_cpu","text":"Type action Module chaosazure.vmss.actions Name stress_vmss_instance_cpu Return None

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"stress-vmss-instance-cpu\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"stress_vmss_instance_cpu\"\n}\n}\n
name: stress-vmss-instance-cpu\nprovider:\nfunc: stress_vmss_instance_cpu\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#webapp","title":"webapp","text":""},{"location":"drivers/azure/#delete_webapp","title":"delete_webapp","text":"Type action Module chaosazure.webapp.actions Name delete_webapp Return None

Delete a web app at random.

***Be aware**: Deleting a web app is an invasive action. You will not be able to recover the web app once you deleted it.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def delete_webapp(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"delete_webapp\"\n}\n}\n
name: delete-webapp\nprovider:\nfunc: delete_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_webapp","title":"restart_webapp","text":"Type action Module chaosazure.webapp.actions Name restart_webapp Return None

Restart a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def restart_webapp(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"restart_webapp\"\n}\n}\n
name: restart-webapp\nprovider:\nfunc: restart_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_webapp","title":"start_webapp","text":"Type action Module chaosazure.webapp.actions Name start_webapp Return None

Start a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def start_webapp(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"start_webapp\"\n}\n}\n
name: start-webapp\nprovider:\nfunc: start_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_webapp","title":"stop_webapp","text":"Type action Module chaosazure.webapp.actions Name stop_webapp Return None

Stop a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def stop_webapp(filter: str = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"stop_webapp\"\n}\n}\n
name: stop-webapp\nprovider:\nfunc: stop_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/","title":"Extension chaoscf","text":"Version 0.7.3 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-cloud-foundry

This extension package provides probes and actions for Chaos Engineering experiments against a Cloud Foundry instance using the Chaos Toolkit.

"},{"location":"drivers/cloudfoundry/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-cloud-foundry\n
"},{"location":"drivers/cloudfoundry/#usage","title":"Usage","text":"

To use the probes and actions from this package, add a similar payload to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"terminate-random-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"terminate_some_random_instance\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-app-statistics\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/cloudfoundry/#discovery","title":"Discovery","text":"

You may use the Chaos Toolkit to discover the capabilities of this extension:

$ chaos discover chaostoolkit-cloud-foundry --no-install\n

If you have logged in against a Cloud Foundry environment, this will discover information about it along the way.

"},{"location":"drivers/cloudfoundry/#configuration","title":"Configuration","text":"

This extension to the Chaos Toolkit need credentials to a Cloud Foundry account with appropriate scopes. Please add the following sections to your experiment file:

{\n\"configuration\": {\n\"cf_api_url\": \"https://api.local.pcfdev.io\",\n\"cf_verify_ssl\": false\n},\n\"secrets\": {\n\"cloudfoundry\": {\n\"cf_username\": \"user\",\n\"cf_password\": \"pass\"\n}\n}\n}\n

You may leave \"cf_verifiy_ssl\" out of the configuration when you want to verify TLS certificates. Usually, local environments are self-signed so it may be useful to disable that check in that case.

You may also specify the \"cf_client_id\" and \"cf_client_secret\" secrets when you need. Their default values are \"cf\" and \"\" respectively. These work well against a local PCF dev install.

Then in your probe or action:

{\n\"type\": \"probe\",\n\"name\": \"fetch-app-statistics\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"cloudfoundry\"],\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n}\n
"},{"location":"drivers/cloudfoundry/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pip install -r requirements-dev.txt\n$ pytest\n
"},{"location":"drivers/cloudfoundry/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit project requires all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/cloudfoundry/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/cloudfoundry/#test_1","title":"Test","text":"

To run the tests for the project execute the following:

$ python setup.py test\n
"},{"location":"drivers/cloudfoundry/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/cloudfoundry/#actions","title":"actions","text":""},{"location":"drivers/cloudfoundry/#delete_app","title":"delete_app","text":"Type action Module chaoscf.actions Name delete_app Return None

Delete application.

See https://apidocs.cloudfoundry.org/280/apps/delete_a_particular_app.html

Signature:

def delete_app(app_name: str,\n               configuration: Dict[str, Dict[str, str]],\n               secrets: Dict[str, Dict[str, str]],\n               org_name: str = None,\n               space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"delete-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"delete_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: delete-app\nprovider:\narguments:\napp_name: ''\nfunc: delete_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#map_route_to_app","title":"map_route_to_app","text":"Type action Module chaoscf.actions Name map_route_to_app Return list

Map a specific route to a given application.

As Domains are deprecated in the Cloud Foundry API, they are not specified here. See https://apidocs.cloudfoundry.org/280/#domains--deprecated- See https://www.cloudfoundry.org/blog/coming-changes-app-manifest-simplification/

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def map_route_to_app(app_name: str,\n                     host_name: str,\n                     configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]],\n                     org_name: str = None,\n                     space_name: str = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes host_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"map-route-to-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"map_route_to_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"host_name\": \"\"\n}\n}\n}\n
name: map-route-to-app\nprovider:\narguments:\napp_name: ''\nhost_name: ''\nfunc: map_route_to_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#remove_routes_from_app","title":"remove_routes_from_app","text":"Type action Module chaoscf.actions Name remove_routes_from_app Return None

Remove routes from a given application.

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def remove_routes_from_app(app_name: str,\n                           route_host: str,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           org_name: str = None,\n                           space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes route_host string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"remove-routes-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"remove_routes_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"route_host\": \"\"\n}\n}\n}\n
name: remove-routes-from-app\nprovider:\narguments:\napp_name: ''\nroute_host: ''\nfunc: remove_routes_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#start_all_apps","title":"start_all_apps","text":"Type action Module chaoscf.actions Name start_all_apps Return None

Start all applications for the specified org name

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def start_all_apps(org_name: str, configuration: Dict[str, Dict[str, str]],\n                   secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"start-all-apps\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"start_all_apps\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: start-all-apps\nprovider:\narguments:\norg_name: ''\nfunc: start_all_apps\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#start_app","title":"start_app","text":"Type action Module chaoscf.actions Name start_app Return None

Start application

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def start_app(app_name: str,\n              configuration: Dict[str, Dict[str, str]],\n              secrets: Dict[str, Dict[str, str]],\n              org_name: str = None,\n              space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"start-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"start_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: start-app\nprovider:\narguments:\napp_name: ''\nfunc: start_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#stop_all_apps","title":"stop_all_apps","text":"Type action Module chaoscf.actions Name stop_all_apps Return None

Stop all application for the specified org name

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def stop_all_apps(org_name: str, configuration: Dict[str, Dict[str, str]],\n                  secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-all-apps\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"stop_all_apps\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: stop-all-apps\nprovider:\narguments:\norg_name: ''\nfunc: stop_all_apps\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#stop_app","title":"stop_app","text":"Type action Module chaoscf.actions Name stop_app Return None

Stop application

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def stop_app(app_name: str,\n             configuration: Dict[str, Dict[str, str]],\n             secrets: Dict[str, Dict[str, str]],\n             org_name: str = None,\n             space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"stop-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"stop_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: stop-app\nprovider:\narguments:\napp_name: ''\nfunc: stop_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#terminate_app_instance","title":"terminate_app_instance","text":"Type action Module chaoscf.actions Name terminate_app_instance Return None

Terminate the application\u2019s instance at the given index.

See https://apidocs.cloudfoundry.org/280/apps/terminate_the_running_app_instance_at_the_given_index.html

Signature:

def terminate_app_instance(app_name: str,\n                           instance_index: int,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           org_name: str = None,\n                           space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes instance_index integer Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-app-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"terminate_app_instance\",\n\"arguments\": {\n\"app_name\": \"\",\n\"instance_index\": 0\n}\n}\n}\n
name: terminate-app-instance\nprovider:\narguments:\napp_name: ''\ninstance_index: 0\nfunc: terminate_app_instance\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#terminate_some_random_instance","title":"terminate_some_random_instance","text":"Type action Module chaoscf.actions Name terminate_some_random_instance Return None

Terminate a random application\u2019s instance.

See https://apidocs.cloudfoundry.org/280/apps/terminate_the_running_app_instance_at_the_given_index.html

Signature:

def terminate_some_random_instance(app_name: str,\n                                   configuration: Dict[str, Dict[str, str]],\n                                   secrets: Dict[str, Dict[str, str]],\n                                   org_name: str = None,\n                                   space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-some-random-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"terminate_some_random_instance\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: terminate-some-random-instance\nprovider:\narguments:\napp_name: ''\nfunc: terminate_some_random_instance\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#unbind_service_from_app","title":"unbind_service_from_app","text":"Type action Module chaoscf.actions Name unbind_service_from_app Return None

Unbind the service from the given application.

See https://apidocs.cloudfoundry.org/280/service_bindings/delete_a_particular_service_binding.html

Signature:

def unbind_service_from_app(app_name: str,\n                            bind_name: str,\n                            configuration: Dict[str, Dict[str, str]],\n                            secrets: Dict[str, Dict[str, str]],\n                            org_name: str = None,\n                            space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes bind_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"unbind-service-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"unbind_service_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"bind_name\": \"\"\n}\n}\n}\n
name: unbind-service-from-app\nprovider:\narguments:\napp_name: ''\nbind_name: ''\nfunc: unbind_service_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#unmap_route_from_app","title":"unmap_route_from_app","text":"Type action Module chaoscf.actions Name unmap_route_from_app Return None

Unmap a specific route from a given application.

As Domains are deprecated in the Cloud Foundry API, they are not specified here. See https://apidocs.cloudfoundry.org/280/#domains--deprecated- See https://www.cloudfoundry.org/blog/coming-changes-app-manifest-simplification/

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def unmap_route_from_app(app_name: str,\n                         host_name: str,\n                         configuration: Dict[str, Dict[str, str]],\n                         secrets: Dict[str, Dict[str, str]],\n                         org_name: str = None,\n                         space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes host_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"unmap-route-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"unmap_route_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"host_name\": \"\"\n}\n}\n}\n
name: unmap-route-from-app\nprovider:\narguments:\napp_name: ''\nhost_name: ''\nfunc: unmap_route_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#api","title":"api","text":""},{"location":"drivers/cloudfoundry/#call_api","title":"call_api","text":"Type Module chaoscf.api Name call_api Return requests.models.Response

Perform a Cloud Foundry API call and return the full response to the caller.

Signature:

def call_api(path: str,\n             configuration: Dict[str, Dict[str, str]],\n             secrets: Dict[str, Dict[str, str]],\n             query: Dict[str, Any] = None,\n             body: Dict[str, Any] = None,\n             method: str = 'GET',\n             headers: Dict[str, str] = None) -> requests.models.Response:\n    pass\n

Arguments:

Name Type Default Required path string Yes query mapping null No body mapping null No method string \u201cGET\u201d No headers mapping null No

Usage:

JSONYAML
{\n\"name\": \"call-api\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"call_api\",\n\"arguments\": {\n\"path\": \"\"\n}\n}\n}\n
name: call-api\nprovider:\narguments:\npath: ''\nfunc: call_api\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_by_name","title":"get_app_by_name","text":"Type Module chaoscf.api Name get_app_by_name Return mapping

Get the application with the given name.

You may restrict the search by organization and/or space by providing the various according parameters. When passing the names, the function performs a lookup for each of them to fetch their GUID.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html

Signature:

def get_app_by_name(app_name: str,\n                    configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]],\n                    space_name: str = None,\n                    space_guid: str = None,\n                    org_name: str = None,\n                    org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_by_name\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-by-name\nprovider:\narguments:\napp_name: ''\nfunc: get_app_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_instances","title":"get_app_instances","text":"Type Module chaoscf.api Name get_app_instances Return mapping

Get all the instances of a started application.

See https://apidocs.cloudfoundry.org/280/apps/get_the_instance_information_for_a_started_app.html

Signature:

def get_app_instances(app_name: str,\n                      configuration: Dict[str, Dict[str, str]],\n                      secrets: Dict[str, Dict[str, str]],\n                      space_name: str = None,\n                      space_guid: str = None,\n                      org_name: str = None,\n                      org_guid: str = None) -> Dict[str, Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-instances\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_instances\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-instances\nprovider:\narguments:\napp_name: ''\nfunc: get_app_instances\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_routes_by_host","title":"get_app_routes_by_host","text":"Type Module chaoscf.api Name get_app_routes_by_host Return list

Get all routes associated with the provided app and the given host.

See https://apidocs.cloudfoundry.org/280/routes/list_all_routes.html

Signature:

def get_app_routes_by_host(app_name: str,\n                           route_host: str,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           space_name: str = None,\n                           space_guid: str = None,\n                           org_name: str = None,\n                           org_guid: str = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes route_host string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-routes-by-host\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_routes_by_host\",\n\"arguments\": {\n\"app_name\": \"\",\n\"route_host\": \"\"\n}\n}\n}\n
name: get-app-routes-by-host\nprovider:\narguments:\napp_name: ''\nroute_host: ''\nfunc: get_app_routes_by_host\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_apps_for_org","title":"get_apps_for_org","text":"Type Module chaoscf.api Name get_apps_for_org Return None

List all applications available in the specified CF org name.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html to understand the content of the response.

Signature:

def get_apps_for_org(org_name: str, configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-apps-for-org\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_apps_for_org\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: get-apps-for-org\nprovider:\narguments:\norg_name: ''\nfunc: get_apps_for_org\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_bind_by_name","title":"get_bind_by_name","text":"Type Module chaoscf.api Name get_bind_by_name Return mapping

Get the service bind with the given name.

You may restrict the search by organization and/or space by providing the various according parameters. When passing the names, the function performs a lookup for each of them to fetch their GUID.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html

Signature:

def get_bind_by_name(bind_name: str,\n                     configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]],\n                     app_name: str = None,\n                     space_name: str = None,\n                     space_guid: str = None,\n                     org_name: str = None,\n                     org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required bind_name string Yes app_name string null No space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-bind-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_bind_by_name\",\n\"arguments\": {\n\"bind_name\": \"\"\n}\n}\n}\n
name: get-bind-by-name\nprovider:\narguments:\nbind_name: ''\nfunc: get_bind_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_org_by_name","title":"get_org_by_name","text":"Type Module chaoscf.api Name get_org_by_name Return mapping

Get the organization with the given name.

Signature:

def get_org_by_name(org_name: str, configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]]) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-org-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_org_by_name\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: get-org-by-name\nprovider:\narguments:\norg_name: ''\nfunc: get_org_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_routes_by_host","title":"get_routes_by_host","text":"Type Module chaoscf.api Name get_routes_by_host Return mapping

Get all routes with given host.

See https://apidocs.cloudfoundry.org/280/routes/list_all_routes.html

Signature:

def get_routes_by_host(route_host: str,\n                       configuration: Dict[str, Dict[str, str]],\n                       secrets: Dict[str, Dict[str, str]],\n                       org_name: str = None,\n                       org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required route_host string Yes org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-routes-by-host\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_routes_by_host\",\n\"arguments\": {\n\"route_host\": \"\"\n}\n}\n}\n
name: get-routes-by-host\nprovider:\narguments:\nroute_host: ''\nfunc: get_routes_by_host\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_space_by_name","title":"get_space_by_name","text":"Type Module chaoscf.api Name get_space_by_name Return mapping

Get the space with the given name.

You may restrict the search by organization by providing the various according parameters. When passing the name, the function performs a lookup for the org to fetch its GUID.

Signature:

def get_space_by_name(space_name: str,\n                      configuration: Dict[str, Dict[str, str]],\n                      secrets: Dict[str, Dict[str, str]],\n                      org_name: str = None,\n                      org_guid=None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required space_name string Yes org_name string null No org_guid null No

Usage:

JSONYAML
{\n\"name\": \"get-space-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_space_by_name\",\n\"arguments\": {\n\"space_name\": \"\"\n}\n}\n}\n
name: get-space-by-name\nprovider:\narguments:\nspace_name: ''\nfunc: get_space_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#probes","title":"probes","text":""},{"location":"drivers/cloudfoundry/#get_app_stats","title":"get_app_stats","text":"Type probe Module chaoscf.probes Name get_app_stats Return mapping

Fetch the metrics of the given application.

See https://apidocs.cloudfoundry.org/280/apps/get_detailed_stats_for_a_started_app.html for more information.

Signature:

def get_app_stats(app_name: str,\n                  configuration: Dict[str, Dict[str, str]],\n                  secrets: Dict[str, Dict[str, str]],\n                  org_name: str = None,\n                  space_name: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-stats\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-stats\nprovider:\narguments:\napp_name: ''\nfunc: get_app_stats\nmodule: chaoscf.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/cloudfoundry/#list_apps","title":"list_apps","text":"Type probe Module chaoscf.probes Name list_apps Return mapping

List all applications available to the authorized user.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html to understand the content of the response.

Signature:

def list_apps(configuration: Dict[str, Dict[str, str]],\n              secrets: Dict[str, Dict[str, str]]) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-apps\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"list_apps\"\n}\n}\n
name: list-apps\nprovider:\nfunc: list_apps\nmodule: chaoscf.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/","title":"Extension chaosdatadog","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-datadog

This project contains Chaos Toolkit activities and tolerances to work with DataDog.

"},{"location":"drivers/datadog/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-datadog\n
"},{"location":"drivers/datadog/#usage","title":"Usage","text":"

A typical experiment using this extension would look like this:

{\n\"version\": \"1.0.0\",\n\"title\": \"Run a, experiment using a DataDog SLO to verify our system\",\n\"description\": \"n/a\",\n\"configuration\": {\n\"datadog_host\": \"https://datadoghq.eu\"\n},\n\"steady-state-hypothesis\": {\n\"title\": \"n/a\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"read-slo\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"check-slo\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.tolerances\",\n\"func\": \"slo_must_be_met\",\n\"arguments\": {\n\"threshold\": \"7d\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo\",\n\"arguments\": {\n\"slo_id\": \"...\"\n}\n}\n}\n]\n},\n\"method\": []\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/datadog/#configuration","title":"Configuration","text":"

In the configuration block you may want to specify the DataDog host you are targetting:

    \"configuration\": {\n\"datadog_host\": \"https://datadoghq.eu\"\n},\n

The authentication can be set using the typical DataDog environment variables, notably:

"},{"location":"drivers/datadog/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/datadog/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/datadog/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/datadog/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/datadog/#metrics","title":"metrics","text":""},{"location":"drivers/datadog/#get_metrics_state","title":"get_metrics_state","text":"Type probe Module chaosdatadog.metrics.probes Name get_metrics_state Return boolean

The next function is to:

you can use a comparison to check if all data points in the query satisfy the steady state condition

Ex. cumsum(sum:istio.mesh.request.count.total{kube_service:test, response_code:500}.as_count())

the above query is a cumulative sum of all requests with response code of 500. if you want your request in a window of time you have a deviant hypothesis if you have more than 30 http_500 errors the comparison should be <. so any value below 30 is a steady state.

the allowed comparison values are [\u201c>\u201d, \u201c<\u201d, \u201c>=\u201d, \u201c<=\u201d, \u201c==\u201d]

Signature:

def get_metrics_state(query: str,\n                      comparison: str,\n                      threshold: float,\n                      minutes_before: int,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required query string Yes comparison string Yes threshold number Yes minutes_before integer Yes

Usage:

JSONYAML
{\n\"name\": \"get-metrics-state\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.metrics.probes\",\n\"func\": \"get_metrics_state\",\n\"arguments\": {\n\"query\": \"\",\n\"comparison\": \"\",\n\"threshold\": null,\n\"minutes_before\": 0\n}\n}\n}\n
name: get-metrics-state\nprovider:\narguments:\ncomparison: ''\nminutes_before: 0\nquery: ''\nthreshold: null\nfunc: get_metrics_state\nmodule: chaosdatadog.metrics.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#slo","title":"slo","text":""},{"location":"drivers/datadog/#get_slo","title":"get_slo","text":"Type probe Module chaosdatadog.slo.probes Name get_slo Return mapping

Get a SLO\u2019s history for the given period.

Periods should be given relative to each other. If end_period isn\u2019t provided it will resolve to now (UTC). start_period is always relative to end_period. You can use a format such as: \"X minutes ago\" for both.

Please visit https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-history for more information on the response payload, which is returned as a dictionary.

Signature:

def get_slo(slo_id: str,\n            start_period: str = '2 minutes ago',\n            end_period: str = None,\n            configuration: Dict[str, Dict[str, str]] = None,\n            secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required slo_id string Yes start_period string \u201c2 minutes ago\u201d No end_period string null No

Usage:

JSONYAML
{\n\"name\": \"get-slo\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo\",\n\"arguments\": {\n\"slo_id\": \"\"\n}\n}\n}\n
name: get-slo\nprovider:\narguments:\nslo_id: ''\nfunc: get_slo\nmodule: chaosdatadog.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#get_slo_details","title":"get_slo_details","text":"Type probe Module chaosdatadog.slo.probes Name get_slo_details Return mapping

Get a SLO\u2019s details.

Please visit https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-details for more information on the response payload, which is returned as a dictionary.

Signature:

def get_slo_details(\n        slo_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required slo_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-slo-details\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo_details\",\n\"arguments\": {\n\"slo_id\": \"\"\n}\n}\n}\n
name: get-slo-details\nprovider:\narguments:\nslo_id: ''\nfunc: get_slo_details\nmodule: chaosdatadog.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#slo_must_be_met","title":"slo_must_be_met","text":"Type tolerance Module chaosdatadog.slo.tolerances Name slo_must_be_met Return boolean

Checks that the current SLI value of a SLO is higher than its target for a given threshold period (\"7d\", \"30d\", \"90d\", \"custom\").

Signature:

def slo_must_be_met(threshold: str = '7d',\n                    value: Dict[str, Any] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required threshold string \u201c7d\u201d No value mapping null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"slo-must-be-met\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.tolerances\",\n\"func\": \"slo_must_be_met\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: slo-must-be-met\nprovider:\nfunc: slo_must_be_met\nmodule: chaosdatadog.slo.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/dynatrace/","title":"Extension chaosdynatrace","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-dynatrace

Dynatrace support for the Chaos Toolkit.

"},{"location":"drivers/dynatrace/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-dynatrace\n
"},{"location":"drivers/dynatrace/#usage","title":"Usage","text":"

To use this package, you must have access to a Dynatrace instance via DynatraceApi and be allowed to connect to it.

the access credentials to the api must be specified in the configuration section

{\n\n\"configuration\": {\n\"dynatrace_base_url\": \"https://{your-environment-id}.live.dynatrace.com\"\n},\n\"secrets\": {\n\"dynatrace\": {\n\"token\": \"...\"\n}\n}\n}\n

Here is an example of how to get the failure rate of a service in Dynatrace. for this example, the api for validate de failure rate is Metric-v1

{\n\"type\": \"probe\",\n\"name\": \"get-failure-rate-services\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.timeseries.v1.probes\",\n\"func\": \"failure_rate\",\n\"secrets\": [\"dynatrace\"],\n\"arguments\": {\n\"entity\": \"SERVICE-665B05BC92550119\",\n\"relative_time\": \"30mins\",\n\"failed_percentage\": 1\n}\n}\n}\n

The probe returns true if the api request failure percentage is less than the failed_percentage value or return false.

The extension also exports a control to send events to Dynatrace. For instance:

{\n\"controls\": [\n{\n\"name\": \"dynatrace\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"dynatrace\"],\n\"module\": \"chaosdynatrace.events.v2.control\"\n}\n}\n]\n}\n

This will send start/stop logs of the experiment events.

You can correlate them to traces using the Open Telemetry extension.

{\n\"configuration\": {\n\"dynatrace_base_url\": \"https://{your-environment-id}.live.dynatrace.com\",\n\"tracing_provider\": \"opentelemetry\",\n\"tracing_opentelemetry_exporter\": \"oltp-http\",\n\"tracing_opentelemetry_collector_endpoint\": \"https://{your-environment-id}.live.dynatrace.com/api/v2/otlp/v1/traces\",\n\"tracing_opentelemetry_collector_headers\": {\n\"Authorization\": \"Api-Token <TOKEN>\"\n}\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n

The logs and traces will be automatically correlated.

"},{"location":"drivers/dynatrace/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/dynatrace/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/dynatrace/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/dynatrace/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/dynatrace/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis True True Method True True Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosdynatrace\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.events.v2.control\"\n}\n}\n]\n}\n
controls:\n- name: chaosdynatrace\nprovider:\nmodule: chaosdynatrace.events.v2.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/dynatrace/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/dynatrace/#v2","title":"v2","text":""},{"location":"drivers/dynatrace/#get_aggregate_logs","title":"get_aggregate_logs","text":"Type probe Module chaosdynatrace.logs.v2.probes Name get_aggregate_logs Return mapping

Query the aggregate logs v2 endpoint matching the criteria.

Returns a list such as:

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs

Signature:

def get_aggregate_logs(\n        from_time: str = 'now',\n        to_time: str = None,\n        query: str = None,\n        time_buckets: int = 1,\n        max_group_values: int = 10,\n        group_by: Union[str, List[str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required from_time string \u201cnow\u201d No to_time string null No query string null No time_buckets integer 1 No max_group_values integer 10 No group_by object null No

Usage:

JSONYAML
{\n\"name\": \"get-aggregate-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.logs.v2.probes\",\n\"func\": \"get_aggregate_logs\"\n}\n}\n
name: get-aggregate-logs\nprovider:\nfunc: get_aggregate_logs\nmodule: chaosdynatrace.logs.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#get_search_logs","title":"get_search_logs","text":"Type probe Module chaosdynatrace.logs.v2.probes Name get_search_logs Return list

Query the search logs v2 endpoint matching the criteria.

Returns a list such as:

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs

Signature:

def get_search_logs(\n        from_time: str = 'now',\n        to_time: str = None,\n        query: str = None,\n        limit: int = 1000,\n        sort: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required from_time string \u201cnow\u201d No to_time string null No query string null No limit integer 1000 No sort string null No

Usage:

JSONYAML
{\n\"name\": \"get-search-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.logs.v2.probes\",\n\"func\": \"get_search_logs\"\n}\n}\n
name: get-search-logs\nprovider:\nfunc: get_search_logs\nmodule: chaosdynatrace.logs.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#query_data_points","title":"query_data_points","text":"Type probe Module chaosdynatrace.metrics.v2.probes Name query_data_points Return list

Query the metrics v2 endpoint for any data point matching the various parameters.

Returns a list such as:

[\n    {\n   'metricId': 'builtin:tech.generic.network.bytesRx:splitBy():avg:auto:sort(value(avg,descending)):limit(10)',\n   'data': [\n  {\n 'dimensions': [],\n 'dimensionMap': {},\n 'timestamps': [\n1647545100000,\n1647545400000,\n1647545700000,\n1647546000000,\n1647546300000,\n1647546600000,\n1647546900000\n ],\n 'values': [\nNone,\n9272.911109076605,\n3565.171102555593,\n3441.491649373372,\n48242.974005126955,\n8055.613537597656,\nNone\n ]\n  }\n   ]\n    }\n]\n

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/get-data-points

Signature:

def query_data_points(\n        metrics_selector: Union[str, List[str]] = '*',\n        entity_selector: Union[str, List[str]] = None,\n        resolution: str = '5m',\n        from_time: str = 'now',\n        to_time: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required metrics_selector object \u201d*\u201d No entity_selector object null No resolution string \u201c5m\u201d No from_time string \u201cnow\u201d No to_time string null No

Usage:

JSONYAML
{\n\"name\": \"query-data-points\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.metrics.v2.probes\",\n\"func\": \"query_data_points\"\n}\n}\n
name: query-data-points\nprovider:\nfunc: query_data_points\nmodule: chaosdynatrace.metrics.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#v1","title":"v1","text":""},{"location":"drivers/dynatrace/#failure_rate","title":"failure_rate","text":"Type probe Module chaosdynatrace.timeseries.v1.probes Name failure_rate Return boolean

Validates the failure rate of a specific service. Returns true if the failure rate is less than the expected failure rate For more information check the api documentation. https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v1/

Signature:

def failure_rate(entity: str,\n                 relative_time: str,\n                 failed_percentage: int,\n                 configuration: Dict[str, Dict[str, str]],\n                 secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required entity string Yes relative_time string Yes failed_percentage integer Yes

Usage:

JSONYAML
{\n\"name\": \"failure-rate\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.timeseries.v1.probes\",\n\"func\": \"failure_rate\",\n\"arguments\": {\n\"entity\": \"\",\n\"relative_time\": \"\",\n\"failed_percentage\": 0\n}\n}\n}\n
name: failure-rate\nprovider:\narguments:\nentity: ''\nfailed_percentage: 0\nrelative_time: ''\nfunc: failure_rate\nmodule: chaosdynatrace.timeseries.v1.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gandi/","title":"Extension chaosgandi","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-gandi

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/gandi/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-gandi\n
"},{"location":"drivers/gandi/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"version\": \"1.0.0\",\n\"title\": \"Our domains are not going expiring within a month\",\n\"description\": \"We need time to renew.\",\n\"secrets\": {\n\"gandi\": {\n\"apikey\": {\n\"type\": \"env\",\n\"key\": \"GANDI_API_KEY\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Check domains are all more than 1 month away from expiring\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"list-my-domains\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"validate-domain-expire-date\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"gandi\"],\n\"module\": \"chaosgandi.domains.tolerances\",\n\"func\": \"domains_should_not_expire_in\",\n\"arguments\": {\n\"when\": \"1 month\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"gandi\"],\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_domains\"\n}\n}\n]\n},\n\"method\": []\n}\n

That\u2019s it!

Set the GANDI_API_KEY environment variable to your Gandi API Key.

Please explore the code to see existing probes and actions.

"},{"location":"drivers/gandi/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/gandi/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/gandi/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/gandi/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/gandi/#domains","title":"domains","text":""},{"location":"drivers/gandi/#domains_should_not_expire_in","title":"domains_should_not_expire_in","text":"Type tolerance Module chaosgandi.domains.tolerances Name domains_should_not_expire_in Return boolean

Go through the list of Gandi domains and fails if any expires before the given date threshold as a relative time to now.

Signature:

def domains_should_not_expire_in(value: List[Dict[str, Any]] = None,\n                                 when: str = '1 month') -> bool:\n    pass\n

Arguments:

Name Type Default Required value list null No when string \u201c1 month\u201d No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"domains-should-not-expire-in\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.tolerances\",\n\"func\": \"domains_should_not_expire_in\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: domains-should-not-expire-in\nprovider:\nfunc: domains_should_not_expire_in\nmodule: chaosgandi.domains.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/gandi/#list_domains","title":"list_domains","text":"Type probe Module chaosgandi.domains.probes Name list_domains Return list

List all domains or those matching the given TLD or FQDN filters and return the list as-is.

See https://api.gandi.net/docs/domains/#v5-domain-domains

Signature:

def list_domains(\n        fqdn_filter: str = None,\n        tld_filter: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required fqdn_filter string null No tld_filter string null No

Usage:

JSONYAML
{\n\"name\": \"list-domains\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_domains\"\n}\n}\n
name: list-domains\nprovider:\nfunc: list_domains\nmodule: chaosgandi.domains.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gandi/#list_nameservers","title":"list_nameservers","text":"Type probe Module chaosgandi.domains.probes Name list_nameservers Return list

List nameservers set for this domain and return them as a list of strings.

See https://api.gandi.net/docs/domains/#v5-domain-domains-domain-nameservers

Signature:

def list_nameservers(domain: str,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None) -> List[str]:\n    pass\n

Arguments:

Name Type Default Required domain string Yes

Usage:

JSONYAML
{\n\"name\": \"list-nameservers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_nameservers\",\n\"arguments\": {\n\"domain\": \"\"\n}\n}\n}\n
name: list-nameservers\nprovider:\narguments:\ndomain: ''\nfunc: list_nameservers\nmodule: chaosgandi.domains.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/","title":"Extension chaosgcp","text":"Version 0.10.1 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Google Cloud Platform.

"},{"location":"drivers/gcp/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install --prefer-binary -U chaostoolkit-google-cloud-platform\n
"},{"location":"drivers/gcp/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"version\": \"1.0.0\",\n\"title\": \"create and delete a cloud run service\",\n\"description\": \"n/a\",\n\"secrets\": {\n\"gcp\": {\n\"service_account_file\": \"service_account.json\"\n}\n},\n\"method\": [\n{\n\"name\": \"create-cloud-run-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"create_service\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/...\",\n\"service_id\": \"demo\",\n\"container\": {\n\"name\": \"demo\",\n\"image\": \"gcr.io/google-samples/hello-app:1.0\"\n}\n}\n}\n},\n{\n\"name\": \"delete-cloud-run-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"delete_service\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../services/demo\"\n}\n}\n}\n]\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/gcp/#configuration","title":"Configuration","text":""},{"location":"drivers/gcp/#project-and-cluster-information","title":"Project and Cluster Information","text":"

You can pass the context via the configuration section of your experiment:

{\n\"configuration\": {\n\"gcp_project_id\": \"...\",\n\"gcp_gke_cluster_name\": \"...\",\n\"gcp_region\": \"...\",\n\"gcp_zone\": \"...\"\n}\n}\n

This is only valuable when you want to reuse the same context everywhere. A finer approach is to set the the parent argument on activities that support it. It should be of the form projects/*/locations/* or projects/*/locations/*/clusters/*, where location is either a region or a zone, depending on the context and defined by the GCP API.

When provided, this takes precedence over the context defined in the configuration. In some cases, it also means you do not need to pass the values in the configuration at all as the extension will derive the context from the parent value.

"},{"location":"drivers/gcp/#credentials","title":"Credentials","text":"

This extension expects a service account with enough permissions to perform its operations. Please create such a service account manually (do not use the default one for your cluster if you can, so you\u2019ll be able to delete that service account if need be).

Once you have created your service account, either keep the file on the same machine where you will be running the experiment from. Or, pass its content as part of the secrets section, although this is not recommended because your sensitive data will be quite visible.

Here is the first way:

{\n\"secrets\": {\n\"gcp\": {\n\"service_account_file\": \"/path/to/sa.json\"\n}\n}\n}\n

You can also use the well-known GOOGLE_APPLICATION_CREDENTIALS environment variables. iI that case, you do not need to set any secrets in the experiment.

While the embedded way looks like this:

{\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"...\"\n},\n\"gcp\": {\n\"service_account_info\": {\n\"type\": \"service_account\",\n\"project_id\": \"...\",\n\"private_key_id\": \"...\",\n\"private_key\": \"...\",\n\"client_email\": \"...\",\n\"client_id\": \"...\",\n\"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n\"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n\"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n\"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/....\"\n}\n}\n}\n}\n

Notice also how we provided here the k8s entry. This is only because, in our example we use the swap_nodepool action which drains the Kubernetes nodes and it requires the Kubernetes cluster credentials to work. These are documented in the Kubernetes extension for Chaos Toolkit. This is the only action that requires such a secret payload, others only speak to the GCP API.

"},{"location":"drivers/gcp/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example which creates a node pool then swap it for a new one.

{\n\"version\": \"1.0.0\",\n\"title\": \"do stuff ye\",\n\"description\": \"n/a\",\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"gke_...\"\n},\n\"gcp\": {\n\"service_account_file\": \"service-account.json\"\n}\n},\n\"method\": [\n{\n\"name\": \"create-our-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"create_new_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/...\",\n\"body\": {\n\"config\": { \"oauth_scopes\": [\n\"gke-version-default\",\n\"https://www.googleapis.com/auth/devstorage.read_only\",\n\"https://www.googleapis.com/auth/logging.write\",\n\"https://www.googleapis.com/auth/monitoring\",\n\"https://www.googleapis.com/auth/service.management.readonly\",\n\"https://www.googleapis.com/auth/servicecontrol\",\n\"https://www.googleapis.com/auth/trace.append\"\n]\n},\n\"initial_node_count\": 1,\n\"name\": \"default-pool\"\n}\n}\n}\n},\n{\n\"name\": \"fetch-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/.../nodePools/default-pool\"\n}\n}\n},\n{\n\"name\": \"swap-our-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"swap_nodepool\",\n\"secrets\": [\"gcp\", \"k8s\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/...\",\n\"delete_old_node_pool\": true,\n\"old_node_pool_id\": \"default-pool\",\n\"new_nodepool_body\": {\n\"config\": { \"oauth_scopes\": [\n\"gke-version-default\",\n\"https://www.googleapis.com/auth/devstorage.read_only\",\n\"https://www.googleapis.com/auth/logging.write\",\n\"https://www.googleapis.com/auth/monitoring\",\n\"https://www.googleapis.com/auth/service.management.readonly\",\n\"https://www.googleapis.com/auth/servicecontrol\",\n\"https://www.googleapis.com/auth/trace.append\"\n]\n},\n\"initial_node_count\": 1,\n\"name\": \"default-pool-1\"\n}\n}\n}\n}\n]\n}\n
"},{"location":"drivers/gcp/#migrate-from-gce-extension","title":"Migrate from GCE extension","text":"

If you previously used the deprecated GCE extension, here is a quick recap of changes you\u2019ll need to go through to update your experiments.

"},{"location":"drivers/gcp/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

If you wish to add a new function to this extension, that is related to a Google Cloud product that is not available yet in this package, please use the product short name or acronym as a first level subpackage (eg. iam, gke, sql, storage, \u2026). See the list of [GCP products and services][gcp_products].

[gcp_products] https://cloud.google.com/products/

"},{"location":"drivers/gcp/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/gcp/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/gcp/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/gcp/#artifact","title":"artifact","text":""},{"location":"drivers/gcp/#get_container_most_recent_image_vulnerabilities_occurences","title":"get_container_most_recent_image_vulnerabilities_occurences","text":"Type probe Module chaosgcp.artifact.probes Name get_container_most_recent_image_vulnerabilities_occurences Return mapping

List all occurrences for a given container image tag.

Signature:

def get_container_most_recent_image_vulnerabilities_occurences(\n        repository: str,\n        package_name: str,\n        kind: str = 'VULNERABILITY',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes kind string \u201cVULNERABILITY\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-container-most-recent-image-vulnerabilities-occurences\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_container_most_recent_image_vulnerabilities_occurences\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-container-most-recent-image-vulnerabilities-occurences\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_container_most_recent_image_vulnerabilities_occurences\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#get_docker_image_version_from_tag","title":"get_docker_image_version_from_tag","text":"Type probe Module chaosgcp.artifact.probes Name get_docker_image_version_from_tag Return mapping

Get image version (sha256) for most recent tag.

Signature:

def get_docker_image_version_from_tag(\n        repository: str,\n        package_name: str,\n        tag: str = 'latest',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes tag string \u201clatest\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-docker-image-version-from-tag\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_docker_image_version_from_tag\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-docker-image-version-from-tag\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_docker_image_version_from_tag\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#get_most_recent_docker_image","title":"get_most_recent_docker_image","text":"Type probe Module chaosgcp.artifact.probes Name get_most_recent_docker_image Return mapping

Get most recent tag for a package in repository.

Signature:

def get_most_recent_docker_image(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-most-recent-docker-image\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_most_recent_docker_image\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-most-recent-docker-image\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_most_recent_docker_image\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#has_most_recent_image_any_severe_or_critical_vulnerabilities","title":"has_most_recent_image_any_severe_or_critical_vulnerabilities","text":"Type probe Module chaosgcp.artifact.probes Name has_most_recent_image_any_severe_or_critical_vulnerabilities Return boolean

Has the most recent tag any severe or critical vulnerabilities.

Signature:

def has_most_recent_image_any_severe_or_critical_vulnerabilities(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"has-most-recent-image-any-severe-or-critical-vulnerabilities\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"has_most_recent_image_any_severe_or_critical_vulnerabilities\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: has-most-recent-image-any-severe-or-critical-vulnerabilities\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: has_most_recent_image_any_severe_or_critical_vulnerabilities\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_docker_image_tags","title":"list_docker_image_tags","text":"Type probe Module chaosgcp.artifact.probes Name list_docker_image_tags Return list

List docker image tags of a package in the given repository.

Signature:

def list_docker_image_tags(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"list-docker-image-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"list_docker_image_tags\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: list-docker-image-tags\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: list_docker_image_tags\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_severe_or_critical_vulnerabilities_in_most_recent_image","title":"list_severe_or_critical_vulnerabilities_in_most_recent_image","text":"Type probe Module chaosgcp.artifact.probes Name list_severe_or_critical_vulnerabilities_in_most_recent_image Return list

List all severe and critical vulnerabilities for the most recent tag.

Signature:

def list_severe_or_critical_vulnerabilities_in_most_recent_image(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"list-severe-or-critical-vulnerabilities-in-most-recent-image\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"list_severe_or_critical_vulnerabilities_in_most_recent_image\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: list-severe-or-critical-vulnerabilities-in-most-recent-image\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: list_severe_or_critical_vulnerabilities_in_most_recent_image\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#cloudbuild","title":"cloudbuild","text":""},{"location":"drivers/gcp/#get_trigger","title":"get_trigger","text":"Type probe Module chaosgcp.cloudbuild.probes Name get_trigger Return None

Returns information about a BuildTrigger.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/get

:param name: name of the trigger :param configuration: :param secrets: :return:

Signature:

def get_trigger(name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-trigger\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"get_trigger\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: get-trigger\nprovider:\narguments:\nname: ''\nfunc: get_trigger\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_trigger_names","title":"list_trigger_names","text":"Type probe Module chaosgcp.cloudbuild.probes Name list_trigger_names Return None

List only the trigger names of a project

:param configuration: :param secrets:

:return:

Signature:

def list_trigger_names(configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-trigger-names\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"list_trigger_names\"\n}\n}\n
name: list-trigger-names\nprovider:\nfunc: list_trigger_names\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_triggers","title":"list_triggers","text":"Type probe Module chaosgcp.cloudbuild.probes Name list_triggers Return None

Lists existing BuildTriggers.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/list

:param configuration: :param secrets:

:return:

Signature:

def list_triggers(configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-triggers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"list_triggers\"\n}\n}\n
name: list-triggers\nprovider:\nfunc: list_triggers\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#run_trigger","title":"run_trigger","text":"Type action Module chaosgcp.cloudbuild.actions Name run_trigger Return None

Runs a BuildTrigger at a particular source revision.

NB: The trigger must exist in the targeted project.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/run

:param name: name of the trigger :param source: location of the source in a Google Cloud Source Repository :param configuration: :param secrets:

:return:

Signature:

def run_trigger(name: str,\n                source: Dict[Any, Any],\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes source mapping Yes

Usage:

JSONYAML
{\n\"name\": \"run-trigger\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.actions\",\n\"func\": \"run_trigger\",\n\"arguments\": {\n\"name\": \"\",\n\"source\": {}\n}\n}\n}\n
name: run-trigger\nprovider:\narguments:\nname: ''\nsource: {}\nfunc: run_trigger\nmodule: chaosgcp.cloudbuild.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#cloudrun","title":"cloudrun","text":""},{"location":"drivers/gcp/#create_service","title":"create_service","text":"Type action Module chaosgcp.cloudrun.actions Name create_service Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the location in the project \u2018projects/PROJECT_ID/locations/LOC :param service_id: unique identifier for the service :param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param description: optional text description of the service :param max_instance_request_concurrency: optional maximum number of requests that each serving instance can receive :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets:

:return:

Signature:

def create_service(parent: str,\n                   service_id: str,\n                   container: Dict[str, Any],\n                   description: str = None,\n                   max_instance_request_concurrency: int = 0,\n                   service_account: str = None,\n                   encryption_key: str = None,\n                   traffic: List[Dict[str, Any]] = None,\n                   labels: Dict[str, str] = None,\n                   annotations: Dict[str, str] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes service_id string Yes container mapping Yes description string null No max_instance_request_concurrency integer 0 No service_account string null No encryption_key string null No traffic list null No labels mapping null No annotations mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"create_service\",\n\"arguments\": {\n\"parent\": \"\",\n\"service_id\": \"\",\n\"container\": {}\n}\n}\n}\n
name: create-service\nprovider:\narguments:\ncontainer: {}\nparent: ''\nservice_id: ''\nfunc: create_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#delete_service","title":"delete_service","text":"Type action Module chaosgcp.cloudrun.actions Name delete_service Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC/services/SVC :param configuration: :param secrets:

:return:

Signature:

def delete_service(parent: str,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"delete_service\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: delete-service\nprovider:\narguments:\nparent: ''\nfunc: delete_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#get_service","title":"get_service","text":"Type probe Module chaosgcp.cloudrun.probes Name get_service Return mapping

Retrieve a single cloud run service

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_get_service

:param name: the path to the service \u2018projects/PROJECT_ID/locations/LOC/services/SVC :param configuration: :param secrets:

:return:

Signature:

def get_service(name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"get_service\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: get-service\nprovider:\narguments:\nname: ''\nfunc: get_service\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_service_revisions","title":"list_service_revisions","text":"Type probe Module chaosgcp.cloudrun.probes Name list_service_revisions Return list

List all Cloud Run service revisions for a specific service.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.revisions.RevisionsClient#google_cloud_run_v2_services_revisions_RevisionsClient_list_revisions

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC/service/SVC :param configuration: :param secrets:

:return:

Signature:

def list_service_revisions(\n        parent: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"list-service-revisions\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"list_service_revisions\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: list-service-revisions\nprovider:\narguments:\nparent: ''\nfunc: list_service_revisions\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_services","title":"list_services","text":"Type probe Module chaosgcp.cloudrun.probes Name list_services Return list

List all Cloud Run services

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_list_services

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC :param configuration: :param secrets:

:return:

Signature:

def list_services(\n        parent: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"list-services\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"list_services\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: list-services\nprovider:\narguments:\nparent: ''\nfunc: list_services\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#update_service","title":"update_service","text":"Type action Module chaosgcp.cloudrun.actions Name update_service Return None

Updates a Cloud Run service.

For example:

{\n\"name\": \"route-traffic-two-latest-and-older-revision\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": chaosgcp.cloudrun.actions\",\n   \"func\": \"update_service\",\n   \"arguments\": {\n  \"parent\": \"projects/${gcp_project_id}/locations/${gcp_location}/services/${service_name}\",\n  \"container\": {\n \"image\": \"eu.gcr.io/${gcp_project_id}/demo\"\n  },\n  \"traffic\": [{\n \"type_\": 1,\n \"percent\": 50\n  }, {\n \"type_\": 2,\n \"revision\": \"whatever-w788x\",\n \"percent\": 50\n  }],\n   }\n    }\n}\n

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets: :param vpc_access_config: optional value for vpc_connect

:return:

Signature:

def update_service(parent: str,\n                   container: Dict[str, Any] = None,\n                   max_instance_request_concurrency: int = 100,\n                   service_account: str = None,\n                   encryption_key: str = None,\n                   traffic: List[Dict[str, Any]] = None,\n                   labels: Dict[str, str] = None,\n                   annotations: Dict[str, str] = None,\n                   vpc_access_config: Dict[str, str] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes container mapping null No max_instance_request_concurrency integer 100 No service_account string null No encryption_key string null No traffic list null No labels mapping null No annotations mapping null No vpc_access_config mapping null No

Usage:

JSONYAML
{\n\"name\": \"update-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"update_service\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: update-service\nprovider:\narguments:\nparent: ''\nfunc: update_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#nodepool","title":"nodepool","text":""},{"location":"drivers/gcp/#create_new_nodepool","title":"create_new_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name create_new_nodepool Return mapping

Create a new node pool in the given cluster/zone of the provided project.

The node pool config must be passed a mapping to the body parameter and respect the REST API.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def create_new_nodepool(\n        body: Dict[str, Any],\n        parent: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required body mapping Yes parent string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"create-new-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"create_new_nodepool\",\n\"arguments\": {\n\"body\": {}\n}\n}\n}\n
name: create-new-nodepool\nprovider:\narguments:\nbody: {}\nfunc: create_new_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#delete_nodepool","title":"delete_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name delete_nodepool Return mapping

Delete node pool from the given cluster/zone of the provided project.

If wait_until_complete is set to True (the default), the function will block until the node pool is deleted. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def delete_nodepool(\n        parent: str = None,\n        node_pool_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parent string null No node_pool_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"delete_nodepool\"\n}\n}\n
name: delete-nodepool\nprovider:\nfunc: delete_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#get_nodepool","title":"get_nodepool","text":"Type probe Module chaosgcp.gke.nodepool.probes Name get_nodepool Return mapping

Get a specific nodepool of a cluster.

The parent is following the form projects/*/locations/*/clusters/*/nodePools/* and will override any settings in the configuration block.

{\n\"name\": \"retrieve-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/my-project-89/locations/us-east1/clusters/cluster-1/nodePools/default-pool\"\n}\n}\n}\n

If not provided this action uses the configuration settings. In that case, make sure to also pass the node_pool_id value.

{\n\"name\": \"retrieve-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"node_pool_id\": \"default-pool\"\n}\n}\n}\n

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/get

Signature:

def get_nodepool(node_pool_id: str = None,\n                 parent: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required node_pool_id string null No parent string null No

Usage:

JSONYAML
{\n\"name\": \"get-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\"\n}\n}\n
name: get-nodepool\nprovider:\nfunc: get_nodepool\nmodule: chaosgcp.gke.nodepool.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_nodepools","title":"list_nodepools","text":"Type probe Module chaosgcp.gke.nodepool.probes Name list_nodepools Return mapping

List nodepools of a cluster.

The parent is following the form projects/*/locations/*/clusters/* and will override any settings in the configuration block. If not provided this action uses the configuration settings.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/list

Signature:

def list_nodepools(\n        parent: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parent string null No

Usage:

JSONYAML
{\n\"name\": \"list-nodepools\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"list_nodepools\"\n}\n}\n
name: list-nodepools\nprovider:\nfunc: list_nodepools\nmodule: chaosgcp.gke.nodepool.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#rollback_nodepool","title":"rollback_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name rollback_nodepool Return mapping

Rollback a previously Aborted or Failed NodePool upgrade.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def rollback_nodepool(\n        node_pool_id: str,\n        parent: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required node_pool_id string Yes parent string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"rollback-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"rollback_nodepool\",\n\"arguments\": {\n\"node_pool_id\": \"\"\n}\n}\n}\n
name: rollback-nodepool\nprovider:\narguments:\nnode_pool_id: ''\nfunc: rollback_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#swap_nodepool","title":"swap_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name swap_nodepool Return mapping

Create a new nodepool, drain the old one so pods can be rescheduled on the new pool. Delete the old nodepool only delete_old_node_pool is set to True, which is not the default. Otherwise, leave the old node pool cordonned so it cannot be scheduled any longer.

Please ensure to provide the Kubernetes secrets as well when calling this action. See https://github.com/chaostoolkit/chaostoolkit-kubernetes#configuration

Signature:

def swap_nodepool(old_node_pool_id: str,\n                  new_nodepool_body: Dict[str, Any],\n                  parent: str = None,\n                  wait_until_complete: bool = True,\n                  delete_old_node_pool: bool = False,\n                  drain_timeout: int = 120,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required old_node_pool_id string Yes new_nodepool_body mapping Yes parent string null No wait_until_complete boolean true No delete_old_node_pool boolean false No drain_timeout integer 120 No

Usage:

JSONYAML
{\n\"name\": \"swap-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"swap_nodepool\",\n\"arguments\": {\n\"old_node_pool_id\": \"\",\n\"new_nodepool_body\": {}\n}\n}\n}\n
name: swap-nodepool\nprovider:\narguments:\nnew_nodepool_body: {}\nold_node_pool_id: ''\nfunc: swap_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#lb","title":"lb","text":""},{"location":"drivers/gcp/#inject_traffic_delay","title":"inject_traffic_delay","text":"Type action Module chaosgcp.lb.actions Name inject_traffic_delay Return mapping

Add/set delay for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

For instance:

{\n\"type: \"action\",\n    \"name\": \"add-delay-to-home-page\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"inject_traffic_delay\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n  \"impacted_percentage\": 75.0,\n  \"delay_in_seconds\": 3,\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def inject_traffic_delay(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        impacted_percentage: float = 50.0,\n        delay_in_seconds: int = 1,\n        delay_in_nanos: int = 0,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes impacted_percentage number 50.0 No delay_in_seconds integer 1 No delay_in_nanos integer 0 No

Usage:

JSONYAML
{\n\"name\": \"inject-traffic-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"inject_traffic_delay\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: inject-traffic-delay\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: inject_traffic_delay\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#inject_traffic_faults","title":"inject_traffic_faults","text":"Type action Module chaosgcp.lb.actions Name inject_traffic_faults Return mapping

Add/set HTTP status codes for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

For instance:

{\n\"type: \"action\",\n    \"name\": \"return-503-from-home-page\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"inject_traffic_faults\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n  \"impacted_percentage\": 75.0,\n  \"configuration\": 503,\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def inject_traffic_faults(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        impacted_percentage: float = 50.0,\n        http_status: int = 400,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes impacted_percentage number 50.0 No http_status integer 400 No

Usage:

JSONYAML
{\n\"name\": \"inject-traffic-faults\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"inject_traffic_faults\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: inject-traffic-faults\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: inject_traffic_faults\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#remove_fault_injection_traffic_policy","title":"remove_fault_injection_traffic_policy","text":"Type action Module chaosgcp.lb.actions Name remove_fault_injection_traffic_policy Return mapping

Remove any fault injection policy from url map on a given path.

For instance:

{\n\"type: \"action\",\n    \"name\": \"remove-fault-injection-policy\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"remove_fault_injection_traffic_policy\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def remove_fault_injection_traffic_policy(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes

Usage:

JSONYAML
{\n\"name\": \"remove-fault-injection-traffic-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"remove_fault_injection_traffic_policy\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: remove-fault-injection-traffic-policy\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: remove_fault_injection_traffic_policy\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#monitoring","title":"monitoring","text":""},{"location":"drivers/gcp/#get_metrics","title":"get_metrics","text":"Type probe Module chaosgcp.monitoring.probes Name get_metrics Return list

Query for Cloud Monitoring metrics and returns a list of time series objects for the metric and period.

Refer to the documentation https://cloud.google.com/python/docs/reference/monitoring/latest/query to learn about the various flags.

Signature:

def get_metrics(\n        metric_type: str,\n        metric_labels_filters: Optional[Dict[str, str]] = None,\n        resource_labels_filters: Optional[Dict[str, str]] = None,\n        end_time: str = 'now',\n        window: str = '5 minutes',\n        aligner: int = 0,\n        aligner_minutes: int = 1,\n        reducer: int = 0,\n        reducer_group_by: Optional[List[str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required metric_type string Yes metric_labels_filters object null No resource_labels_filters object null No end_time string \u201cnow\u201d No window string \u201c5 minutes\u201d No aligner integer 0 No aligner_minutes integer 1 No reducer integer 0 No reducer_group_by object null No

Usage:

JSONYAML
{\n\"name\": \"get-metrics\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.monitoring.probes\",\n\"func\": \"get_metrics\",\n\"arguments\": {\n\"metric_type\": \"\"\n}\n}\n}\n
name: get-metrics\nprovider:\narguments:\nmetric_type: ''\nfunc: get_metrics\nmodule: chaosgcp.monitoring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#sql","title":"sql","text":""},{"location":"drivers/gcp/#describe_instance","title":"describe_instance","text":"Type probe Module chaosgcp.sql.probes Name describe_instance Return mapping

Displays configuration and metadata about a Cloud SQL instance.

Information such as instance name, IP address, region, the CA certificate and configuration settings will be displayed.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/get

:param instance_id: Cloud SQL instance ID.

Signature:

def describe_instance(\n        instance_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.probes\",\n\"func\": \"describe_instance\",\n\"arguments\": {\n\"instance_id\": \"\"\n}\n}\n}\n
name: describe-instance\nprovider:\narguments:\ninstance_id: ''\nfunc: describe_instance\nmodule: chaosgcp.sql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#disable_replication","title":"disable_replication","text":"Type action Module chaosgcp.sql.actions Name disable_replication Return mapping

Disable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#disable_replication

Signature:

def disable_replication(\n        replica_name: str,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required replica_name string Yes project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"disable-replication\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"disable_replication\",\n\"arguments\": {\n\"replica_name\": \"\"\n}\n}\n}\n
name: disable-replication\nprovider:\narguments:\nreplica_name: ''\nfunc: disable_replication\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#enable_replication","title":"enable_replication","text":"Type action Module chaosgcp.sql.actions Name enable_replication Return mapping

Enable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#enable_replication

Signature:

def enable_replication(\n        replica_name: str,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required replica_name string Yes project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"enable-replication\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"enable_replication\",\n\"arguments\": {\n\"replica_name\": \"\"\n}\n}\n}\n
name: enable-replication\nprovider:\narguments:\nreplica_name: ''\nfunc: enable_replication\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#export_data","title":"export_data","text":"Type action Module chaosgcp.sql.actions Name export_data Return mapping

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/export

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def export_data(instance_id: str,\n                storage_uri: str,\n                project_id: str = None,\n                file_type: str = 'sql',\n                databases: List[str] = None,\n                tables: List[str] = None,\n                export_schema_only: bool = False,\n                wait_until_complete: bool = True,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes storage_uri string Yes project_id string null No file_type string \u201csql\u201d No databases list null No tables list null No export_schema_only boolean false No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"export-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"export_data\",\n\"arguments\": {\n\"instance_id\": \"\",\n\"storage_uri\": \"\"\n}\n}\n}\n
name: export-data\nprovider:\narguments:\ninstance_id: ''\nstorage_uri: ''\nfunc: export_data\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#import_data","title":"import_data","text":"Type action Module chaosgcp.sql.actions Name import_data Return mapping

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/import

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def import_data(instance_id: str,\n                storage_uri: str,\n                database: str,\n                project_id: str = None,\n                file_type: str = 'sql',\n                import_user: str = None,\n                table: str = None,\n                columns: List[str] = None,\n                wait_until_complete: bool = True,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes storage_uri string Yes database string Yes project_id string null No file_type string \u201csql\u201d No import_user string null No table string null No columns list null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"import-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"import_data\",\n\"arguments\": {\n\"instance_id\": \"\",\n\"storage_uri\": \"\",\n\"database\": \"\"\n}\n}\n}\n
name: import-data\nprovider:\narguments:\ndatabase: ''\ninstance_id: ''\nstorage_uri: ''\nfunc: import_data\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#list_instances","title":"list_instances","text":"Type probe Module chaosgcp.sql.probes Name list_instances Return mapping

Lists Cloud SQL instances in a given project in the alphabetical order of the instance name.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/list

Signature:

def list_instances(\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.probes\",\n\"func\": \"list_instances\"\n}\n}\n
name: list-instances\nprovider:\nfunc: list_instances\nmodule: chaosgcp.sql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#restore_backup","title":"restore_backup","text":"Type action Module chaosgcp.sql.actions Name restore_backup Return mapping

Performs a restore of a given backup. If target_instance_id is not set then source and target are the same. If backup_run_id is not set, then it picks the most recent backup automatically.

You may wait for the operation to complete, but bear in mind this can take several minutes.

Signature:

def restore_backup(\n        source_instance_id: str,\n        target_instance_id: Optional[str] = None,\n        backup_run_id: Optional[str] = None,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required source_instance_id string Yes target_instance_id object null No backup_run_id object null No project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"restore-backup\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"restore_backup\",\n\"arguments\": {\n\"source_instance_id\": \"\"\n}\n}\n}\n
name: restore-backup\nprovider:\narguments:\nsource_instance_id: ''\nfunc: restore_backup\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#trigger_failover","title":"trigger_failover","text":"Type action Module chaosgcp.sql.actions Name trigger_failover Return mapping

Causes a high-availability Cloud SQL instance to failover.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/failover

:param instance_id: Cloud SQL instance ID. :param wait_until_complete: wait for the operation in progress to complete. :param settings_version: The current settings version of this instance.

:return:

Signature:

def trigger_failover(\n        instance_id: str,\n        wait_until_complete: bool = True,\n        settings_version: Optional[int] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes wait_until_complete boolean true No settings_version object null No

Usage:

JSONYAML
{\n\"name\": \"trigger-failover\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"trigger_failover\",\n\"arguments\": {\n\"instance_id\": \"\"\n}\n}\n}\n
name: trigger-failover\nprovider:\narguments:\ninstance_id: ''\nfunc: trigger_failover\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#storage","title":"storage","text":""},{"location":"drivers/gcp/#object_exists","title":"object_exists","text":"Type probe Module chaosgcp.storage.probes Name object_exists Return boolean

Indicates whether a file in Cloud Storage bucket exists.

:param bucket_name: name of the bucket :param object_name: name of the object within the bucket as path :param configuration: :param secrets:

Signature:

def object_exists(bucket_name: str,\n                  object_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_name string Yes

Usage:

JSONYAML
{\n\"name\": \"object-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.storage.probes\",\n\"func\": \"object_exists\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_name\": \"\"\n}\n}\n}\n
name: object-exists\nprovider:\narguments:\nbucket_name: ''\nobject_name: ''\nfunc: object_exists\nmodule: chaosgcp.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/grafana/","title":"Extension chaosgrafana","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-grafana

This project should be used as a starting point to create your own Chaos Toolkit extension.

"},{"location":"drivers/grafana/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-grafana\n
"},{"location":"drivers/grafana/#usage","title":"Usage","text":""},{"location":"drivers/grafana/#sending-chaos-toolkit-logs-to-loki","title":"Sending Chaos Toolkit logs to Loki","text":"

To send the Chaos Toolkit logs to Loki endpoints, you need to enable the according control as follows:

{\n\"secrets\": {\n\"grafana\": {\n\"auth\": [\"admin\", \"admin\"]\n}\n},\n\"controls\": [\n{\n\"name\": \"loki\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgrafana.controls.loki\",\n\"secrets\": [\"grafana\"],\n\"arguments\": {\n\"loki_endpoint\": \"http://localhost:3100\",\n\"tags\": {\"service\": \"something\"}\n}\n}\n}\n]\n}\n

You can set two other arguments to the control:

These are particularly useful when you cpuple this extension with others like Prometheus where you want to cross-reference between logs and metrics.

"},{"location":"drivers/grafana/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/grafana/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/grafana/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/grafana/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/grafana/#loki","title":"loki","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosgrafana\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgrafana.controls.loki\"\n}\n}\n]\n}\n
controls:\n- name: chaosgrafana\nprovider:\nmodule: chaosgrafana.controls.loki\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/grafana/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/grafana/#controls","title":"controls","text":""},{"location":"drivers/humio/","title":"Extension chaoshumio","text":"Version 0.6.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-humio

This project is an extension for the Chaos Toolkit to target Humio.

"},{"location":"drivers/humio/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-humio\n
"},{"location":"drivers/humio/#humio-token","title":"Humio Token","text":"

To use this extension, you will need one piece of information from Humio, the API token for a user.

"},{"location":"drivers/humio/#usage","title":"Usage","text":"

This extension can be used a control on the experiment or a notification plugin of the Chaos Toolkit CLI itself. Usually, only one of these two methods is used at any given time as they serve similar purpose but feel free to combine them. The control approach is deeper because it logs down to the activity whereas notifications are much higher level.

This extension can also be used as a probe to fetch information from Humio.

"},{"location":"drivers/humio/#query-log-events","title":"Query Log Events","text":"

To use this extension as a probe as part of your experiment, use it as follows:

{\n\"configuration\": {\n\"humio_url\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_URL\",\n\"default\": \"https://cloud.humio.com\"\n},\n\"humio_repository\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_REPOSITORY\",\n\"default\": \"sandbox\"\n}\n},\n\"secrets\": {\n\"humio\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_TOKEN\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Running experiment\",\n\"probes\": [\n{\n\"name\": \"run-humio-search-query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.probes\",\n\"func\": \"search_query\",\n\"secrets\": [\n\"humio\"\n],\n\"arguments\": {\n\"qs\": \"count(as=_count)\",\n\"start\": \"24hours\",\n\"end\": \"now\"\n}\n},\n\"tolerance\": {\n\"name\": \"humio-query-result-value-greater-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_above\",\n\"arguments\": {\n\"field\": \"_count\",\n\"lower\": 1\n}\n}\n}\n}\n]\n}\n}\n

In this example, we are using the search_query probe and validate it with a specific tolerance that can inspect the returned payload from Humio and ensure each value matches the required expectations.

"},{"location":"drivers/humio/#notification","title":"Notification","text":"

To use this extension to push notifications, edit your chaostoolkit settings by adding the following payload:

notifications:\n-\ntype: plugin\nmodule: chaoshumio.notification\nhumio_url: https://myhumio.company.com\ntoken: my-token\n

By default all events will be forwarded to that channel. You may filter only those events you care for:

notifications:\n-\ntype: plugin\nmodule: chaoshumio.notification\nhumio_url: https://myhumio.company.com\ntoken: my-token\nevents:\n- run-failed\n- run-started\n

Only sends those two events.

"},{"location":"drivers/humio/#control","title":"Control","text":"

To use this extension as a control over the experiment and send logs during the execution of the experiment to https://cloud.humio.com, add the following payload to your experiment:

{\n\"secrets\": {\n\"humio\": {\n\"ingest_token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_INGEST_TOKEN\"\n}\n}\n},\n\"controls\": [\n{\n\"name\": \"humio-logger\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n

You do not need to set the secrets property in the provider block. In a control, all secrets are passed directly to each control asking for it.

If you want to send logs to a different Humio URL endpoint, specify the humio_url configuration parameter. The following shows how this parameter:

{\n\"secrets\": {\n\"humio\": {\n\"ingest_token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_INGEST_TOKEN\"\n}\n}\n},\n\"configuration\": {\n\"humio_url\": \"https://myhumio.company.com\"\n},\n\"controls\": [\n{\n\"name\": \"humio-logger\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n

This will ensure the results of the experiment, steady-state, method, rollbacks and each activity are sent to Humio. The experiment itself will also be send initially.

"},{"location":"drivers/humio/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/humio/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install .[dev]\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/humio/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/humio/#lint","title":"Lint","text":"

Ensure your code is properly linted:

$ make format\n$ make lint\n
"},{"location":"drivers/humio/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/humio/#control_1","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis False True Method False True Rollback False True Activities False True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaoshumio\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n
controls:\n- name: chaoshumio\nprovider:\nmodule: chaoshumio.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/humio/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/humio/#control_2","title":"control","text":""},{"location":"drivers/humio/#notification_1","title":"notification","text":""},{"location":"drivers/humio/#notify","title":"notify","text":"Type Module chaoshumio.notification Name notify Return null

Send a log message to the Humio ingest endpoint.

The settings must contain:

If token is missing, no notification is sent. If humio_url is not specified then the default, https://cloud.humio.com, will be used.

Signature:

def notify(settings: Dict[str, Any], event: Dict[str, Any]) -> None:\n    pass\n

Arguments:

Name Type Default Required settings mapping Yes event mapping Yes

Usage:

JSONYAML
{\n\"name\": \"notify\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.notification\",\n\"func\": \"notify\",\n\"arguments\": {\n\"settings\": {},\n\"event\": {}\n}\n}\n}\n
name: notify\nprovider:\narguments:\nevent: {}\nsettings: {}\nfunc: notify\nmodule: chaoshumio.notification\ntype: python\ntype: ''\n
"},{"location":"drivers/humio/#probes","title":"probes","text":""},{"location":"drivers/humio/#search_query","title":"search_query","text":"Type probe Module chaoshumio.probes Name search_query Return Any

Perform a search query against the Humio API and returns its result as-is.

Set result_as_text to true to get the result as a raw string, otherwise the probe returns a JSON payload.

Make sure to set the Humio token as part of the experiment secrets and the repository name as part of its configuration section using the humio_repository key.

See https://docs.humio.com/api/using-the-search-api-with-humio/#query

Signature:

def search_query(qs: str,\n                 start: Union[int, str] = '24hours',\n                 end: Union[int, str] = 'now',\n                 tz_offset: int = 0,\n                 params: Union[str, Dict[str, str], NoneType] = None,\n                 result_as_text: Optional[bool] = False,\n                 configuration: Optional[Dict[str, Dict[str, str]]] = None,\n                 secrets: Optional[Dict[str, Dict[str, str]]] = None) -> Any:\n    pass\n

Arguments:

Name Type Default Required qs string Yes start object \u201c24hours\u201d No end object \u201cnow\u201d No tz_offset integer 0 No params object null No result_as_text object false No

Usage:

JSONYAML
{\n\"name\": \"search-query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.probes\",\n\"func\": \"search_query\",\n\"arguments\": {\n\"qs\": \"\"\n}\n}\n}\n
name: search-query\nprovider:\narguments:\nqs: ''\nfunc: search_query\nmodule: chaoshumio.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/humio/#tolerances","title":"tolerances","text":""},{"location":"drivers/humio/#field_value_above","title":"field_value_above","text":"Type tolerance Module chaoshumio.tolerances Name field_value_above Return boolean

Validate value at the given field to be above the given lower limit.

Signature:

def field_value_above(value: Any = None,\n                      field: Optional[str] = None,\n                      lower: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No lower number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_above\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-above\nprovider:\nfunc: field_value_above\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/humio/#field_value_between","title":"field_value_between","text":"Type tolerance Module chaoshumio.tolerances Name field_value_between Return boolean

Validate value at the given field to be between the lower/upper boundaries.

Signature:

def field_value_between(value: Any = None,\n                        field: Optional[str] = None,\n                        lower: float = 0.0,\n                        upper: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No lower number 0.0 No upper number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-between\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_between\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-between\nprovider:\nfunc: field_value_between\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/humio/#field_value_under","title":"field_value_under","text":"Type tolerance Module chaoshumio.tolerances Name field_value_under Return boolean

Validate value at the given field to be under the given upper limit.

Signature:

def field_value_under(value: Any = None,\n                      field: Optional[str] = None,\n                      upper: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No upper number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_under\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-under\nprovider:\nfunc: field_value_under\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/istio/","title":"Extension chaosistio","text":"Version 0.3.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-istio

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/istio/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-istio\n
"},{"location":"drivers/istio/#usage","title":"Usage","text":"

Below is an example of using this extension to inject a delay of 5 seconds to a specific user.

Note this example can be applied against the bookinfo Istio sample application.

To run it, simple set the KUBERNETES_CONTEXT environment variable to the target cluster and ensure your local kubeconfig is properly populated for that context. Set also the PRODUCT_PAGE_SERVICE_BASE_URL to the address of the Istio gateway.

For instance:

$ export PRODUCT_PAGE_SERVICE_BASE_URL=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==\"http2\")].nodePort}')\n
{\n\"title\": \"Network latency does not impact our users\",\n\"description\": \"Using Istio fault injection capability, let's explore how latency impacts a single user\",\n\"configuration\": {\n\"product_page_url\": {\n\"type\": \"env\",\n\"key\": \"PRODUCT_PAGE_SERVICE_BASE_URL\"\n}\n},\n\"secrets\": {\n\"istio\": {\n\"KUBERNETES_CONTEXT\": {\n\"type\": \"env\",\n\"key\": \"KUBERNETES_CONTEXT\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Our service should respond under 1 second\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"sign-in-as-jason\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"curl\",\n\"arguments\": \"-v -X POST -d 'username=jason&passwd=' -c /tmp/cookie.txt --silent ${product_page_url}/login\"\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-productpage-for-jason-in-due-time\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"curl\",\n\"arguments\": \"-v --connect-timeout 1 --max-time 1 -b /tmp/cookie.txt --silent ${product_page_url}/productpage\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"inject-fault-for-jason-only\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_delay_fault\",\n\"secrets\": [\"istio\"],\n\"arguments\": {\n\"virtual_service_name\": \"reviews\",\n\"fixed_delay\": \"5s\",\n\"percentage\": {\n\"value\":  100.0\n},\n\"routes\": [\n{\n\"destination\": {\n\"host\": \"reviews\",\n\"subset\": \"v2\"\n}\n}\n]\n}\n},\n\"pauses\": {\n\"after\": 2\n}\n}\n],\n\"rollbacks\": [\n{\n\"type\": \"action\",\n\"name\": \"remove-fault-for-jason-only\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_delay_fault\",\n\"secrets\": [\"istio\"],\n\"arguments\": {\n\"virtual_service_name\": \"reviews\",\n\"routes\": [\n{\n\"destination\": {\n\"host\": \"reviews\",\n\"subset\": \"v2\"\n}\n}\n]\n}\n}\n}\n]\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/istio/#configuration","title":"Configuration","text":"

This extension needs you specify how to connect to the Kubernetes cluster. This can be done by setting the KUBERNETES_CONTEXT in the secrets payload.

"},{"location":"drivers/istio/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/istio/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/istio/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/istio/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/istio/#fault","title":"fault","text":""},{"location":"drivers/istio/#add_abort_fault","title":"add_abort_fault","text":"Type action Module chaosistio.fault.actions Name add_abort_fault Return mapping

Abort requests early by the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Abort

Signature:

def add_abort_fault(\n        virtual_service_name: str,\n        http_status: int,\n        routes: List[Dict[str, str]],\n        percentage: float = None,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes http_status integer Yes routes list Yes percentage number null No ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"add-abort-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_abort_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"http_status\": 0,\n\"routes\": []\n}\n}\n}\n
name: add-abort-fault\nprovider:\narguments:\nhttp_status: 0\nroutes: []\nvirtual_service_name: ''\nfunc: add_abort_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#add_delay_fault","title":"add_delay_fault","text":"Type action Module chaosistio.fault.actions Name add_delay_fault Return mapping

Add delay to the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Delay

Signature:

def add_delay_fault(\n        virtual_service_name: str,\n        fixed_delay: str,\n        routes: List[Dict[str, str]],\n        percentage: float = None,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes fixed_delay string Yes routes list Yes percentage number null No ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"add-delay-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_delay_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"fixed_delay\": \"\",\n\"routes\": []\n}\n}\n}\n
name: add-delay-fault\nprovider:\narguments:\nfixed_delay: ''\nroutes: []\nvirtual_service_name: ''\nfunc: add_delay_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#get_virtual_service","title":"get_virtual_service","text":"Type probe Module chaosistio.fault.probes Name get_virtual_service Return mapping

Get a virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#VirtualService

Signature:

def get_virtual_service(\n        virtual_service_name: str,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-virtual-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.probes\",\n\"func\": \"get_virtual_service\",\n\"arguments\": {\n\"virtual_service_name\": \"\"\n}\n}\n}\n
name: get-virtual-service\nprovider:\narguments:\nvirtual_service_name: ''\nfunc: get_virtual_service\nmodule: chaosistio.fault.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/istio/#remove_abort_fault","title":"remove_abort_fault","text":"Type action Module chaosistio.fault.actions Name remove_abort_fault Return mapping

Remove abort request faults from the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Abort

Signature:

def remove_abort_fault(\n        virtual_service_name: str,\n        routes: List[Dict[str, str]],\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-abort-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_abort_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: remove-abort-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: remove_abort_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#remove_delay_fault","title":"remove_delay_fault","text":"Type action Module chaosistio.fault.actions Name remove_delay_fault Return mapping

Remove delay from the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Delay

Signature:

def remove_delay_fault(\n        virtual_service_name: str,\n        routes: List[Dict[str, str]],\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-delay-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_delay_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: remove-delay-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: remove_delay_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#set_fault","title":"set_fault","text":"Type action Module chaosistio.fault.actions Name set_fault Return mapping

Setfault injection on the virtual service identified by name

The fault argument must be the object passed as the spec property of a virtual service resource.

If a fault already exists, it is updated with the new specification.

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection

Signature:

def set_fault(virtual_service_name: str,\n              routes: List[Dict[str, str]],\n              fault: Dict[str, Any],\n              ns: str = 'default',\n              version: str = 'networking.istio.io/v1alpha3',\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes fault mapping Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"set-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"set_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": [],\n\"fault\": {}\n}\n}\n}\n
name: set-fault\nprovider:\narguments:\nfault: {}\nroutes: []\nvirtual_service_name: ''\nfunc: set_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#unset_fault","title":"unset_fault","text":"Type action Module chaosistio.fault.actions Name unset_fault Return mapping

Unset fault injection from the virtual service identified by name

The fault argument must be the object passed as the spec property of a virtual service resource.

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection

Signature:

def unset_fault(virtual_service_name: str,\n                routes: List[Dict[str, str]],\n                ns: str = 'default',\n                version: str = 'networking.istio.io/v1alpha3',\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"unset-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"unset_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: unset-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: unset_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/","title":"Extension chaosk6","text":"Version 0.2.0 Repository https://github.com/k6io/chaostoolkit-k6

N/A

"},{"location":"drivers/k6/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/k6/#actions","title":"actions","text":""},{"location":"drivers/k6/#run_script","title":"run_script","text":"Type action Module chaosk6.actions Name run_script Return None

Run an arbitrary k6 script with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 \u00b1 50.

\u2013 scriptPath : str Full path to the k6 test script vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def run_script(scriptPath: str = None, vus: int = 1, duration: str = '1s'):\n    pass\n

Arguments:

Name Type Default Required scriptPath string null No vus integer 1 No duration string \u201c1s\u201d No

Usage:

{\n\"name\": \"run-script\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.actions\",\n\"func\": \"run_script\"\n}\n}\n
name: run-script\nprovider:\nfunc: run_script\nmodule: chaosk6.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/#stress_endpoint","title":"stress_endpoint","text":"Type action Module chaosk6.actions Name stress_endpoint Return None

Stress a single endpoint with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 \u00b1 50.

\u2013 endpoint : str The URL to the endpoint you want to stress, including the scheme prefix. vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def stress_endpoint(endpoint: str = None, vus: int = 1, duration: str = '1s'):\n    pass\n

Arguments:

Name Type Default Required endpoint string null No vus integer 1 No duration string \u201c1s\u201d No

Usage:

{\n\"name\": \"stress-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.actions\",\n\"func\": \"stress_endpoint\"\n}\n}\n
name: stress-endpoint\nprovider:\nfunc: stress_endpoint\nmodule: chaosk6.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/#probes","title":"probes","text":""},{"location":"drivers/k6/#http","title":"http","text":"Type probe Module chaosk6.probes Name http Return boolean

Probe an endpoint to make sure it responds to an http request with the expected HTTP status code. Depending on the endpoint and your payload, this action might be destructive. Use with caution.

\u2013 endpoint : str The URL to the endpoint to probe method : str A valid http request method name, like GET, POST, PUT, DELETE, OPTIONS, or PATCH status : int The expected HTTP Response status code. vus : int The amount of concurrent virtual users accessing the endpoint duration : str How long to probe the endpoint. Expressed as a duration string, i.e \u201c20s\u201d, \u201c1m\u201d, \u201c1h\u201d etc. timeout : int Timeout duration for http requests. Defaults to 1 second

Signature:

def http(endpoint: str,\n         method: str = 'GET',\n         status: int = 200,\n         body: str = '',\n         headers: dict = {},\n         vus: int = 1,\n         duration: str = '',\n         debug: bool = False,\n         timeout: int = 1) -> bool:\n    pass\n

Arguments:

Name Type Default Required endpoint string Yes method string \u201cGET\u201d No status integer 200 No body string \u201d\u201c No headers mapping {} No vus integer 1 No duration string \u201d\u201c No debug boolean false No timeout integer 1 No

Usage:

{\n\"name\": \"http\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.probes\",\n\"func\": \"http\",\n\"arguments\": {\n\"endpoint\": \"\"\n}\n}\n}\n
name: http\nprovider:\narguments:\nendpoint: ''\nfunc: http\nmodule: chaosk6.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/","title":"Extension chaosk8s","text":"Version 0.28.0 Repository https://github.com/chaostoolkit/chaostoolkit-kubernetes

This project contains activities, such as probes and actions, you can call from your experiment through the Chaos Toolkit to perform Chaos Engineering against the Kubernetes API: killing a pod, removing a statefulset or node\u2026

"},{"location":"drivers/kubernetes/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kubernetes\n
"},{"location":"drivers/kubernetes/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"title\": \"Do we remain available in face of pod going down?\",\n\"description\": \"We expect Kubernetes to handle the situation gracefully when a pod goes down\",\n\"tags\": [\"kubernetes\"],\n\"steady-state-hypothesis\": {\n\"title\": \"Verifying service remains healthy\",\n\"probes\": [\n{\n\"name\": \"all-our-microservices-should-be-healthy\",\n\"type\": \"probe\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"myapp\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"terminate-db-pod\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"label_selector\": \"app=my-app\",\n\"name_pattern\": \"my-app-[0-9]$\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n}\n]\n}\n

That\u2019s it! Notice how the action gives you the way to kill one pod randomly.

Please explore the documentation to see existing probes and actions.

"},{"location":"drivers/kubernetes/#configuration","title":"Configuration","text":""},{"location":"drivers/kubernetes/#use-kubeconfig","title":"Use ~/.kube/config","text":"

If you have a valid entry in your ~/.kube/config file for the cluster you want to target, then there is nothing to be done.

You may specify KUBECONFIG to specify a different location.

$ export KUBECONFIG=/tmp/my-config\n
"},{"location":"drivers/kubernetes/#specify-the-kubernetes-context","title":"Specify the Kubernetes context","text":"

Quite often, your Kubernetes configuration contains several entries and you need to define the one to use as a default context when not it isn\u2019t explicitely provided.

You may of course change your default using kubectl config use-context KUBERNETES_CONTEXT but you can also be explicit in your experiment as follows:

{\n\"title\": \"Do we remain available in face of pod going down?\",\n\"description\": \"We expect Kubernetes to handle the situation gracefully when a pod goes down\",\n\"tags\": [\"kubernetes\"],\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"...\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Verifying service remains healthy\",\n\"probes\": [\n{\n\"name\": \"all-our-microservices-should-be-healthy\",\n\"type\": \"probe\",\n\"tolerance\": true,\n\"secrets\": [\"k8s\"],\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"myapp\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"terminate-db-pod\",\n\"secrets\": [\"k8s\"],\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"label_selector\": \"app=my-app\",\n\"name_pattern\": \"my-app-[0-9]$\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n}\n]\n}\n

You need to specify the KUBERNETES_CONTEXT secret key to the name of the context you want the experiment to use. Make sure to also inform the actions and probes about the secret entries they should be passed \"secrets\": [\"k8s\"].

"},{"location":"drivers/kubernetes/#use-a-pods-service-account","title":"Use a Pod\u2019s service account","text":"

When running from a pod (not your local machine or a CI for instance), the ./.kube/config file does not exist. Instead, the credentials can be found at /var/run/secrets/kubernetes.io/serviceaccount/token.

To let the extension know about this, simply set CHAOSTOOLKIT_IN_POD from the environment variable of the pod specification:

env:\n- name: CHAOSTOOLKIT_IN_POD\nvalue: \"true\"\n
"},{"location":"drivers/kubernetes/#pass-all-credentials-in-the-experiment","title":"Pass all credentials in the experiment","text":"

Finally, you may pass explicitely all required credentials information to the experiment as follows:

"},{"location":"drivers/kubernetes/#using-an-api-key","title":"Using an API key","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_API_KEY\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#using-a-usernamepassword","title":"Using a username/password","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_USERNAME\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n},\n\"KUBERNETES_PASSWORD\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#using-a-tls-keycertificate","title":"Using a TLS key/certificate","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_CERT_FILE\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n},\n\"KUBERNETES_KEY_FILE\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#managed-kubernetes-clusters-authentication","title":"Managed Kubernetes Clusters Authentication","text":"

On some managed Kubernetes clusters, you also need to authenticate against the platform itself because the Kubernetes authentication is delegated to it.

"},{"location":"drivers/kubernetes/#google-cloud-platform","title":"Google Cloud Platform","text":"

In addition to your Kubernetes credentials (via the ~/.kube/config file), you need to authenticate against the Google Cloud Platform itself. Usually this is done via:

$ gcloud auth login\n

But can also be achieved by defining the GOOGLE_APPLICATION_CREDENTIALS environment variable.

"},{"location":"drivers/kubernetes/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/kubernetes/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/kubernetes/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/kubernetes/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/kubernetes/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/kubernetes/#actions","title":"actions","text":""},{"location":"drivers/kubernetes/#kill_microservice","title":"kill_microservice","text":"Type action Module chaosk8s.actions Name kill_microservice Return None

!!!DEPRECATED!!!

Signature:

def kill_microservice(name: str,\n                      ns: str = 'default',\n                      label_selector: str = 'name in ({name})',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"kill-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"kill_microservice\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: kill-microservice\nprovider:\narguments:\nname: ''\nfunc: kill_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_service_endpoint","title":"remove_service_endpoint","text":"Type action Module chaosk8s.actions Name remove_service_endpoint Return None

!!!DEPRECATED!!!

Signature:

def remove_service_endpoint(name: str,\n                            ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-service-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"remove_service_endpoint\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: remove-service-endpoint\nprovider:\narguments:\nname: ''\nfunc: remove_service_endpoint\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_microservice","title":"scale_microservice","text":"Type action Module chaosk8s.actions Name scale_microservice Return None

!!!DEPRECATED!!!

Signature:

def scale_microservice(name: str,\n                       replicas: int,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"scale_microservice\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-microservice\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#start_microservice","title":"start_microservice","text":"Type action Module chaosk8s.actions Name start_microservice Return None

!!!DEPRECATED!!!

Signature:

def start_microservice(spec_path: str,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"start-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"start_microservice\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: start-microservice\nprovider:\narguments:\nspec_path: ''\nfunc: start_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#crd","title":"crd","text":""},{"location":"drivers/kubernetes/#create_cluster_custom_object","title":"create_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name create_cluster_custom_object Return mapping

Delete a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"create-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"create_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: create-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: create_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_custom_object","title":"create_custom_object","text":"Type action Module chaosk8s.crd.actions Name create_custom_object Return mapping

Create a custom object in the given namespace. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        ns: str = 'default',\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes ns string \u201cdefault\u201d No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"create-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"create_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: create-custom-object\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: create_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_cluster_custom_object","title":"delete_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name delete_cluster_custom_object Return mapping

Delete a custom object cluster wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"delete_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: delete-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: delete_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_custom_object","title":"delete_custom_object","text":"Type action Module chaosk8s.crd.actions Name delete_custom_object Return mapping

Create a custom object cluster wide. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"delete-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"delete_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: delete-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: delete_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#get_cluster_custom_object","title":"get_cluster_custom_object","text":"Type probe Module chaosk8s.crd.probes Name get_cluster_custom_object Return mapping

Get a custom object cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cluster-custom-object\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"get_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: get-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: get_cluster_custom_object\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#get_custom_object","title":"get_custom_object","text":"Type probe Module chaosk8s.crd.probes Name get_custom_object Return mapping

Get a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-custom-object\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"get_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: get-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: get_custom_object\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#list_cluster_custom_objects","title":"list_cluster_custom_objects","text":"Type probe Module chaosk8s.crd.probes Name list_cluster_custom_objects Return list

List custom objects cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_cluster_custom_objects(\n        group: str,\n        version: str,\n        plural: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes

Usage:

JSONYAML
{\n\"name\": \"list-cluster-custom-objects\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"list_cluster_custom_objects\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: list-cluster-custom-objects\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: list_cluster_custom_objects\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#list_custom_objects","title":"list_custom_objects","text":"Type probe Module chaosk8s.crd.probes Name list_custom_objects Return list

List custom objects in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_custom_objects(\n        group: str,\n        version: str,\n        plural: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"list-custom-objects\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"list_custom_objects\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: list-custom-objects\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: list_custom_objects\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#patch_cluster_custom_object","title":"patch_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name patch_cluster_custom_object Return mapping

Patch a custom object cluster-wide. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"patch-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"patch_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: patch-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: patch_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#patch_custom_object","title":"patch_custom_object","text":"Type action Module chaosk8s.crd.actions Name patch_custom_object Return mapping

Patch a custom object in the given namespace. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"patch-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"patch_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: patch-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: patch_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#replace_cluster_custom_object","title":"replace_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name replace_cluster_custom_object Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"replace-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"replace_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: replace-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: replace_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#replace_custom_object","title":"replace_custom_object","text":"Type action Module chaosk8s.crd.actions Name replace_custom_object Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"replace-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"replace_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: replace-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: replace_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deployment","title":"deployment","text":""},{"location":"drivers/kubernetes/#create_deployment","title":"create_deployment","text":"Type action Module chaosk8s.deployment.actions Name create_deployment Return None

Create a deployment described by the deployment config, which must be the path to the JSON or YAML representation of the deployment.

Signature:

def create_deployment(spec_path: str,\n                      ns: str = 'default',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"create_deployment\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-deployment\nprovider:\narguments:\nspec_path: ''\nfunc: create_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_deployment","title":"delete_deployment","text":"Type action Module chaosk8s.deployment.actions Name delete_deployment Return None

Delete a deployment by name or label_selector in the namespace ns.

The deployment is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the deployments will be deleted in the namespace.

Signature:

def delete_deployment(name: str = None,\n                      ns: str = 'default',\n                      label_selector: str = None,\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"delete-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"delete_deployment\"\n}\n}\n
name: delete-deployment\nprovider:\nfunc: delete_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deployment_available_and_healthy","title":"deployment_available_and_healthy","text":"Type probe Module chaosk8s.deployment.probes Name deployment_available_and_healthy Return Optional[bool]

Lookup a deployment by name in the namespace ns.

The selected resources are matched by the given label_selector.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_unavailable is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_available_and_healthy(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        raise_on_unavailable: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No raise_on_unavailable boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-available-and-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_available_and_healthy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-available-and-healthy\nprovider:\narguments:\nname: ''\nfunc: deployment_available_and_healthy\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_fully_available","title":"deployment_fully_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_fully_available Return Optional[bool]

Wait until all the deployment expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_fully_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        timeout: int = 30,\n        raise_on_not_fully_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_not_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_fully_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_not_fully_available","title":"deployment_not_fully_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_not_fully_available Return Optional[bool]

Wait until the deployment gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_not_fully_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        timeout: int = 30,\n        raise_on_fully_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_not_fully_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_partially_available","title":"deployment_partially_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_partially_available Return Optional[bool]

Check whether if the given deployment state is ready or at-least partially ready. Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_not_partially_available is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_partially_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        raise_on_not_partially_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No raise_on_not_partially_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-partially-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_partially_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-partially-available\nprovider:\narguments:\nname: ''\nfunc: deployment_partially_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#rollout_deployment","title":"rollout_deployment","text":"Type action Module chaosk8s.deployment.actions Name rollout_deployment Return None

Rolling the deployment. The name is the name of the deployment.

Signature:

def rollout_deployment(name: str = None,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"rollout-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"rollout_deployment\"\n}\n}\n
name: rollout-deployment\nprovider:\nfunc: rollout_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_deployment","title":"scale_deployment","text":"Type action Module chaosk8s.deployment.actions Name scale_deployment Return None

Scale a deployment up or down. The name is the name of the deployment.

Signature:

def scale_deployment(name: str,\n                     replicas: int,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"scale_deployment\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-deployment\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#networking","title":"networking","text":""},{"location":"drivers/kubernetes/#allow_dns_access","title":"allow_dns_access","text":"Type action Module chaosk8s.networking.actions Name allow_dns_access Return None

Convenient helper rule to DNS access from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def allow_dns_access(label_selectors: Dict[str, Any] = None,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"allow-dns-access\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"allow_dns_access\"\n}\n}\n
name: allow-dns-access\nprovider:\nfunc: allow_dns_access\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_network_policy","title":"create_network_policy","text":"Type action Module chaosk8s.networking.actions Name create_network_policy Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def create_network_policy(spec: Dict[str, Any] = None,\n                          spec_path: str = None,\n                          ns: str = 'default',\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec mapping null No spec_path string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-network-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"create_network_policy\"\n}\n}\n
name: create-network-policy\nprovider:\nfunc: create_network_policy\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deny_all_egress","title":"deny_all_egress","text":"Type action Module chaosk8s.networking.actions Name deny_all_egress Return None

Convenient helper rule to deny all egress network from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_egress(label_selectors: Dict[str, Any] = None,\n                    ns: str = 'default',\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"deny-all-egress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"deny_all_egress\"\n}\n}\n
name: deny-all-egress\nprovider:\nfunc: deny_all_egress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deny_all_ingress","title":"deny_all_ingress","text":"Type action Module chaosk8s.networking.actions Name deny_all_ingress Return None

Convenient helper policy to deny ingress network to all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_ingress(label_selectors: Dict[str, Any] = None,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"deny-all-ingress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"deny_all_ingress\"\n}\n}\n
name: deny-all-ingress\nprovider:\nfunc: deny_all_ingress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_allow_dns_access","title":"remove_allow_dns_access","text":"Type action Module chaosk8s.networking.actions Name remove_allow_dns_access Return None

Remove the rule set by the allow_dns_access action.

Signature:

def remove_allow_dns_access(ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-allow-dns-access\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_allow_dns_access\"\n}\n}\n
name: remove-allow-dns-access\nprovider:\nfunc: remove_allow_dns_access\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_deny_all_egress","title":"remove_deny_all_egress","text":"Type action Module chaosk8s.networking.actions Name remove_deny_all_egress Return None

Remove the rule set by the deny_all_egress action.

Signature:

def remove_deny_all_egress(ns: str = 'default',\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-deny-all-egress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_deny_all_egress\"\n}\n}\n
name: remove-deny-all-egress\nprovider:\nfunc: remove_deny_all_egress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_deny_all_ingress","title":"remove_deny_all_ingress","text":"Type action Module chaosk8s.networking.actions Name remove_deny_all_ingress Return None

Remove the rule set by the deny_all_ingress action.

Signature:

def remove_deny_all_ingress(ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-deny-all-ingress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_deny_all_ingress\"\n}\n}\n
name: remove-deny-all-ingress\nprovider:\nfunc: remove_deny_all_ingress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_network_policy","title":"remove_network_policy","text":"Type action Module chaosk8s.networking.actions Name remove_network_policy Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def remove_network_policy(name: str,\n                          ns: str = 'default',\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-network-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_network_policy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: remove-network-policy\nprovider:\narguments:\nname: ''\nfunc: remove_network_policy\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#node","title":"node","text":""},{"location":"drivers/kubernetes/#cordon_node","title":"cordon_node","text":"Type action Module chaosk8s.node.actions Name cordon_node Return None

Cordon nodes matching the given label or name, so that no pods are scheduled on them any longer.

Signature:

def cordon_node(name: str = None,\n                label_selector: str = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"cordon-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"cordon_node\"\n}\n}\n
name: cordon-node\nprovider:\nfunc: cordon_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_node","title":"create_node","text":"Type action Module chaosk8s.node.actions Name create_node Return kubernetes.client.models.v1_node.V1Node

Create one new node in the cluster.

Due to the way things work on certain cloud providers, you won\u2019t be able to use this meaningfully on them. For instance on GCE, this will likely fail.

See also: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency

Signature:

def create_node(\n    meta: Dict[str, Any] = None,\n    spec: Dict[str, Any] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> kubernetes.client.models.v1_node.V1Node:\n    pass\n

Arguments:

Name Type Default Required meta mapping null No spec mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"create_node\"\n}\n}\n
name: create-node\nprovider:\nfunc: create_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_nodes","title":"delete_nodes","text":"Type action Module chaosk8s.node.actions Name delete_nodes Return None

Delete nodes gracefully. Select the appropriate nodes by label.

Nodes are not drained beforehand so we can see how cluster behaves. Nodes cannot be restarted, they are really deleted. Please be careful when using this action.

On certain cloud providers, you also need to delete the underneath VM instance as well afterwards. This is the case on GCE for instance.

If all is set to True, all nodes will be terminated. If rand is set to True, one random node will be terminated. If \u0300count is set to a positive number, only a upto count nodes (randomly picked) will be terminated. Otherwise, the first retrieved node will be terminated.

Signature:

def delete_nodes(label_selector: str = None,\n                 all: bool = False,\n                 rand: bool = False,\n                 count: int = None,\n                 grace_period_seconds: int = None,\n                 secrets: Dict[str, Dict[str, str]] = None,\n                 pod_label_selector: str = None,\n                 pod_namespace: str = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No all boolean false No rand boolean false No count integer null No grace_period_seconds integer null No pod_label_selector string null No pod_namespace string null No

Usage:

JSONYAML
{\n\"name\": \"delete-nodes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"delete_nodes\"\n}\n}\n
name: delete-nodes\nprovider:\nfunc: delete_nodes\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#drain_nodes","title":"drain_nodes","text":"Type action Module chaosk8s.node.actions Name drain_nodes Return boolean

Drain nodes matching the given label or name, so that no pods are scheduled on them any longer and running pods are evicted.

It does a similar job to kubectl drain --ignore-daemonsets or kubectl drain --delete-local-data --ignore-daemonsets if delete_pods_with_local_storage is set to True. There is no equivalent to the kubectl drain --force flag.

You probably want to call uncordon from in your experiment\u2019s rollbacks.

Signature:

def drain_nodes(name: str = None,\n                label_selector: str = None,\n                delete_pods_with_local_storage: bool = False,\n                timeout: int = 120,\n                secrets: Dict[str, Dict[str, str]] = None,\n                count: int = None,\n                pod_label_selector: str = None,\n                pod_namespace: str = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No delete_pods_with_local_storage boolean false No timeout integer 120 No count integer null No pod_label_selector string null No pod_namespace string null No

Usage:

JSONYAML
{\n\"name\": \"drain-nodes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"drain_nodes\"\n}\n}\n
name: drain-nodes\nprovider:\nfunc: drain_nodes\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#get_nodes","title":"get_nodes","text":"Type probe Module chaosk8s.node.probes Name get_nodes Return None

List all Kubernetes worker nodes in your cluster. You may filter nodes by specifying a label selector.

Signature:

def get_nodes(label_selector: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"get-nodes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.probes\",\n\"func\": \"get_nodes\"\n}\n}\n
name: get-nodes\nprovider:\nfunc: get_nodes\nmodule: chaosk8s.node.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#uncordon_node","title":"uncordon_node","text":"Type action Module chaosk8s.node.actions Name uncordon_node Return None

Uncordon nodes matching the given label name, so that pods can be scheduled on them again.

Signature:

def uncordon_node(name: str = None,\n                  label_selector: str = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"uncordon-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"uncordon_node\"\n}\n}\n
name: uncordon-node\nprovider:\nfunc: uncordon_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#pod","title":"pod","text":""},{"location":"drivers/kubernetes/#count_min_pods","title":"count_min_pods","text":"Type probe Module chaosk8s.pod.probes Name count_min_pods Return boolean

Check if minimum number of pods are running.

Signature:

def count_min_pods(label_selector: str,\n                   phase: str = 'Running',\n                   min_count: int = 2,\n                   ns: str = 'default',\n                   secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No min_count integer 2 No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"count-min-pods\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"count_min_pods\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: count-min-pods\nprovider:\narguments:\nlabel_selector: ''\nfunc: count_min_pods\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#count_pods","title":"count_pods","text":"Type probe Module chaosk8s.pod.probes Name count_pods Return integer

Count the number of pods matching the given selector in a given phase, if one is given.

Signature:

def count_pods(label_selector: str,\n               phase: str = None,\n               ns: str = 'default',\n               secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"count-pods\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"count_pods\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: count-pods\nprovider:\narguments:\nlabel_selector: ''\nfunc: count_pods\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#exec_in_pods","title":"exec_in_pods","text":"Type action Module chaosk8s.pod.actions Name exec_in_pods Return list

Execute the command cmd in the specified pod\u2019s container. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected for termination.

If all is set to True, all matching pods will be affected.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods affected. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be affected. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be affected Otherwise, the first retrieved n pods will be used

The cmd should be a string or a sequence of program arguments. Providing a sequence of arguments is generally preferred, as it allows the action to take care of any required escaping and quoting (e.g. to permit spaces in the arguments). If passing a single string it will be split automatically.

Signature:

def exec_in_pods(\n        cmd: Union[str, List[str]],\n        label_selector: str = None,\n        name_pattern: str = None,\n        all: bool = False,\n        rand: bool = False,\n        mode: str = 'fixed',\n        qty: int = 1,\n        ns: str = 'default',\n        order: str = 'alphabetic',\n        container_name: str = None,\n        request_timeout: int = 60,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cmd object Yes label_selector string null No name_pattern string null No all boolean false No rand boolean false No mode string \u201cfixed\u201d No qty integer 1 No ns string \u201cdefault\u201d No order string \u201calphabetic\u201d No container_name string null No request_timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"exec-in-pods\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"exec_in_pods\",\n\"arguments\": {\n\"cmd\": null\n}\n}\n}\n
name: exec-in-pods\nprovider:\narguments:\ncmd: null\nfunc: exec_in_pods\nmodule: chaosk8s.pod.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#pod_is_not_available","title":"pod_is_not_available","text":"Type probe Module chaosk8s.pod.probes Name pod_is_not_available Return boolean

Lookup pods with a name label set to the given name in the specified ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when one of the pods with the specified name is in the \"Running\" phase.

Signature:

def pod_is_not_available(name: str,\n                         ns: str = 'default',\n                         label_selector: str = 'name in ({name})',\n                         raise_on_is_available: bool = True,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No raise_on_is_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"pod-is-not-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pod_is_not_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: pod-is-not-available\nprovider:\narguments:\nname: ''\nfunc: pod_is_not_available\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_in_conditions","title":"pods_in_conditions","text":"Type probe Module chaosk8s.pod.probes Name pods_in_conditions Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed if one of the given conditions type/status is not as expected unless raise_on_invalid_conditions. In that case, returns False.

Signature:

def pods_in_conditions(label_selector: str,\n                       conditions: List[Dict[str, str]],\n                       ns: str = 'default',\n                       raise_on_invalid_conditions: bool = True,\n                       secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes conditions list Yes ns string \u201cdefault\u201d No raise_on_invalid_conditions boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-in-conditions\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_in_conditions\",\n\"arguments\": {\n\"label_selector\": \"\",\n\"conditions\": []\n}\n}\n}\n
name: pods-in-conditions\nprovider:\narguments:\nconditions: []\nlabel_selector: ''\nfunc: pods_in_conditions\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_in_phase","title":"pods_in_phase","text":"Type probe Module chaosk8s.pod.probes Name pods_in_phase Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected unless raise_on_invalid_phase. In that case, returns False.

Signature:

def pods_in_phase(label_selector: str,\n                  phase: str = 'Running',\n                  ns: str = 'default',\n                  raise_on_invalid_phase: bool = True,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No ns string \u201cdefault\u201d No raise_on_invalid_phase boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-in-phase\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_in_phase\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: pods-in-phase\nprovider:\narguments:\nlabel_selector: ''\nfunc: pods_in_phase\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_not_in_phase","title":"pods_not_in_phase","text":"Type probe Module chaosk8s.pod.probes Name pods_not_in_phase Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the pod is in the given phase and should not have, unless raise_on_in_phase. In that case, returns False.

Signature:

def pods_not_in_phase(label_selector: str,\n                      phase: str = 'Running',\n                      ns: str = 'default',\n                      raise_on_in_phase: bool = True,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No ns string \u201cdefault\u201d No raise_on_in_phase boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-not-in-phase\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_not_in_phase\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: pods-not-in-phase\nprovider:\narguments:\nlabel_selector: ''\nfunc: pods_not_in_phase\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#read_pod_logs","title":"read_pod_logs","text":"Type probe Module chaosk8s.pod.probes Name read_pod_logs Return mapping

Fetch logs for all the pods with the label \"name\" set to name and return a dictionary with the keys being the pod\u2019s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod\u2019s incarnation, if any.

Signature:

def read_pod_logs(name: str = None,\n                  last: Optional[str] = None,\n                  ns: str = 'default',\n                  from_previous: bool = False,\n                  label_selector: str = 'name in ({name})',\n                  container_name: str = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:\n    pass\n

Arguments:

Name Type Default Required name string null No last object null No ns string \u201cdefault\u201d No from_previous boolean false No label_selector string \u201cname in ({name})\u201d No container_name string null No

Usage:

JSONYAML
{\n\"name\": \"read-pod-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"read_pod_logs\"\n}\n}\n
name: read-pod-logs\nprovider:\nfunc: read_pod_logs\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#terminate_pods","title":"terminate_pods","text":"Type action Module chaosk8s.pod.actions Name terminate_pods Return None

Terminate a pod gracefully. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected for termination.

If all is set to True, all matching pods will be terminated.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods to be terminated. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be terminated. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be terminated Otherwise, the first retrieved n pods will be terminated.

If grace_period is greater than or equal to 0, it will be used as the grace period (in seconds) to terminate the pods. Otherwise, the default pod\u2019s grace period will be used.

Signature:

def terminate_pods(label_selector: str = None,\n                   name_pattern: str = None,\n                   all: bool = False,\n                   rand: bool = False,\n                   mode: str = 'fixed',\n                   qty: int = 1,\n                   grace_period: int = -1,\n                   ns: str = 'default',\n                   order: str = 'alphabetic',\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No name_pattern string null No all boolean false No rand boolean false No mode string \u201cfixed\u201d No qty integer 1 No grace_period integer -1 No ns string \u201cdefault\u201d No order string \u201calphabetic\u201d No

Usage:

JSONYAML
{\n\"name\": \"terminate-pods\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\"\n}\n}\n
name: terminate-pods\nprovider:\nfunc: terminate_pods\nmodule: chaosk8s.pod.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#probes","title":"probes","text":""},{"location":"drivers/kubernetes/#all_microservices_healthy","title":"all_microservices_healthy","text":"Type probe Module chaosk8s.probes Name all_microservices_healthy Return Tuple[Dict[str, Any], Dict[str, Any]]

!!!DEPRECATED!!!

Signature:

def all_microservices_healthy(\n    ns: str = 'default',\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Tuple[Dict[str, Any], Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"all-microservices-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"all_microservices_healthy\"\n}\n}\n
name: all-microservices-healthy\nprovider:\nfunc: all_microservices_healthy\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_is_fully_available","title":"deployment_is_fully_available","text":"Type probe Module chaosk8s.probes Name deployment_is_fully_available Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_fully_available(name: str,\n                                  ns: str = 'default',\n                                  label_selector: str = None,\n                                  timeout: int = 30,\n                                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No

Usage:

JSONYAML
{\n\"name\": \"deployment-is-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"deployment_is_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-is-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_is_fully_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_is_not_fully_available","title":"deployment_is_not_fully_available","text":"Type probe Module chaosk8s.probes Name deployment_is_not_fully_available Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_not_fully_available(name: str,\n                                      ns: str = 'default',\n                                      label_selector: str = None,\n                                      timeout: int = 30,\n                                      secrets: Dict[str, Dict[str,\n                                                              str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No

Usage:

JSONYAML
{\n\"name\": \"deployment-is-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"deployment_is_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-is-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_is_not_fully_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#microservice_available_and_healthy","title":"microservice_available_and_healthy","text":"Type probe Module chaosk8s.probes Name microservice_available_and_healthy Return Optional[bool]

!!!DEPRECATED!!!

Signature:

def microservice_available_and_healthy(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"microservice-available-and-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: microservice-available-and-healthy\nprovider:\narguments:\nname: ''\nfunc: microservice_available_and_healthy\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#microservice_is_not_available","title":"microservice_is_not_available","text":"Type probe Module chaosk8s.probes Name microservice_is_not_available Return boolean

!!!DEPRECATED!!!

Signature:

def microservice_is_not_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = 'name in ({name})',\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"microservice-is-not-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_is_not_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: microservice-is-not-available\nprovider:\narguments:\nname: ''\nfunc: microservice_is_not_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#read_microservices_logs","title":"read_microservices_logs","text":"Type probe Module chaosk8s.probes Name read_microservices_logs Return mapping

Fetch logs for all the pods with the label \"name\" set to name and return a dictionary with the keys being the pod\u2019s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod\u2019s incarnation, if any.

Signature:

def read_microservices_logs(\n        name: str = None,\n        last: Optional[str] = None,\n        ns: str = 'default',\n        from_previous: bool = False,\n        label_selector: str = 'name in ({name})',\n        container_name: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:\n    pass\n

Arguments:

Name Type Default Required name string null No last object null No ns string \u201cdefault\u201d No from_previous boolean false No label_selector string \u201cname in ({name})\u201d No container_name string null No

Usage:

JSONYAML
{\n\"name\": \"read-microservices-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"read_microservices_logs\"\n}\n}\n
name: read-microservices-logs\nprovider:\nfunc: read_microservices_logs\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#service_endpoint_is_initialized","title":"service_endpoint_is_initialized","text":"Type probe Module chaosk8s.probes Name service_endpoint_is_initialized Return None

!!!DEPRECATED!!!

Signature:

def service_endpoint_is_initialized(name: str,\n                                    ns: str = 'default',\n                                    label_selector: str = 'name in ({name})',\n                                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"service-endpoint-is-initialized\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"service_endpoint_is_initialized\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: service-endpoint-is-initialized\nprovider:\narguments:\nname: ''\nfunc: service_endpoint_is_initialized\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#replicaset","title":"replicaset","text":""},{"location":"drivers/kubernetes/#delete_replica_set","title":"delete_replica_set","text":"Type action Module chaosk8s.replicaset.actions Name delete_replica_set Return None

Delete a replica set by name or label_selector in the namespace ns.

The replica set is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the replica sets will be deleted in the namespace.

Signature:

def delete_replica_set(name: str = None,\n                       ns: str = 'default',\n                       label_selector: str = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"delete-replica-set\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.replicaset.actions\",\n\"func\": \"delete_replica_set\"\n}\n}\n
name: delete-replica-set\nprovider:\nfunc: delete_replica_set\nmodule: chaosk8s.replicaset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#service","title":"service","text":""},{"location":"drivers/kubernetes/#create_service_endpoint","title":"create_service_endpoint","text":"Type action Module chaosk8s.service.actions Name create_service_endpoint Return None

Create a service endpoint described by the service config, which must be the path to the JSON or YAML representation of the service.

Signature:

def create_service_endpoint(spec_path: str,\n                            ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-service-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.actions\",\n\"func\": \"create_service_endpoint\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-service-endpoint\nprovider:\narguments:\nspec_path: ''\nfunc: create_service_endpoint\nmodule: chaosk8s.service.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_service","title":"delete_service","text":"Type action Module chaosk8s.service.actions Name delete_service Return None

Remove the given service

Signature:

def delete_service(name: str,\n                   ns: str = 'default',\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.actions\",\n\"func\": \"delete_service\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: delete-service\nprovider:\narguments:\nname: ''\nfunc: delete_service\nmodule: chaosk8s.service.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#service_is_initialized","title":"service_is_initialized","text":"Type probe Module chaosk8s.service.probes Name service_is_initialized Return boolean

Lookup a service endpoint by its name and raises :exc:FailedProbe when the service was not found or not initialized.

If raise_if_service_not_initialized is set to False return False when probe isn\u2019t as expected. Otherwise raises chaoslib.exceptions.ActivityFailed

Signature:

def service_is_initialized(name: str = None,\n                           ns: str = 'default',\n                           label_selector: str = None,\n                           raise_if_service_not_initialized: bool = True,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No raise_if_service_not_initialized boolean true No

Usage:

JSONYAML
{\n\"name\": \"service-is-initialized\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.probes\",\n\"func\": \"service_is_initialized\"\n}\n}\n
name: service-is-initialized\nprovider:\nfunc: service_is_initialized\nmodule: chaosk8s.service.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#statefulset","title":"statefulset","text":""},{"location":"drivers/kubernetes/#create_statefulset","title":"create_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name create_statefulset Return None

Create a statefulset described by the service config, which must be the path to the JSON or YAML representation of the statefulset.

Signature:

def create_statefulset(spec_path: str,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"create_statefulset\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-statefulset\nprovider:\narguments:\nspec_path: ''\nfunc: create_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_statefulset","title":"remove_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name remove_statefulset Return None

Remove a statefulset by name or label_selector in the namespace ns.

The statefulset is removed by deleting it without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the statefulsets will be deleted in the namespace.

Signature:

def remove_statefulset(name: str = None,\n                       ns: str = 'default',\n                       label_selector: str = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"remove-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"remove_statefulset\"\n}\n}\n
name: remove-statefulset\nprovider:\nfunc: remove_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_statefulset","title":"scale_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name scale_statefulset Return None

Scale a stateful set up or down. The name is the name of the stateful set.

Signature:

def scale_statefulset(name: str,\n                      replicas: int,\n                      ns: str = 'default',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"scale_statefulset\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-statefulset\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#statefulset_fully_available","title":"statefulset_fully_available","text":"Type probe Module chaosk8s.statefulset.probes Name statefulset_fully_available Return None

Wait until all the statefulSet expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_fully_available(name: str,\n                                ns: str = 'default',\n                                label_selector: str = None,\n                                timeout: int = 30,\n                                raise_on_not_fully_available: bool = True,\n                                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_not_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"statefulset-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.probes\",\n\"func\": \"statefulset_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: statefulset-fully-available\nprovider:\narguments:\nname: ''\nfunc: statefulset_fully_available\nmodule: chaosk8s.statefulset.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#statefulset_not_fully_available","title":"statefulset_not_fully_available","text":"Type probe Module chaosk8s.statefulset.probes Name statefulset_not_fully_available Return None

Wait until the statefulSet gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_not_fully_available(name: str,\n                                    ns: str = 'default',\n                                    label_selector: str = None,\n                                    timeout: int = 30,\n                                    raise_on_fully_available: bool = True,\n                                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"statefulset-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.probes\",\n\"func\": \"statefulset_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: statefulset-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: statefulset_not_fully_available\nmodule: chaosk8s.statefulset.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/opentracing/","title":"Extension chaostracing","text":"Version 0.13.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing

This project is an extension for the Chaos Toolkit for OpenTracing and OpenTelemetry.

Here is an example of what it could look like with the Jaeger backend.

"},{"location":"drivers/opentracing/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-opentracing\n
"},{"location":"drivers/opentracing/#usage","title":"Usage","text":"

This extension provides two controls to trace your Chaos Toolkit experiment:

The only supported one is Open Telemetry as the Open Tracing is no longer maintained.

"},{"location":"drivers/opentracing/#open-telemetry","title":"Open Telemetry","text":"

To enable Open Telemetry tracing, simply add the following control to your experiment:

{\n\"controls\": [\n{\n\"name\": \"opentelemetry\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\"\n}\n}\n]\n}\n

We suggest you make it the first extension so it runs before and after all other extensions.

To configure the various Open Telemetry settings, please use the standard OLTP environment variables:

Mostly, you should set:

NOTE: This extension supports OLTP over HTTP but not gRPC.

You can also instrument a variety of frameworks like this:

{\n\"controls\": [\n{\n\"name\": \"opentelemetry\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\",\n\"arguments\": {\n\"trace_httpx\": true,\n\"trace_requests\": true,\n\"trace_botocore\": true\n}\n}\n}\n]\n}\n

This will enable the according instrumentation automatically.

"},{"location":"drivers/opentracing/#aws","title":"AWS","text":"

This extension supports AWS X-Ray directly. Simply set the following variable:

export OTEL_VENDOR=aws\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"aws\"\n}\n}\n
"},{"location":"drivers/opentracing/#google-cloud-platform-traces","title":"Google Cloud Platform Traces","text":"

If you intend on using Google Cloud Platform to export your traces to, please consider also installing the followings:

$ pip install opentelemetry-exporter-gcp-trace \\\n    opentelemetry-resourcedetector-gcp \\\n    opentelemetry-propagator-gcp\n

To authenticate the client, you can either:

In all cases, point to a service account which has the roles/cloudtrace.agent role as nthe name of the target project.

Finally, set the following variable:

export OTEL_VENDOR=gcp\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"gcp\"\n}\n}\n
"},{"location":"drivers/opentracing/#azure-traces","title":"Azure Traces","text":"

To use this package to send traces to Azure monitors, please install the dependencies as follows:

$ pip install chaostoolkit-opentracing[azure]\n

Then set the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable appropriately.

Finally, set the following variable:

export OTEL_VENDOR=azure\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"azure\"\n}\n}\n

See Azure documentation for more details:

"},{"location":"drivers/opentracing/#other-open-telemetry-vendors","title":"Other Open Telemetry vendors","text":"

Other vendors should work out of the box with the default settings. Otherwise, feel free to open an issue.

"},{"location":"drivers/opentracing/#legacy-open-tracing","title":"Legacy Open Tracing","text":"

This extensions supports the Open Tracing export format but highly recommends you to switch to Open Telemetry instead. There will be no support for Open Tracing support.

NOTE: Please see at the bottom of the page all the supported clients and exporters this control supports.

"},{"location":"drivers/opentracing/#declare-within-the-experiment","title":"Declare within the experiment","text":"

To use this control, you can declare it on a per experiment basis like this:

{\n\"configuration\": {\n\"tracing_provider\": \"jaeger\",\n\"tracing_host\": \"127.0.0.1\",\n\"tracing_port\": 6831,\n\"tracing_propagation\": \"b3\"\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n

This will automatically create a Jaeger client to emit traces onto the address 127.0.0.1:6831 (over UDP).

"},{"location":"drivers/opentracing/#declare-within-the-settings","title":"Declare within the settings","text":"

You may also declare the control to be applied to all experiments by declaring the control from within the Chaos Toolkit settings file. In that case, you do not need to set the configuration or the controls at the experiment level and the control will be applied to every experiments you run.

controls:\nopentracing:\nprovider:\ntype: python\nmodule: chaostracing.control\narguments:\nprovider: jaeger\nhost: 127.0.0.1\nport: 6831\npropagation: b3\n
"},{"location":"drivers/opentracing/#send-traces-from-other-extensions","title":"Send traces from other extensions","text":"

You may also access the tracer from other extensions as follows.

For instance, assuming you have an extension that makes a HTTP call you want to trace specifically, you could do this from your extension\u2019s code:

from chaoslib import Configuration, Secrets\nimport requests\nimport opentracing\n\ndef some_function(configuration: Configuration, secrets: Secrets):\n    tracer = opentracing.global_tracer()\n    scope = tracer.scope_manager.active\n    parent = scope.span\n\n    with tracer.start_span(\"call-service1\", child_of=parent) as span:\n        span.set_tag('http.method','GET')\n        span.set_tag('http.url', url)\n        span.set_tag('span.kind', 'client')\n        span.tracer.inject(span, 'http_headers', headers)\n\n        r = requests.get(url, headers=headers)\n        span.set_tag('http.status_code', r.status_code)\n

Because the opentracing exposes a noop tracer when non has been initialized, it should be safe to have that code in your extensions without having to determine if the extension has been enabled in the experiment.

Please note that, Open Tracing scope cannot be shared across threads (while spans can). So, when running this in a background activity, the tracer will not actually be set to the one that was initialized.

"},{"location":"drivers/opentracing/#open-tracing-provider-support","title":"Open Tracing Provider Support","text":""},{"location":"drivers/opentracing/#jaeger-tracer","title":"Jaeger tracer","text":"

The Jager tracer relies on the OpenTracing protocol which has now be superseded by OpenTelemetry. However, we still provide support for it.

To install the necessary dependencies for the Jaeger tracer, please run:

$ pip install -U jaeger-client~=4.8\n

Use the following configuration:

{\n\"configuration\": {\n\"tracing_provider\": \"jaeger\",\n\"tracing_host\": \"127.0.0.1\",\n\"tracing_port\": 6831,\n\"tracing_propagation\": \"b3\"\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n
"},{"location":"drivers/opentracing/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/opentracing/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/opentracing/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/opentracing/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis True True Method True True Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#oltp","title":"oltp","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.oltp\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/opentracing/#control_1","title":"control","text":""},{"location":"drivers/opentracing/#metrics_1","title":"metrics","text":""},{"location":"drivers/opentracing/#oltp_1","title":"oltp","text":""},{"location":"drivers/overview/","title":"Drivers Overview","text":"

Chaos Toolkit drivers extend the toolkit to be able to cause chaos and probe different types of systems.

"},{"location":"drivers/pixie/","title":"Extension chaospixie","text":"Version 0.1.1 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-pixie

This extension allows you to run Pixie script during your experiments.

"},{"location":"drivers/pixie/#install","title":"Install","text":"

This package requires Python 3.8+ as Pixie\u2019s dependency requires it.

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-pixie\n
"},{"location":"drivers/pixie/#usage","title":"Usage","text":"

This extension provides two probes to run Pixie scripts, either directly embedded into the experiment or in a file local to the experiment.

For instance, a complete script:

{\n\"version\": \"1.0.0\",\n\"title\": \"Consumer service remains fast under higher traffic load\",\n\"description\": \"Showcase for how we remain responsive under a certain load. This should help us figure how many replicas we should run\",\n\"secrets\": {\n\"pixie\": {\n\"api_key\": {\n\"type\": \"env\",\n\"key\": \"PIXIE_API_KEY\"\n}\n}\n},\n\"configuration\": {\n\"pixie_cluster_id\": {\n\"type\": \"env\",\n\"key\": \"PIXIE_CLUSTER_ID\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Run a Pixie script and evaluate it\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"p99-latency-of-consumer-service-for-past-2m-remained-under-300ms\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"compute-median\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_below\",\n\"secrets\": [\"pixie\"],\n\"arguments\": {\n\"column\": \"latency_p99\",\n\"percentile\": 99,\n\"convert_from_nanoseconds\": \"milliseconds\",\n\"treshold\": 300.0\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script_from_local_file\",\n\"secrets\": [\"pixie\"],\n\"arguments\": {\n\"script_path\": \"./pixiescript.py\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"send-10-requests-per-second-for-60s\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"ddosify\",\n\"arguments\": \"-d 60 -n 600 -o stdout-json -t http://mydomain.com/consumer\"\n}\n}\n]\n}\n

This assumes you have a a service named consumer. Pixie monitors its latency and produces percentiles for it. We then use a probe tolerance to evaluate the returned latency for the past 2 minutes and we measure if the latency was mainly (99-percentile) under 300ms.

In this example, we use ddosify to induce the load, but you can use your favourite tooling of course.

The Pixie script we run is as follows:

import px\n\nns_per_ms = 1000 * 1000\nns_per_s = 1000 * ns_per_ms\nwindow_ns = px.DurationNanos(10 * ns_per_s)\nfilter_unresolved_inbound = True\nfilter_health_checks = True\nfilter_ready_checks = True\n\n\ndef inbound_let_timeseries(start_time: str, service: px.Service):\n''' Compute the let as a timeseries for requests received by `service`.\n\n    Args:\n    @start_time: The timestamp of data to start at.\n    @service: The name of the service to filter on.\n\n    '''\n    df = let_helper(start_time)\n    df = df[px.has_service_name(df.service, service)]\n\n    df = df.groupby(['timestamp']).agg(\n        latency_quantiles=('latency', px.quantiles),\n        error_rate_per_window=('failure', px.mean),\n        throughput_total=('latency', px.count),\n        bytes_total=('resp_body_size', px.sum)\n    )\n\n    # Format the result of LET aggregates into proper scalar formats and\n    # time series.\n    df.latency_p50 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p50')))\n    df.latency_p90 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p90')))\n    df.latency_p99 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p99')))\n    df.request_throughput = df.throughput_total / window_ns\n    df.errors_per_ns = df.error_rate_per_window * df.request_throughput / px.DurationNanos(1)\n    df.error_rate = px.Percent(df.error_rate_per_window)\n    df.bytes_per_ns = df.bytes_total / window_ns\n    df.time_ = df.timestamp\n\n    return df[['time_', 'latency_p50', 'latency_p90', 'latency_p99',\n               'request_throughput', 'errors_per_ns', 'error_rate', 'bytes_per_ns']]\n\n\ndef let_helper(start_time: str):\n''' Compute the initial part of the let for requests.\n        Filtering to inbound/outbound traffic by service is done by the calling function.\n\n    Args:\n    @start_time: The timestamp of data to start at.\n\n    '''\n    df = px.DataFrame(table='http_events', start_time=start_time)\n    # Filter only to inbound service traffic (server-side).\n    # Don't include traffic initiated by this service to an external location.\n    df = df[df.trace_role == 2]\n    df.service = df.ctx['service']\n    df.pod = df.ctx['pod']\n    df.latency = df.latency\n\n    df.timestamp = px.bin(df.time_, window_ns)\n\n    df.failure = df.resp_status >= 400\n    filter_out_conds = ((df.req_path != '/healthz' or not filter_health_checks) and (\n        df.req_path != '/readyz' or not filter_ready_checks)) and (\n        df['remote_addr'] != '-' or not filter_unresolved_inbound)\n\n    df = df[filter_out_conds]\n    return df\n\n\ndf = inbound_let_timeseries(\"-2m\", \"default/consumer\")\npx.display(df)\n

This is an abridged script from Pixie itself.

That\u2019s it!

"},{"location":"drivers/pixie/#configuration","title":"Configuration","text":"

"},{"location":"drivers/pixie/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/pixie/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/pixie/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/pixie/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/pixie/#probes","title":"probes","text":""},{"location":"drivers/pixie/#run_script","title":"run_script","text":"Type probe Module chaospixie.probes Name run_script Return string

Run a Pixie script.

Make sure to provide the name of the table you want to fetch data for. Usually it\u2019s the name given to the px.display() function in your script.

Signature:

def run_script(script: str,\n               table_name: str = 'output',\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required script string Yes table_name string \u201coutput\u201d No

Usage:

JSONYAML
{\n\"name\": \"run-script\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script\",\n\"arguments\": {\n\"script\": \"\"\n}\n}\n}\n
name: run-script\nprovider:\narguments:\nscript: ''\nfunc: run_script\nmodule: chaospixie.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/pixie/#run_script_from_local_file","title":"run_script_from_local_file","text":"Type probe Module chaospixie.probes Name run_script_from_local_file Return list

Run a Pixie script loaded from a local file.

Make sure to provide the name of the table you want to fetch data for. Usually it\u2019s the name given to the px.display() function in your script.

Signature:

def run_script_from_local_file(\n        script_path: str,\n        table_name: str = 'output',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required script_path string Yes table_name string \u201coutput\u201d No

Usage:

JSONYAML
{\n\"name\": \"run-script-from-local-file\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script_from_local_file\",\n\"arguments\": {\n\"script_path\": \"\"\n}\n}\n}\n
name: run-script-from-local-file\nprovider:\narguments:\nscript_path: ''\nfunc: run_script_from_local_file\nmodule: chaospixie.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/pixie/#tolerances","title":"tolerances","text":""},{"location":"drivers/pixie/#median_should_be_above","title":"median_should_be_above","text":"Type tolerance Module chaospixie.tolerances Name median_should_be_above Return boolean

Compute the median of all the column in the list of results. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the median is above (or equal) to the threshold you provide.

Signature:

def median_should_be_above(column: str,\n                           treshold: float,\n                           target: Tuple[str, str] = None,\n                           convert_from_nanoseconds: Literal[\n                               'seconds', 'milliseconds',\n                               'microseconds'] = None,\n                           value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"median-should-be-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"median_should_be_above\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: median-should-be-above\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: median_should_be_above\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#median_should_be_below","title":"median_should_be_below","text":"Type tolerance Module chaospixie.tolerances Name median_should_be_below Return boolean

Compute the median of all the column in the list of results. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds flag so we automatically convert to seconds the value. In that case, the threshold must also be in seconds. The convert_from_nanoseconds flag can be: \"seconds\", \"milliseconds\" or \"microseconds\".

Return true if the median is below (or equal) to the threshold you provide.

Signature:

def median_should_be_below(column: str,\n                           treshold: float,\n                           convert_from_nanoseconds: Literal[\n                               'seconds', 'milliseconds',\n                               'microseconds'] = None,\n                           target: Tuple[str, str] = None,\n                           value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes convert_from_nanoseconds object null No target object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"median-should-be-below\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"median_should_be_below\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: median-should-be-below\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: median_should_be_below\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#percentile_should_be_above","title":"percentile_should_be_above","text":"Type tolerance Module chaospixie.tolerances Name percentile_should_be_above Return boolean

Compute the percentiles of all the column in the list of results. The default returned percentile is the 99-percentile. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the percentile is above (or equal) to the threshold you provide.

Signature:

def percentile_should_be_above(column: str,\n                               treshold: float,\n                               percentile: int = 99,\n                               target: Tuple[str, str] = None,\n                               convert_from_nanoseconds: Literal[\n                                   'seconds', 'milliseconds',\n                                   'microseconds'] = None,\n                               value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes percentile integer 99 No target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-should-be-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_above\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-should-be-above\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: percentile_should_be_above\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#percentile_should_be_below","title":"percentile_should_be_below","text":"Type tolerance Module chaospixie.tolerances Name percentile_should_be_below Return boolean

Compute the percentiles of all the column in the list of results. The default returned percentile is the 99-percentile. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the percentile is below (or equal) to the threshold you provide.

Signature:

def percentile_should_be_below(column: str,\n                               treshold: float,\n                               percentile: int = 99,\n                               target: Tuple[str, str] = None,\n                               convert_from_nanoseconds: Literal[\n                                   'seconds', 'milliseconds',\n                                   'microseconds'] = None,\n                               value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes percentile integer 99 No target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-should-be-below\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_below\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-should-be-below\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: percentile_should_be_below\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/prometheus/","title":"Extension chaosprometheus","text":"Version 0.5.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-prometheus

Prometheus support for the Chaos Toolkit.

"},{"location":"drivers/prometheus/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-prometheus\n
"},{"location":"drivers/prometheus/#usage","title":"Usage","text":"

To use this package, you must create have access to a Prometheus instance via HTTP and be allowed to connect to it.

This package only exports probes to query for some aspects of your system as monitored by Prometheus.

Here is an example of querying Prometheus at a given moment

{\n\"type\": \"probe\",\n\"name\": \"fetch-cpu-just-2mn-ago\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query\",\n\"arguments\": {\n\"query\": \"process_cpu_seconds_total{job='websvc'}\",\n\"when\": \"2 minutes ago\"\n}\n}\n}\n

You can also ask for an interval as follows:

{\n\"type\": \"probe\",\n\"name\": \"fetch-cpu-over-interval\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"arguments\": {\n\"query\": \"process_cpu_seconds_total{job='websvc'}\",\n\"start\": \"2 minutes ago\",\n\"end\": \"now\",\n\"step\": 5\n}\n}\n}\n

In both cases, the probe returns the JSON payload as-is from Prometheus or raises an exception when an error is met.

The result is not further process and should be found in the generated report of the experiment run.

You can also send metrics to a pushgateway service via a control:

{\n\"controls\": [\n{\n\"name\": \"prometheus\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.metrics\",\n\"arguments\": {\n\"pushgateway_url\": \"http://someip:9091\",\n\"job\": \"chaostoolkit\"\n}\n}\n}\n]\n}\n

You can also set three more arguments:

These are particularly useful when you couple this extension with others like Loki where you want to cross-reference between logs and metrics.

"},{"location":"drivers/prometheus/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/prometheus/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/prometheus/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosprometheus\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaosprometheus\nprovider:\nmodule: chaosprometheus.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/prometheus/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/prometheus/#metrics_1","title":"metrics","text":""},{"location":"drivers/prometheus/#probes","title":"probes","text":""},{"location":"drivers/prometheus/#compute_mean","title":"compute_mean","text":"Type probe Module chaosprometheus.probes Name compute_mean Return number

Compute the mean of all returned datapoints of the range vector matching the given query. The query must return a range vector.

The default computes an arithmetic mean. You can switch to geometric or harmonic mean by passing mean_type=\"geometric\" or mean_type=\"harmonic\".

Signature:

def compute_mean(query: str,\n                 window: str = '1d',\n                 mean_type: str = 'arithmetic',\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required query string Yes window string \u201c1d\u201d No mean_type string \u201carithmetic\u201d No

Usage:

JSONYAML
{\n\"name\": \"compute-mean\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"compute_mean\",\n\"arguments\": {\n\"query\": \"\"\n}\n}\n}\n
name: compute-mean\nprovider:\narguments:\nquery: ''\nfunc: compute_mean\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#nodes_cpu_usage_mean","title":"nodes_cpu_usage_mean","text":"Type probe Module chaosprometheus.probes Name nodes_cpu_usage_mean Return number

Computes a mean of all nodes activities per minute over the given window. We use the node_cpu_seconds_total metric to perform this query.

Signature:

def nodes_cpu_usage_mean(window: str = '1d',\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required window string \u201c1d\u201d No

Usage:

JSONYAML
{\n\"name\": \"nodes-cpu-usage-mean\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"nodes_cpu_usage_mean\"\n}\n}\n
name: nodes-cpu-usage-mean\nprovider:\nfunc: nodes_cpu_usage_mean\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#query","title":"query","text":"Type probe Module chaosprometheus.probes Name query Return mapping

Run an instant query against a Prometheus server and returns its result as-is.

Signature:

def query(query: str,\n          when: str = None,\n          timeout: float = None,\n          configuration: Dict[str, Dict[str, str]] = None,\n          secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required query string Yes when string null No timeout number null No

Usage:

JSONYAML
{\n\"name\": \"query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query\",\n\"arguments\": {\n\"query\": \"\"\n}\n}\n}\n
name: query\nprovider:\narguments:\nquery: ''\nfunc: query\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#query_interval","title":"query_interval","text":"Type probe Module chaosprometheus.probes Name query_interval Return mapping

Run a range query against a Prometheus server and returns its result as-is.

The start and end arguments can be a RFC 3339 date or expressed more colloquially such as \"5 minutes ago\".

Signature:

def query_interval(\n        query: str,\n        start: str,\n        end: str,\n        step: int = 1,\n        timeout: float = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required query string Yes start string Yes end string Yes step integer 1 No timeout number null No

Usage:

JSONYAML
{\n\"name\": \"query-interval\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"arguments\": {\n\"query\": \"\",\n\"start\": \"\",\n\"end\": \"\"\n}\n}\n}\n
name: query-interval\nprovider:\narguments:\nend: ''\nquery: ''\nstart: ''\nfunc: query_interval\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/","title":"Extension chaosreliably","text":"Version 0.64.0+editable Repository https://github.com/chaostoolkit-incubator/chaostoolkit-reliably

Chaos Toolkit extension for Reliably.

"},{"location":"drivers/reliably/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-reliably\n
"},{"location":"drivers/reliably/#authentication","title":"Authentication","text":"

To use this package, you must create have registered with Reliably services.

Then you need to set some environment variables as secrets.

{\n\"secrets\": {\n\"reliably\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"RELIABLY_TOKEN\"\n},\n\"host\": {\n\"type\": \"env\",\n\"key\": \"RELIABLY_HOST\",\n\"default\": \"app.reliably.com\"\n}\n}\n}\n}\n
"},{"location":"drivers/reliably/#usage","title":"Usage","text":""},{"location":"drivers/reliably/#as-steady-steate-hypothesis-or-method","title":"As Steady Steate Hypothesis or Method","text":"

This extensions offers a variety of probes and tolerances ready to be used in your steady-state blocks.

For instance:

{\n\"version\": \"1.0.0\",\n\"title\": \"SLO error-count-3h / Error budget 10%\",\n\"description\": \"Monitor the health of our demo service from our users perspective and ensure they have a high-quality experience\",\n\"runtime\": {\n\"hypothesis\": {\n\"strategy\": \"after-method-only\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Compute SLO and validate its Error Budget with our target\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"get-slo\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"there-should-be-error-budget-left\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.tolerances\",\n\"func\": \"has_error_budget_left\",\n\"arguments\": {\n\"name\": \"cloudrun-service-availability\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.probes\",\n\"func\": \"compute_slo\",\n\"arguments\": {\n\"slo\": {\n\"apiVersion\": \"sre.google.com/v2\",\n\"kind\": \"ServiceLevelObjective\",\n\"metadata\": {\n\"name\": \"cloudrun-service-availability\",\n\"labels\": {\n\"service_name\": \"cloudrun\",\n\"feature_name\": \"service\",\n\"slo_name\": \"availability\"\n}\n},\n\"spec\": {\n\"description\": \"Availability of Cloud Run service\",\n\"backend\": \"cloud_monitoring_mql\",\n\"method\": \"good_bad_ratio\",\n\"exporters\": [\n\n],\n\"service_level_indicator\": {\n\"filter_good\": \"fetch cloud_run_revision | metric 'run.googleapis.com/request_count' | filter resource.project_id == '${CLOUDRUN_PROJECT_ID}' | filter resource.service_name == '${CLOUDRUN_SERVICE_NAME}' | filter metric.response_code_class == '2xx'\",\n\"filter_valid\": \"fetch cloud_run_revision | metric 'run.googleapis.com/request_count' | filter resource.project_id == '${CLOUDRUN_PROJECT_ID}' | filter resource.service_name == '${CLOUDRUN_SERVICE_NAME}'\"\n},\n\"goal\": 0.9\n}\n},\n\"config\": {\n\"backends\": {\n\"cloud_monitoring_mql\": {\n\"project_id\": \"${STACKDRIVER_HOST_PROJECT_ID}\"\n}\n},\n\"error_budget_policies\": {\n\"default\": {\n\"steps\": [\n{\n\"name\": \"3 hours\",\n\"burn_rate_threshold\": 9,\n\"alert\": false,\n\"window\": 10800,\n\"message_alert\": \"Page the SRE team to defend the SLO\",\n\"message_ok\": \"Last 3 hours on track\"\n}\n]\n}\n}\n}\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"name\": \"inject-traffic-into-endpoint\",\n\"type\": \"action\",\n\"background\": true,\n\"provider\": {\n\"func\": \"inject_gradual_traffic_into_endpoint\",\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.actions\",\n\"arguments\": {\n\"endpoint\": \"${ENDPOINT}\",\n\"step_duration\": 30,\n\"test_duration\": 300,\n\"step_additional_vu\": 3,\n\"vu_per_second_rate\": 1,\n\"results_json_filepath\": \"./load-test-results.json\"\n}\n}\n}\n]\n}\n

This above example will get the last 5 Objective Results for our Must be good SLO and determine if they were all okay or whether we\u2019ve spent our error budget they are allowed.

"},{"location":"drivers/reliably/#as-controls","title":"As controls","text":"

You can use controls provided by chaostoolkit-reliably to track your experiments within Reliably. The block is inserted automatically by Reliably when you import the experiment into Reliably.

"},{"location":"drivers/reliably/#contribute","title":"Contribute","text":"

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 by black, ruff, isort, and mypy, add an entry into CHANGELOG.md, and then raise a PR to the repository for review

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/reliably/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. First you will need to install globally pdm and create a virtual environment:

$ pdm create venv\n$ pdm use\n$ $(pdm venv activate)\n

Then install the dependencies:

$ pdm sync -d\n
"},{"location":"drivers/reliably/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pdm run test\n
"},{"location":"drivers/reliably/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, [ruff][flake8], isort, mypy and [bandit][] to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ pmd run format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ pdm run lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up. It will also provide you with any errors mypy picks up.

"},{"location":"drivers/reliably/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/reliably/#autopause","title":"autopause","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.autopause\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.autopause\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#chatgpt","title":"chatgpt","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.chatgpt\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.chatgpt\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#experiment","title":"experiment","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.experiment\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.experiment\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#prechecks","title":"prechecks","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.prechecks\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.prechecks\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#safeguard","title":"safeguard","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.safeguard\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.safeguard\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/reliably/#dns","title":"dns","text":""},{"location":"drivers/reliably/#dns_response_is_superset","title":"dns_response_is_superset","text":"Type tolerance Module chaosreliably.activities.dns.tolerances Name dns_response_is_superset Return boolean

Validates the response from the DNS resolve_name probe is a superset of the given set of values.

Signature:

def dns_response_is_superset(expect: List[str],\n                             value: List[str] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expect list Yes value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"dns-response-is-superset\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.tolerances\",\n\"func\": \"dns_response_is_superset\",\n\"arguments\": {\n\"expect\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: dns-response-is-superset\nprovider:\narguments:\nexpect: []\nfunc: dns_response_is_superset\nmodule: chaosreliably.activities.dns.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#dns_response_must_be_equal","title":"dns_response_must_be_equal","text":"Type tolerance Module chaosreliably.activities.dns.tolerances Name dns_response_must_be_equal Return boolean

Validates the response from the DNS resolve_name probe is exactly equal to the given set.

Signature:

def dns_response_must_be_equal(expect: List[str],\n                               value: List[str] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expect list Yes value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"dns-response-must-be-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.tolerances\",\n\"func\": \"dns_response_must_be_equal\",\n\"arguments\": {\n\"expect\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: dns-response-must-be-equal\nprovider:\narguments:\nexpect: []\nfunc: dns_response_must_be_equal\nmodule: chaosreliably.activities.dns.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#resolve_name","title":"resolve_name","text":"Type probe Module chaosreliably.activities.dns.probes Name resolve_name Return list

Resolve a domain for a specific type from the given nameservers.

Signature:

def resolve_name(domain: str,\n                 nameservers: Sequence[str] = ('8.8.8.8', ),\n                 resolve_type: str = 'A') -> List[str]:\n    pass\n

Arguments:

Name Type Default Required domain string Yes nameservers object [\u201c8.8.8.8\u201d] No resolve_type string \u201cA\u201d No

Usage:

JSONYAML
{\n\"name\": \"resolve-name\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.probes\",\n\"func\": \"resolve_name\",\n\"arguments\": {\n\"domain\": \"\"\n}\n}\n}\n
name: resolve-name\nprovider:\narguments:\ndomain: ''\nfunc: resolve_name\nmodule: chaosreliably.activities.dns.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#gh","title":"gh","text":""},{"location":"drivers/reliably/#cancel_workflow_run","title":"cancel_workflow_run","text":"Type action Module chaosreliably.activities.gh.actions Name cancel_workflow_run Return mapping

Cancels a GitHub Workflow run.

The target run is chosen from the list of workflow runs matching the given parameters.

To refine the choice, you can set commit_message_pattern which is a regex matching the commit message that triggered the event.

If you set at_random, a run will be picked from the matching list randomly. otherwise, the first match will be used.

You may also filter down by workflow_id to ensure only runs of a specific workflow are considered.

Finally, if you know the workflow_run_id you may directly target it.

See the parameters meaning and values at: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

Signature:

def cancel_workflow_run(\n        repo: str,\n        at_random: bool = False,\n        commit_message_pattern: Optional[str] = None,\n        actor: Optional[str] = None,\n        branch: str = 'main',\n        event: str = 'push',\n        status: str = 'in_progress',\n        window: str = '5d',\n        workflow_id: Optional[str] = None,\n        workflow_run_id: Optional[str] = None,\n        exclude_pull_requests: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes at_random boolean false No commit_message_pattern object null No actor object null No branch string \u201cmain\u201d No event string \u201cpush\u201d No status string \u201cin_progress\u201d No window string \u201c5d\u201d No workflow_id object null No workflow_run_id object null No exclude_pull_requests boolean false No

Usage:

JSONYAML
{\n\"name\": \"cancel-workflow-run\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.actions\",\n\"func\": \"cancel_workflow_run\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: cancel-workflow-run\nprovider:\narguments:\nrepo: ''\nfunc: cancel_workflow_run\nmodule: chaosreliably.activities.gh.actions\ntype: python\ntype: action\n
"},{"location":"drivers/reliably/#closed_pr_ratio","title":"closed_pr_ratio","text":"Type probe Module chaosreliably.activities.gh.probes Name closed_pr_ratio Return number

Computes a ratio of closed PRs during the given window in a repo.

By default, only computes the ratio for PRs that were opened and closed during the given period. When only_opened_and_closed_during_window is not set, this computes the ratio for closed PRs in the period against all still opened PRs, whether they were opened before the period started or not.

The former is a measure of latency for teams while the latter is more the throughput of the team.

The repo should be given as owner/repo and the window should be given as a pattern like this: <int>s|m|d|w (seconds, minutes, days, weeks).

Signature:

def closed_pr_ratio(repo: str,\n                    base: str = 'main',\n                    only_opened_and_closed_during_window: bool = True,\n                    window: str = '5d',\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required repo string Yes base string \u201cmain\u201d No only_opened_and_closed_during_window boolean true No window string \u201c5d\u201d No

Usage:

JSONYAML
{\n\"name\": \"closed-pr-ratio\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"closed_pr_ratio\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: closed-pr-ratio\nprovider:\narguments:\nrepo: ''\nfunc: closed_pr_ratio\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#list_workflow_runs","title":"list_workflow_runs","text":"Type probe Module chaosreliably.activities.gh.probes Name list_workflow_runs Return mapping

List GitHub Workflow runs.

If no runs are returned when there should be, please review if GitHub has fixed https://github.com/orgs/community/discussions/53266

See the parameters meaning and values at: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

Signature:

def list_workflow_runs(\n        repo: str,\n        actor: Optional[str] = None,\n        branch: str = 'main',\n        event: str = 'push',\n        status: str = 'in_progress',\n        window: str = '5d',\n        exclude_pull_requests: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes actor object null No branch string \u201cmain\u201d No event string \u201cpush\u201d No status string \u201cin_progress\u201d No window string \u201c5d\u201d No exclude_pull_requests boolean false No

Usage:

JSONYAML
{\n\"name\": \"list-workflow-runs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"list_workflow_runs\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: list-workflow-runs\nprovider:\narguments:\nrepo: ''\nfunc: list_workflow_runs\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#percentile_under","title":"percentile_under","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name percentile_under Return boolean

Computes that the values under percentile are below the given duration.

For instance, for PR durations, this could be helpful to understand that 99% of them were closed in less than the given duration.

v = pr_duration(\"chaostoolkit/chaostoolkit\", \"master\", window=None)\np = percentile_under(0.99, duration=\"1d\", value=v)\n

Signature:

def percentile_under(percentile: float,\n                     duration: str = '1d',\n                     value: Optional[List[Union[int, float]]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required percentile number Yes duration string \u201c1d\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"percentile_under\",\n\"arguments\": {\n\"percentile\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-under\nprovider:\narguments:\npercentile: null\nfunc: percentile_under\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#pr_duration","title":"pr_duration","text":"Type probe Module chaosreliably.activities.gh.probes Name pr_duration Return list

Get a list of opened pull-requests durations.

If you don\u2019t set a window (by setting window to None), then it returns the duration of all PRs that were ever opened in this repository. Otherwise, only return the durations for PRs that were opened or closed within that window.

The repo should be given as owner/repo and the window should be given as a pattern like this: <int>s|m|d|w (seconds, minutes, days, weeks).

Signature:

def pr_duration(repo: str,\n                base: str = 'main',\n                window: Optional[str] = '5d',\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> List[float]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes base string \u201cmain\u201d No window object \u201c5d\u201d No

Usage:

JSONYAML
{\n\"name\": \"pr-duration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"pr_duration\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: pr-duration\nprovider:\narguments:\nrepo: ''\nfunc: pr_duration\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#ratio_above","title":"ratio_above","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_above Return boolean

Validates the ratio returned by a probe is strictly greater than the target.

Signature:

def ratio_above(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_above\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-above\nprovider:\narguments:\ntarget: null\nfunc: ratio_above\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_above_or_equal","title":"ratio_above_or_equal","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_above_or_equal Return boolean

Validates the ratio returned by a probe is greater than the target.

Signature:

def ratio_above_or_equal(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-above-or-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_above_or_equal\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-above-or-equal\nprovider:\narguments:\ntarget: null\nfunc: ratio_above_or_equal\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_under","title":"ratio_under","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_under Return boolean

Validates the ratio returned by a probe is strictly below the target.

Signature:

def ratio_under(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_under\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-under\nprovider:\narguments:\ntarget: null\nfunc: ratio_under\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_under_or_equal","title":"ratio_under_or_equal","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_under_or_equal Return boolean

Validates the ratio returned by a probe is below the target.

Signature:

def ratio_under_or_equal(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-under-or-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_under_or_equal\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-under-or-equal\nprovider:\narguments:\ntarget: null\nfunc: ratio_under_or_equal\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#http","title":"http","text":""},{"location":"drivers/reliably/#measure_response_time","title":"measure_response_time","text":"Type probe Module chaosreliably.activities.http.probes Name measure_response_time Return number

Measure the response time of the GET request to the given URL.

Signature:

def measure_response_time(url: str) -> float:\n    pass\n

Arguments:

Name Type Default Required url string Yes

Usage:

JSONYAML
{\n\"name\": \"measure-response-time\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.http.probes\",\n\"func\": \"measure_response_time\",\n\"arguments\": {\n\"url\": \"\"\n}\n}\n}\n
name: measure-response-time\nprovider:\narguments:\nurl: ''\nfunc: measure_response_time\nmodule: chaosreliably.activities.http.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#response_time_must_be_under","title":"response_time_must_be_under","text":"Type tolerance Module chaosreliably.activities.http.tolerances Name response_time_must_be_under Return boolean

Validates the response time is under the given latency.

Use this as the tolerance of the chaosreliably.activities.http.probes.measure_response_time probe.

Signature:

def response_time_must_be_under(latency: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required latency number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"response-time-must-be-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.http.tolerances\",\n\"func\": \"response_time_must_be_under\",\n\"arguments\": {\n\"latency\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: response-time-must-be-under\nprovider:\narguments:\nlatency: null\nfunc: response_time_must_be_under\nmodule: chaosreliably.activities.http.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#load","title":"load","text":""},{"location":"drivers/reliably/#inject_gradual_traffic_into_endpoint","title":"inject_gradual_traffic_into_endpoint","text":"Type action Module chaosreliably.activities.load.actions Name inject_gradual_traffic_into_endpoint Return mapping

Load traffic into the given endpoint. Uses an approach that creates an incremental load into the endpoint rather than swarming it. The point of this action is to ensure your endpoint is active while you perform another action. This you means you likely want to run this action in the background.

You may set a bearer token if your application uses one to authenticate. Pass test_bearer_token as a secret key in the secrets payload.

This action return a dictionary payload of the load test results.

Signature:

def inject_gradual_traffic_into_endpoint(\n        endpoint: str,\n        step_duration: int = 5,\n        step_additional_vu: int = 1,\n        vu_per_second_rate: int = 1,\n        test_duration: int = 30,\n        results_json_filepath: Optional[str] = None,\n        enable_opentracing: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required endpoint string Yes step_duration integer 5 No step_additional_vu integer 1 No vu_per_second_rate integer 1 No test_duration integer 30 No results_json_filepath object null No enable_opentracing boolean false No

Usage:

JSONYAML
{\n\"name\": \"inject-gradual-traffic-into-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.actions\",\n\"func\": \"inject_gradual_traffic_into_endpoint\",\n\"arguments\": {\n\"endpoint\": \"\"\n}\n}\n}\n
name: inject-gradual-traffic-into-endpoint\nprovider:\narguments:\nendpoint: ''\nfunc: inject_gradual_traffic_into_endpoint\nmodule: chaosreliably.activities.load.actions\ntype: python\ntype: action\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be","title":"load_test_result_field_should_be","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be Return boolean

Reads a load test result and compares the field\u2019s value to the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be_greater_than","title":"load_test_result_field_should_be_greater_than","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be_greater_than Return boolean

Reads a load test result and compares the field\u2019s value to greater than the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be_greater_than(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be-greater-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be_greater_than\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be-greater-than\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be_greater_than\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be_less_than","title":"load_test_result_field_should_be_less_than","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be_less_than Return boolean

Reads a load test result and compares the field\u2019s value to less than the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be_less_than(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be-less-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be_less_than\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be-less-than\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be_less_than\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#activities","title":"activities","text":""},{"location":"drivers/reliably/#pause_execution","title":"pause_execution","text":"Type Module chaosreliably.activities.pauses Name pause_execution Return null

Pause the execution of the experiment until the resume state has been received.

Signature:

def pause_execution(duration: int = 0,\n                    username: str = '',\n                    user_id: str = '') -> None:\n    pass\n

Arguments:

Name Type Default Required duration integer 0 No username string \u201d\u201c No user_id string \u201d\u201c No

Usage:

JSONYAML
{\n\"name\": \"pause-execution\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.pauses\",\n\"func\": \"pause_execution\"\n}\n}\n
name: pause-execution\nprovider:\nfunc: pause_execution\nmodule: chaosreliably.activities.pauses\ntype: python\ntype: ''\n
"},{"location":"drivers/reliably/#safeguard_1","title":"safeguard","text":""},{"location":"drivers/reliably/#call_endpoint","title":"call_endpoint","text":"Type probe Module chaosreliably.activities.safeguard.probes Name call_endpoint Return boolean

Signature:

def call_endpoint(url: str,\n                  auth: Optional[str] = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required url string Yes auth object null No

Usage:

JSONYAML
{\n\"name\": \"call-endpoint\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.safeguard.probes\",\n\"func\": \"call_endpoint\",\n\"arguments\": {\n\"url\": \"\"\n}\n}\n}\n
name: call-endpoint\nprovider:\narguments:\nurl: ''\nfunc: call_endpoint\nmodule: chaosreliably.activities.safeguard.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#slo","title":"slo","text":""},{"location":"drivers/reliably/#compute_slo","title":"compute_slo","text":"Type probe Module chaosreliably.activities.slo.probes Name compute_slo Return list

Computes the given SLO and return a list of outcomes for each error budget policies in the config.

This is a wrapper around https://github.com/google/slo-generator so all of its documentation applies for the definition of the slo and config objects. The former contains the the SLO description while the latter describes where to source SLIs from and the error budget policies.

The most notable difference is that we disable any exporters so there is no need to define them in your objects.

Signature:

def compute_slo(\n        slo: Dict[str, Any],\n        config: Dict[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required slo mapping Yes config mapping Yes

Usage:

JSONYAML
{\n\"name\": \"compute-slo\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.probes\",\n\"func\": \"compute_slo\",\n\"arguments\": {\n\"slo\": {},\n\"config\": {}\n}\n}\n}\n
name: compute-slo\nprovider:\narguments:\nconfig: {}\nslo: {}\nfunc: compute_slo\nmodule: chaosreliably.activities.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#has_error_budget_left","title":"has_error_budget_left","text":"Type tolerance Module chaosreliably.activities.slo.tolerances Name has_error_budget_left Return boolean

Signature:

def has_error_budget_left(name: str,\n                          value: Optional[List[Dict[str,\n                                                    Any]]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-error-budget-left\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.tolerances\",\n\"func\": \"has_error_budget_left\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-error-budget-left\nprovider:\narguments:\nname: ''\nfunc: has_error_budget_left\nmodule: chaosreliably.activities.slo.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#tls","title":"tls","text":""},{"location":"drivers/reliably/#expire_in_more_than","title":"expire_in_more_than","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name expire_in_more_than Return boolean

Verifies that the certificate expires in more than the given duration.

The duration is expressed as followed: where is one of \"s\", \"m\", \"d\" or \"w\". For example, in more than a week can be expressed as \"7d\" or \"1w\".

Signature:

def expire_in_more_than(duration: str = '7d',\n                        value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required duration string \u201c7d\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"expire-in-more-than\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"expire_in_more_than\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: expire-in-more-than\nprovider:\nfunc: expire_in_more_than\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#get_certificate_info","title":"get_certificate_info","text":"Type probe Module chaosreliably.activities.tls.probes Name get_certificate_info Return mapping

Extract certificate information from the remote connection.

Signature:

def get_certificate_info(host: str, port: int = 443) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer 443 No

Usage:

JSONYAML
{\n\"name\": \"get-certificate-info\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.probes\",\n\"func\": \"get_certificate_info\",\n\"arguments\": {\n\"host\": \"\"\n}\n}\n}\n
name: get-certificate-info\nprovider:\narguments:\nhost: ''\nfunc: get_certificate_info\nmodule: chaosreliably.activities.tls.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#has_fingerprint","title":"has_fingerprint","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name has_fingerprint Return boolean

Validate the fingerprint of the certificate. The hash is one of \"md5\", \"sha1\" or \"sha256\".

Signature:

def has_fingerprint(fingerprint: str,\n                    hash: str = 'sha256',\n                    value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required fingerprint string Yes hash string \u201csha256\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-fingerprint\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"has_fingerprint\",\n\"arguments\": {\n\"fingerprint\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-fingerprint\nprovider:\narguments:\nfingerprint: ''\nfunc: has_fingerprint\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#has_subject_alt_names","title":"has_subject_alt_names","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name has_subject_alt_names Return boolean

Validates the certficate covers at least the given list of alternative names. If strict is set, then the list of exported names must be exactly the provided ones.

Signature:

def has_subject_alt_names(alt_names: List[str],\n                          strict: bool = True,\n                          value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required alt_names list Yes strict boolean true No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-subject-alt-names\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"has_subject_alt_names\",\n\"arguments\": {\n\"alt_names\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-subject-alt-names\nprovider:\narguments:\nalt_names: []\nfunc: has_subject_alt_names\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#is_issued_by","title":"is_issued_by","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name is_issued_by Return boolean

Validate the issue of the certificate.

Signature:

def is_issued_by(issuer: str, value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required issuer string Yes value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"is-issued-by\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"is_issued_by\",\n\"arguments\": {\n\"issuer\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: is-issued-by\nprovider:\narguments:\nissuer: ''\nfunc: is_issued_by\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#verify_certificate","title":"verify_certificate","text":"Type probe Module chaosreliably.activities.tls.probes Name verify_certificate Return boolean

Performs a range of checks on the certificate of the remote endpoint:

If any of these values is not set (the default), the according check is not performed. This doesn\u2019t apply to the expiration date which is always checked.

Signature:

def verify_certificate(host: str,\n                       port: int = 443,\n                       expire_after: str = '7d',\n                       alt_names: Optional[List[str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer 443 No expire_after string \u201c7d\u201d No alt_names object null No

Usage:

JSONYAML
{\n\"name\": \"verify-certificate\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.probes\",\n\"func\": \"verify_certificate\",\n\"arguments\": {\n\"host\": \"\"\n}\n}\n}\n
name: verify-certificate\nprovider:\narguments:\nhost: ''\nfunc: verify_certificate\nmodule: chaosreliably.activities.tls.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#verify_tls_cert","title":"verify_tls_cert","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name verify_tls_cert Return boolean

Performs a range of checks on the certificate of the remote endpoint:

If any of these values is not set (the default), the according check is not performed. This doesn\u2019t apply to the expiration date which is always checked.

Signature:

def verify_tls_cert(expire_after: str = '7d',\n                    alt_names: Optional[List[str]] = None,\n                    fingerprint_sha256: Optional[str] = None,\n                    issuer: Optional[str] = None,\n                    value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expire_after string \u201c7d\u201d No alt_names object null No fingerprint_sha256 object null No issuer object null No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"verify-tls-cert\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"verify_tls_cert\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: verify-tls-cert\nprovider:\nfunc: verify_tls_cert\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#controls","title":"controls","text":""},{"location":"drivers/reliably/#capture","title":"capture","text":""},{"location":"drivers/reliably/#start_capturing","title":"start_capturing","text":"Type Module chaosreliably.controls.capture.slack Name start_capturing Return null

Signature:

def start_capturing(experiment: Dict[str, Any],\n                    configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]]) -> None:\n    pass\n

Arguments:

Name Type Default Required experiment mapping Yes

Usage:

JSONYAML
{\n\"name\": \"start-capturing\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.capture.slack\",\n\"func\": \"start_capturing\",\n\"arguments\": {\n\"experiment\": {}\n}\n}\n}\n
name: start-capturing\nprovider:\narguments:\nexperiment: {}\nfunc: start_capturing\nmodule: chaosreliably.controls.capture.slack\ntype: python\ntype: ''\n
"},{"location":"drivers/reliably/#stop_capturing","title":"stop_capturing","text":"Type Module chaosreliably.controls.capture.slack Name stop_capturing Return Optional[Dict[str, Any]]

Signature:

def stop_capturing(\n        start: datetime.datetime, end: datetime.datetime,\n        experiment: Dict[str, Any], configuration: Dict[str, Dict[str, str]],\n        secrets: Dict[str, Dict[str, str]]) -> Optional[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required start object Yes end object Yes experiment mapping Yes

Usage:

JSONYAML
{\n\"name\": \"stop-capturing\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.capture.slack\",\n\"func\": \"stop_capturing\",\n\"arguments\": {\n\"start\": null,\n\"end\": null,\n\"experiment\": {}\n}\n}\n}\n
name: stop-capturing\nprovider:\narguments:\nend: null\nexperiment: {}\nstart: null\nfunc: stop_capturing\nmodule: chaosreliably.controls.capture.slack\ntype: python\ntype: ''\n
"},{"location":"drivers/service-fabric/","title":"Extension chaosservicefabric","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-service-fabric

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Service Fabric platform.

"},{"location":"drivers/service-fabric/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-service-fabric\n
"},{"location":"drivers/service-fabric/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"start_chaos\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"stop-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"stop_chaos\",\n\"secrets\": [\"azure\"]\n}\n}\n

The parameters are straight from the Service Fabric API.

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/service-fabric/#configuration","title":"Configuration","text":""},{"location":"drivers/service-fabric/#credentials","title":"Credentials","text":"

This extension uses the requests library under the hood. The requests library expects that you have a PFX certificate, converted as to the PEM format, that allows you to authenticate with the Service Factory endpoint.

Generally speaking, there are two ways of doing this:

"},{"location":"drivers/service-fabric/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example:

{\n\"version\": \"1.0.0\",\n\"title\": \"...\",\n\"description\": \"...\",\n\"configuration\": {\n\"endpoint\": \"https://XYZ.westus.cloudapp.azure.com:19080\",\n\"verify_tls\": false,\n\"use_ca\": false\n},\n\"secrets\": {\n\"azure\": {\n\"security\": \"pem\",\n\"pem_path\": \"./cluster-client-cert.pem\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Services is healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"application-must-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"verify_tls\": false,\n\"url\": \"https://some-url-in-cluster/\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"start_chaos\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n},\n\"pauses\": {\n\"after\": 30\n}\n},\n{\n\"type\": \"probe\",\n\"ref\": \"application-must-respond\"\n},\n{\n\"type\": \"action\",\n\"name\": \"stop-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"stop_chaos\",\n\"secrets\": [\"azure\"]\n},\n\"pauses\": {\n\"after\": 5\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"get-service-factory-chaos-report\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.probes\",\n\"func\": \"chaos_report\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"start_time_utc\": \"1 minute ago\",\n\"end_time_utc\": \"now\"\n}\n}\n}\n]\n}\n
"},{"location":"drivers/service-fabric/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/service-fabric/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/service-fabric/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/service-fabric/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/service-fabric/#cluster","title":"cluster","text":""},{"location":"drivers/service-fabric/#chaos_report","title":"chaos_report","text":"Type probe Module chaosservicefabric.cluster.probes Name chaos_report Return mapping

Get Chaos report using following the Service Fabric API:

https://docs.microsoft.com/en-us/rest/api/servicefabric/sfclient-model-chaosparameters

Please see the :func:chaosazure.fabric.auth help for more information on authenticating with the service.

Signature:

def chaos_report(timeout: int = 60,\n                 start_time_utc: str = None,\n                 end_time_utc: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required timeout integer 60 No start_time_utc string null No end_time_utc string null No

Usage:

JSONYAML
{\n\"name\": \"chaos-report\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.probes\",\n\"func\": \"chaos_report\"\n}\n}\n
name: chaos-report\nprovider:\nfunc: chaos_report\nmodule: chaosservicefabric.cluster.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/service-fabric/#start_chaos","title":"start_chaos","text":"Type action Module chaosservicefabric.cluster.actions Name start_chaos Return mapping

Start Chaos in your cluster using the given parameters. This is a mapping of keys as declared in the Service Fabric API:

https://docs.microsoft.com/en-us/rest/api/servicefabric/sfclient-model-chaosparameters

Please see the :func:chaosservicefabric.fabric.auth help for more information on authenticating with the service.

Signature:

def start_chaos(parameters: Dict[str, Any],\n                timeout: int = 60,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parameters mapping Yes timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"start-chaos\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.actions\",\n\"func\": \"start_chaos\",\n\"arguments\": {\n\"parameters\": {}\n}\n}\n}\n
name: start-chaos\nprovider:\narguments:\nparameters: {}\nfunc: start_chaos\nmodule: chaosservicefabric.cluster.actions\ntype: python\ntype: action\n
"},{"location":"drivers/service-fabric/#stop_chaos","title":"stop_chaos","text":"Type action Module chaosservicefabric.cluster.actions Name stop_chaos Return mapping

Stop Chaos in your cluster.

Please see the :func:chaosservicefabric.fabric.auth help for more information on authenticating with the service.

Signature:

def stop_chaos(timeout: int = 60,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"stop-chaos\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.actions\",\n\"func\": \"stop_chaos\"\n}\n}\n
name: stop-chaos\nprovider:\nfunc: stop_chaos\nmodule: chaosservicefabric.cluster.actions\ntype: python\ntype: action\n
"},{"location":"drivers/slack/","title":"Extension chaosslack","text":"Version 0.7.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-slack

This project is an extension for the Chaos Toolkit to target Slack.

"},{"location":"drivers/slack/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-slack\n
"},{"location":"drivers/slack/#slack-app","title":"Slack App","text":"

To use this extension, you need to create a Slack app in your workspace. Please follow the Slack documentation to create a basic app:

https://api.slack.com/apps?new_app=1 https://api.slack.com/tutorials

You can start from this manifest if you want:

display_information:\nname: Chaos Toolkit events\nlong_description: Get live feedback information of all your Chaos Engineering\nexperiments executed from Chaos Toolkit. See which experiments deviated and\ninvestigate their logs directly from a Slack thread.\ndescription: Chaos Engineering experiments live events from Chaos Toolkit.\nbackground_color: \"#ffffff\"\nsettings:\norg_deploy_enabled: false\nsocket_mode_enabled: false\nis_hosted: false\ntoken_rotation_enabled: false\nfeatures:\nbot_user:\ndisplay_name: chaostoolkit\noauth_config:\nscopes:\nbot:\n- channels:read\n- chat:write\n- files:write\n

Once your application is created, you may want to set the Chaos Toolkit logo to clarify to your users where these messages come from.

"},{"location":"drivers/slack/#slack-token","title":"Slack Token","text":"

Please follow the procedure on Slack to create a token suitable for API calls made using the Python client. The token should start with xoxb-. You can find the token in your app settings under the OAuth & Permissions page.

The token should have at least the following scopes:

channels:read, chat:write and files:write

"},{"location":"drivers/slack/#install-your-slack-app","title":"Install your Slack app","text":"

Once created, you need to install the app in your workspace and invite it in any channel you wish to send events to. This channel will also have to be part specified as a controls argument (see below).

Now you should be good to go!

"},{"location":"drivers/slack/#usage","title":"Usage","text":"

Currently, this extension only provides a control to send Chaos Toolkit events to Slack channels.

To use this extension, add the following to your experiment (or settings):

\"secrets\": {\n\"slack\": {\n\"token\": \"xoxb-...\"\n}\n},\n\"controls\": [\n{\n\"name\": \"slack\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.control\",\n\"secrets\": [\"slack\"],\n\"arguments\": {\n\"channel\": \"general\"\n}\n}\n}\n]\n
"},{"location":"drivers/slack/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please fork this project, make your changes following the usual PEP 8 code style, add appropriate tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/slack/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/slack/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/slack/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False True Experiment True True Steady-state Hypothesis True True Method True False Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosslack\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.control\"\n}\n}\n]\n}\n
controls:\n- name: chaosslack\nprovider:\nmodule: chaosslack.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/slack/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/slack/#control_1","title":"control","text":""},{"location":"drivers/slack/#notification","title":"notification","text":""},{"location":"drivers/slack/#notify","title":"notify","text":"Type Module chaosslack.notification Name notify Return None

Send a chat message to a channel to relate this Chaos Toolkit event.

The settings must contain:

If one of these two attributes is missing, no notification is sent.

Signature:

def notify(settings: Dict[str, Any], event: Dict[str, Any]):\n    pass\n

Arguments:

Name Type Default Required settings mapping Yes event mapping Yes

Usage:

JSONYAML
{\n\"name\": \"notify\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.notification\",\n\"func\": \"notify\",\n\"arguments\": {\n\"settings\": {},\n\"event\": {}\n}\n}\n}\n
name: notify\nprovider:\narguments:\nevent: {}\nsettings: {}\nfunc: notify\nmodule: chaosslack.notification\ntype: python\ntype: ''\n
"},{"location":"drivers/slack/#probes","title":"probes","text":""},{"location":"drivers/slack/#get_channel_history","title":"get_channel_history","text":"Type probe Module chaosslack.probes Name get_channel_history Return list

Fetches the history of a channel up to a certain limit of messages or for the past minutes.

By default no more than 100 messages in the last 15 minutes.

Signature:

def get_channel_history(\n        channel: str,\n        limit: int = 100,\n        past: int = 15,\n        include_metadata: bool = False,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required channel string Yes limit integer 100 No past integer 15 No include_metadata boolean false No

Usage:

JSONYAML
{\n\"name\": \"get-channel-history\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.probes\",\n\"func\": \"get_channel_history\",\n\"arguments\": {\n\"channel\": \"\"\n}\n}\n}\n
name: get-channel-history\nprovider:\narguments:\nchannel: ''\nfunc: get_channel_history\nmodule: chaosslack.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/","title":"Extension chaosspring","text":"Version 0.3.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-spring

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/spring/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-spring\n
"},{"location":"drivers/spring/#usage","title":"Usage","text":"

Currently this driver supports interactions with a Spring Boot-based service that has included the 2.0.0.-SNAPSHOT release of the Chaos Monkey for Spring Boot. This snapshot includes the necessary Spring Boot Actuator HTTP endpoints so that the Chaos Toolkit to interact with the chaos features at runtime.

Once you have added the Chaos Monkey for Spring Boot and enabled the Spring Boot Actuator HTTP endpoints you can then use the probes and actions from this driver.

To use the probes and actions from this package, add the following to your experiment file:

{\n\"name\": \"enable_chaosmonkey\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\"\n},\n\"func\": \"enable_chaosmonkey\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

This will interact with the specified service and enable the Chaos Monkey features. You can also turn off the Chaos Monkey if you wish by specifying the following action:

{\n\"name\": \"disable_chaosmonkey\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\"\n},\n\"func\": \"disable_chaosmonkey\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

You can then manipulate the Chaos Monkey assaults active on your service by specifing the following action:

{\n\"name\": \"configure_assaults\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\",\n\"assaults_configuration\": {\n\"level\": 5,\n\"latencyRangeStart\": 2000,\n\"latencyRangeEnd\": 5000,\n\"latencyActive\": false,\n\"exceptionsActive\": false,\n\"killApplicationActive\": true,\n\"restartApplicationActive\": false\n}\n},\n\"func\": \"change_assaults_configuration\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

That\u2019s it!

Please explore the code to use further probes and actions.

"},{"location":"drivers/spring/#ssl-verification","title":"SSL Verification","text":"

If you do not wish to have SSL Verification performed during your actions/probes then you can pass the argument \"verify_ssl\": false to the individual activities.

If you wish to provide a CA_BUNDLE or directory of trusted CAs certificates, provide the environment variables specified in the requests documentation here: Requests SSL Cert Verification.

"},{"location":"drivers/spring/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/spring/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/spring/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/spring/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/spring/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/spring/#actions","title":"actions","text":""},{"location":"drivers/spring/#change_assaults_configuration","title":"change_assaults_configuration","text":"Type action Module chaosspring.actions Name change_assaults_configuration Return string

Change Assaults configuration on a specific service.

Signature:

def change_assaults_configuration(\n        base_url: str,\n        assaults_configuration: Dict[str, Any],\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes assaults_configuration mapping Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"change-assaults-configuration\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"change_assaults_configuration\",\n\"arguments\": {\n\"base_url\": \"\",\n\"assaults_configuration\": {}\n}\n}\n}\n
name: change-assaults-configuration\nprovider:\narguments:\nassaults_configuration: {}\nbase_url: ''\nfunc: change_assaults_configuration\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#disable_chaosmonkey","title":"disable_chaosmonkey","text":"Type action Module chaosspring.actions Name disable_chaosmonkey Return string

Disable Chaos Monkey on a specific service.

Signature:

def disable_chaosmonkey(base_url: str,\n                        headers: Dict[str, Any] = None,\n                        timeout: float = None,\n                        verify_ssl: bool = True,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"disable-chaosmonkey\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"disable_chaosmonkey\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: disable-chaosmonkey\nprovider:\narguments:\nbase_url: ''\nfunc: disable_chaosmonkey\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#enable_chaosmonkey","title":"enable_chaosmonkey","text":"Type action Module chaosspring.actions Name enable_chaosmonkey Return string

Enable Chaos Monkey on a specific service.

Signature:

def enable_chaosmonkey(base_url: str,\n                       headers: Dict[str, Any] = None,\n                       timeout: float = None,\n                       verify_ssl: bool = True,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"enable-chaosmonkey\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"enable_chaosmonkey\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: enable-chaosmonkey\nprovider:\narguments:\nbase_url: ''\nfunc: enable_chaosmonkey\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#probes","title":"probes","text":""},{"location":"drivers/spring/#assaults_configuration","title":"assaults_configuration","text":"Type probe Module chaosspring.probes Name assaults_configuration Return mapping

Get the current assaults configuraton from the specified service.

Signature:

def assaults_configuration(\n        base_url: str,\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"assaults-configuration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"assaults_configuration\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: assaults-configuration\nprovider:\narguments:\nbase_url: ''\nfunc: assaults_configuration\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/#chaosmonkey_enabled","title":"chaosmonkey_enabled","text":"Type probe Module chaosspring.probes Name chaosmonkey_enabled Return boolean

Enquire whether Chaos Monkey is enabled on the specified service.

Signature:

def chaosmonkey_enabled(base_url: str,\n                        headers: Dict[str, Any] = None,\n                        timeout: float = None,\n                        verify_ssl: bool = True,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"chaosmonkey-enabled\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"chaosmonkey_enabled\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: chaosmonkey-enabled\nprovider:\narguments:\nbase_url: ''\nfunc: chaosmonkey_enabled\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/#watcher_configuration","title":"watcher_configuration","text":"Type probe Module chaosspring.probes Name watcher_configuration Return mapping

Get the current watcher configuraton from the specified service.

Signature:

def watcher_configuration(\n        base_url: str,\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"watcher-configuration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"watcher_configuration\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: watcher-configuration\nprovider:\narguments:\nbase_url: ''\nfunc: watcher_configuration\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/terraform/","title":"Extension chaosterraform","text":"Version 0.0.9 Repository https://github.com/mcastellin/chaostoolkit-terraform

A Chaos Toolkit driver to extend chaos experiments with Terraform

"},{"location":"drivers/terraform/#package-installation","title":"Package Installation","text":""},{"location":"drivers/terraform/#from-python-package-index","title":"From Python package index","text":"

To install the latest chaostoolkit-terraform stable release:

pip install -U chaostoolkit-terraform\n
"},{"location":"drivers/terraform/#edge-version-from-the-github-repository","title":"Edge version from the GitHub repository","text":"

To install the edge version of the chaostoolkit-terraform package directly from the repository source code:

pip install -U \"git+https://github.com/mcastellin/chaostoolkit-terraform.git#egg=chaostoolkit-terraform\"\n
"},{"location":"drivers/terraform/#usage","title":"Usage","text":"

chaostoolkit-terraform provides a control to deploy Terraform modules. The control will automatically create the resources defined in the Terraform stack before experiment execution and destroy them once the experiment is completed.

To activate the chaosterraform.control for your experiments you need to define it in your experiment files (or settings):

title: My experiment\ndescription: ...\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n\nsteady-state-hypothesis: {...}\n\nmethod: []\n

By default the chaosterraform.control will reference the Terraform module found in the current working directory.

The control will execute Terraform command in the following phases of the experiment execution:

Phase Actions Configure control Initialize the Terraform driver in Chaos Toolkit Before experiment Initialize and apply the selected Terraform module After experiment Run terraform destroy unless specifically asked to retain the created resources"},{"location":"drivers/terraform/#configuration","title":"Configuration","text":"

You can configure the Terraform control either via control arguments or using Chaos Toolkit parameters with the tf_conf__ prefix:

Configuration with control arguments

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nsilent: false\nretain: true\n

Configuration using Chaos Toolkit parameters

configuration:\n# parameters prefixed with `tf_conf__` will configure chaosterraform driver\ntf_conf__silent: false\ntf_conf__retain: true\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n

When both options are provided configuration parameters supplied via the experiment configuration will be used.

Parameter Name Usage silent Suppress Terraform console output to avoid verbose experiment logs, defaults to true retain Do not run terraform destroy at the end of the experiment to retain resources, defaults to false chdir Instruct Terraform to change its working directory"},{"location":"drivers/terraform/#provide-input-variables-for-terraform","title":"Provide Input Variables for Terraform","text":"

You can override input variables defined in the Terraform module from within the experiment using the variables argument for the control:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nvariables:\nvpc_id: \"vpc-0000000000\"\nnumber_of_azs: 2\n

Alternatively, you can provide input variables from Chaos Toolkit configuration by referencing a parameter name already defined in Chaos Toolkit configuration:

configuration:\nenv_name: \"live\"\n...\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nvariables:\nenvironment:\nname: \"env_name\"\n
"},{"location":"drivers/terraform/#use-terraform-outputs-in-chaos-experiments","title":"Use Terraform Outputs In Chaos Experiments","text":"

If your Terraform module exports some output variables you can use them in the Chaos Toolkit experiments as regular experiment parameters. Such variables are added to the configuration context with the tf_out__ prefix.

For example, this Terraform module exports a load balancer DNS name:

terraform {\n...\n}\n\noutput \"alb_dns_name\" {\nvalue = aws_lb.application_lb.dns_name\n}\n

We can use the exported DNS name in our chaos experiment like so:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n\nsteady-state-hypothesis:\ntitle: \"Application is available\"\nprobes:\n- type: probe\nname: \"should-respond-200\"\ntolerance: 200\nprovider:\ntype: http\nurl: \"http://${tf_out__alb_dns_name}\"\nmethod: \"GET\"\ntimeout: 3\n

In addition, we can ask the chaosterraform.control to map Terraform output values to new Chaos Toolkit configuration variables or override existing ones using the outputs argument:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\noutputs:\nalb_dns_name: \"application_dns_name\"\n

In the example above, the control will map the output value alb_dns_name into a new Chaos Toolkit configuration application_dns_name that can be referenced in the experiment template using the ${application_dns_name} notation.

"},{"location":"drivers/toxiproxy/","title":"Extension chaostoxi","text":"Version 0.3.1 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-toxiproxy

Welcome to the Chaos Toolkit driver for Toxiproxy! This extension allows you to setup toxy proxy probes and methods from chaostoolkit by leveraging the toxyproxy http management api.

"},{"location":"drivers/toxiproxy/#install","title":"Install","text":"
  1. Install the Toxiproxy base client
  2. Install the Toxiproxy CLI
"},{"location":"drivers/toxiproxy/#driver","title":"Driver","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-toxiproxy\n
"},{"location":"drivers/toxiproxy/#usage","title":"Usage","text":""},{"location":"drivers/toxiproxy/#configuration","title":"Configuration","text":"

First, run the Toxiproxy base client locally to create a localhost:8474 host on your computer. Then create a proxy.

Next, to start using the actions and probes all you need to do is add the toxiproxy host with \u201ctoxiproxy_host\u201d as the key, and optionally the port with \u201ctoxiproxy_port\u201d as the key, to the configuration section in your experiment json. If not provided the port defaults to 8474.

Alternatively, if toxiproxy api is accessible using a reverse proxy, you can use toxiproxy_url setting.

Example using toxiproxy_host in experiment.json

\"configuration\": {\n\"toxiproxy_host\" : \"10.124.23.183\",\n\"some_environment_variable\": {\n\"type\": \"environment\",\n\"key\": \"ENVIRONMENT_VARIABLE\"\n}\n},\n

Example using toxiproxy_url in experiment.json

\"configuration\": {\n\"toxiproxy_url\" : \"http://mydomain.com:8080/path-to-toxiproxy-api\",\n\"some_environment_variable\": {\n\"type\": \"environment\",\n\"key\": \"ENVIRONMENT_VARIABLE\"\n}\n},\n

This extension follows the toxiproxy rules. A proxy is the channel where toxicity can be added. For this reason the extension is broken into proxy management and toxic management.

All actions and probes in the extension are of python type and are used like any other python extension.

"},{"location":"drivers/toxiproxy/#proxy-actions","title":"Proxy actions","text":""},{"location":"drivers/toxiproxy/#create_proxy","title":"create_proxy","text":"

Creates a proxy to which toxics can be added. In toxiproxy a listen port of value 0 tells the API to assign a random available port. The value where the proxy is listenting will be attached to the chaostoolkit configuration object as \\<proxyname>_PORT. Should the creation of the proxy fail, an assertion error is raised stopping all subsequent actions.

Argument Description Required Default proxy_name name for the proxy Yes None upstream_host ip address of the host to send traffic to Yes None upstream_port port of the application to send traffic to Yes None listen_host IP address to bind where toxiproxy listens No 0.0.0.0 listen_port port to listen for requests, 0 means pick random value No 0 enabled Whether to start listening or not No True"},{"location":"drivers/toxiproxy/#modify_proxy","title":"modify_proxy","text":"

Modify the configuration of a given proxy. Useful to change the upstream configiuration. Only arguments supplied result in modification of the proxy.

Argument Description Required Default proxy_name name for the proxy Yes None listen_addres ip:port address to modify No None upstream_addres ip:port of the upstream No None enabled Toggle enabled/disabled state No None"},{"location":"drivers/toxiproxy/#disable_proxy","title":"disable_proxy","text":"

Disables the proxy, this is useful to simulate a proxied service being down.

Argument Description Required Default proxy_name name for the proxy to disable Yes None"},{"location":"drivers/toxiproxy/#enable_proxy","title":"enable_proxy","text":"

Enables a disabled proxy.

Argument Description Required Default proxy_name name for the proxy to enable Yes None"},{"location":"drivers/toxiproxy/#delete_proxy","title":"delete_proxy","text":"

Removes the proxy from the system.

Example usage

 \"method\": [\n{\n\"type\": \"action\",\n\"name\": \"setup_toxiproxy_proxy\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"create_proxy\",\n\"arguments\": {\n\"proxy_name\": \"myproxy\",\n\"listen_port\" : 6666,\n\"upstream_host\" : \"10.28.188.118\",\n\"upstream_port\" : 6040\n}\n},\n\"pauses\": {\n\"after\": 1\n}\n}\n] 
"},{"location":"drivers/toxiproxy/#reset","title":"reset","text":"

Enable all proxies and remove all active toxics.

Example usage:

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"reset all proxies\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"reset\"\n},\n\"pauses\": {\n\"after\": 1\n}\n}\n]\n

"},{"location":"drivers/toxiproxy/#proxy-pobes","title":"Proxy pobes","text":""},{"location":"drivers/toxiproxy/#proxy_exist","title":"proxy_exist","text":"

Returns True of False if a given proxy exists.

Argument Description Required Default proxy_name name for the proxy Yes None"},{"location":"drivers/toxiproxy/#toxic-actions","title":"Toxic actions","text":"

All actions provided by this extension match the types and attributes of toxics.

"},{"location":"drivers/toxiproxy/#create_toxic","title":"create_toxic","text":"

Allows you to create any of the supported types of toxics with their attributes.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None toxic_type A valid toxic type Yes None stream The direction of the toxic \u201cupstream\u201d or \u201cdownstream\u201d No downstream toxicity Percentage of toxiciy 1.0 is 100%, 0.5 is 50% etc No 1.0 attributes Dictionary of attributes for the type of toxic No None"},{"location":"drivers/toxiproxy/#create_latency_toxic","title":"create_latency_toxic","text":"

Add a delay to all data going through the proxy using a downstream with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None latency time in milliseconds to add for latency Yes None jitter time in milliseconds to jitter No 0"},{"location":"drivers/toxiproxy/#create_bandwith_degradation_toxic","title":"create_bandwith_degradation_toxic","text":"

Limit the bandwith of a downstream connection with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None rate desired bandwith rate in KB/s Yes None"},{"location":"drivers/toxiproxy/#create_slow_connection_close_toxic","title":"create_slow_connection_close_toxic","text":"

Generate as downstream delayed TCP close with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None delay desired close delay in milliseconds Yes None"},{"location":"drivers/toxiproxy/#create_slicer_toxic","title":"create_slicer_toxic","text":"

Slices TCP data up into small bits, optionally adding a delay between each sliced \u201cpacket\u201d with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None average_size size in bytes for the average package Yes None size_variation variation in bytes of an average pkg (should be smaller than average_size) Yes None delay time in microseconds to delay each packet by Yes None"},{"location":"drivers/toxiproxy/#create_limiter_toxic","title":"create_limiter_toxic","text":"

Closes connections when transmitted data after the limit, sets it up as a dowsntream, 100% toxicity.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None bytes number of bytes to transmit before connection is closed Yes None"},{"location":"drivers/toxiproxy/#delete_toxic","title":"delete_toxic","text":"

Deletes the a given toxic.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None

Example usage:

 \"method\": [        {\n\"type\": \"action\",\n\"name\": \"create_latency_toxic\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"toxiproxy.toxic.actions\",\n\"func\": \"create_dowsntream_latency_toxic\",\n\"arguments\": {\n\"for_proxy\": \"edsproxy\",\n\"toxic_name\": \"latency_toxic\",\n\"latency\": 5000,\n\"jitter\": 200\n}\n},\n\"pauses\": {\n\"after\": 1\n}\n}    ]\n
"},{"location":"drivers/toxiproxy/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/toxiproxy/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/toxiproxy/#test","title":"Test","text":"

To run the unit tests for the project execute the following:

$ pytest\n

To run the integration tests for the project execute the following:

$ tox\n
"},{"location":"drivers/toxiproxy/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/toxiproxy/#proxy","title":"proxy","text":""},{"location":"drivers/toxiproxy/#create_proxy_1","title":"create_proxy","text":"Type action Module chaostoxi.proxy.actions Name create_proxy Return None

Creates a proxy to which toxics can be added.

Signature:

def create_proxy(proxy_name: str,\n                 upstream_host: str,\n                 upstream_port: int,\n                 listen_host: str = '0.0.0.0',\n                 listen_port: int = 0,\n                 enabled: bool = True,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes upstream_host string Yes upstream_port integer Yes listen_host string \u201c0.0.0.0\u201d No listen_port integer 0 No enabled boolean true No

Usage:

JSONYAML
{\n\"name\": \"create-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"create_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\",\n\"upstream_host\": \"\",\n\"upstream_port\": 0\n}\n}\n}\n
name: create-proxy\nprovider:\narguments:\nproxy_name: ''\nupstream_host: ''\nupstream_port: 0\nfunc: create_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#delete_proxy_1","title":"delete_proxy","text":"Type action Module chaostoxi.proxy.actions Name delete_proxy Return None

Removes the proxy from the system.

Signature:

def delete_proxy(proxy_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"delete_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: delete-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: delete_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#disable_proxy_1","title":"disable_proxy","text":"Type action Module chaostoxi.proxy.actions Name disable_proxy Return None

Disables the proxy, this is useful to simulate a proxied service being down.

Signature:

def disable_proxy(proxy_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"disable-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"disable_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: disable-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: disable_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#enable_proxy_1","title":"enable_proxy","text":"Type action Module chaostoxi.proxy.actions Name enable_proxy Return None

Enables a disabled proxy.

Signature:

def enable_proxy(proxy_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"enable-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"enable_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: enable-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: enable_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#get_proxy_attribute","title":"get_proxy_attribute","text":"Type probe Module chaostoxi.proxy.probes Name get_proxy_attribute Return None

Returns an attribute of a specified proxy.

Signature:

def get_proxy_attribute(proxy_name: str,\n                        attribute: str,\n                        configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes attribute string Yes

Usage:

JSONYAML
{\n\"name\": \"get-proxy-attribute\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.probes\",\n\"func\": \"get_proxy_attribute\",\n\"arguments\": {\n\"proxy_name\": \"\",\n\"attribute\": \"\"\n}\n}\n}\n
name: get-proxy-attribute\nprovider:\narguments:\nattribute: ''\nproxy_name: ''\nfunc: get_proxy_attribute\nmodule: chaostoxi.proxy.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/toxiproxy/#modify_proxy_1","title":"modify_proxy","text":"Type action Module chaostoxi.proxy.actions Name modify_proxy Return None

Modify the configuration of a given proxy. Useful to change the upstream configiuration. Only arguments supplied result in modification of the proxy.

Signature:

def modify_proxy(proxy_name: str,\n                 listen_address: str = None,\n                 upstream_address: str = None,\n                 enabled: bool = None,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes listen_address string null No upstream_address string null No enabled boolean null No

Usage:

JSONYAML
{\n\"name\": \"modify-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"modify_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: modify-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: modify_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#proxy_exist_1","title":"proxy_exist","text":"Type probe Module chaostoxi.proxy.probes Name proxy_exist Return None

Returns True of False if a given proxy exists.

Signature:

def proxy_exist(proxy_name: str,\n                configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"proxy-exist\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.probes\",\n\"func\": \"proxy_exist\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: proxy-exist\nprovider:\narguments:\nproxy_name: ''\nfunc: proxy_exist\nmodule: chaostoxi.proxy.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/toxiproxy/#reset_1","title":"reset","text":"Type action Module chaostoxi.proxy.actions Name reset Return None

Enable all proxies and remove all active toxics

Signature:

def reset(configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"reset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"reset\"\n}\n}\n
name: reset\nprovider:\nfunc: reset\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#toxic","title":"toxic","text":""},{"location":"drivers/toxiproxy/#create_bandwith_degradation_toxic_1","title":"create_bandwith_degradation_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_bandwith_degradation_toxic Return mapping

Limit the bandwith of a downstream connection with a toxicity of 100%.

Signature:

def create_bandwith_degradation_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        rate: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes rate integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-bandwith-degradation-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_bandwith_degradation_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"rate\": 0\n}\n}\n}\n
name: create-bandwith-degradation-toxic\nprovider:\narguments:\nfor_proxy: ''\nrate: 0\ntoxic_name: ''\nfunc: create_bandwith_degradation_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_latency_toxic_1","title":"create_latency_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_latency_toxic Return mapping

Add a delay to all data going through the proxy using a downstream with a toxicity of 100%.

Signature:

def create_latency_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        latency: int,\n        jitter: int = 0,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes latency integer Yes jitter integer 0 No

Usage:

JSONYAML
{\n\"name\": \"create-latency-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_latency_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"latency\": 0\n}\n}\n}\n
name: create-latency-toxic\nprovider:\narguments:\nfor_proxy: ''\nlatency: 0\ntoxic_name: ''\nfunc: create_latency_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_limiter_toxic_1","title":"create_limiter_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_limiter_toxic Return mapping

Closes connections when transmitted data after the limit, sets it up as a dowsntream, 100% toxicity.

Signature:

def create_limiter_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        bytes_limit: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes bytes_limit integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-limiter-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_limiter_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"bytes_limit\": 0\n}\n}\n}\n
name: create-limiter-toxic\nprovider:\narguments:\nbytes_limit: 0\nfor_proxy: ''\ntoxic_name: ''\nfunc: create_limiter_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_slicer_toxic_1","title":"create_slicer_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_slicer_toxic Return mapping

Slices TCP data up into small bits, optionally adding a delay between each sliced \u201cpacket\u201d with a toxicity of 100%.

Signature:

def create_slicer_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        average_size: int,\n        size_variation: int,\n        delay: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes average_size integer Yes size_variation integer Yes delay integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-slicer-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_slicer_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"average_size\": 0,\n\"size_variation\": 0,\n\"delay\": 0\n}\n}\n}\n
name: create-slicer-toxic\nprovider:\narguments:\naverage_size: 0\ndelay: 0\nfor_proxy: ''\nsize_variation: 0\ntoxic_name: ''\nfunc: create_slicer_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_slow_connection_close_toxic_1","title":"create_slow_connection_close_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_slow_connection_close_toxic Return mapping

Limit the bandwith of a downstream connection with a toxicity of 100%.

Signature:

def create_slow_connection_close_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        delay: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes delay integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-slow-connection-close-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_slow_connection_close_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"delay\": 0\n}\n}\n}\n
name: create-slow-connection-close-toxic\nprovider:\narguments:\ndelay: 0\nfor_proxy: ''\ntoxic_name: ''\nfunc: create_slow_connection_close_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_timeout_toxic","title":"create_timeout_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_timeout_toxic Return mapping

Generate as downstream delayed TCP close with a toxicity of 100%.

Signature:

def create_timeout_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        timeout: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes timeout integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-timeout-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_timeout_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"timeout\": 0\n}\n}\n}\n
name: create-timeout-toxic\nprovider:\narguments:\nfor_proxy: ''\ntimeout: 0\ntoxic_name: ''\nfunc: create_timeout_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_toxic_1","title":"create_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_toxic Return boolean

Allows you to create any of the supported types of toxics with their attributes.

Signature:

def create_toxic(for_proxy: str,\n                 toxic_name: str,\n                 toxic_type: str,\n                 stream: str = 'downstream',\n                 toxicity: float = 1.0,\n                 attributes: Dict[str, Any] = None,\n                 configuration: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes toxic_type string Yes stream string \u201cdownstream\u201d No toxicity number 1.0 No attributes mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"toxic_type\": \"\"\n}\n}\n}\n
name: create-toxic\nprovider:\narguments:\nfor_proxy: ''\ntoxic_name: ''\ntoxic_type: ''\nfunc: create_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#delete_toxic_1","title":"delete_toxic","text":"Type action Module chaostoxi.toxic.actions Name delete_toxic Return None

Deletes the a given toxic.

Signature:

def delete_toxic(for_proxy: str,\n                 toxic_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"delete_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\"\n}\n}\n}\n
name: delete-toxic\nprovider:\narguments:\nfor_proxy: ''\ntoxic_name: ''\nfunc: delete_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/","title":"Extension chaoswm","text":"Version 0.1.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock

=====================

Chaos Toolkit driver for WireMock.

"},{"location":"drivers/wiremock/#package-installation","title":"Package installation","text":"

To install the package from pypi.org:

pip install -U chaostoolkit-wiremock\n
"},{"location":"drivers/wiremock/#installation-from-source","title":"Installation from source","text":"

In order to use it, you need python 3.5+ in your environment. Once downloaded the project, cd into it and run:

pip install -r requirements.txt -r requirements-dev.txt\nmake clean && make test && make install\n
"},{"location":"drivers/wiremock/#configuration","title":"Configuration","text":"

The following keys can be configured in the experiment global configuration section, under the \"wiremock\" key:

Configuration example:

{\n    \"configuration\": {\n        \"wiremock\": {\n            \"host\": \"localhost\",\n            \"port\": 8080,\n            \"contextPath\": \"/wiremock\",\n            \"timeout\": 10,\n            \"down\": {\n                \"type\": \"lognormal\",\n                \"median\": 3000,\n                \"sigma\": 0.2\n            }\n        }\n    }\n}\n
"},{"location":"drivers/wiremock/#exported-actions","title":"Exported Actions","text":"

Adding a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"adding a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"add_mappings\",\n        \"arguments\": {\n          \"mappings\": [{\n            \"request\": {\n               \"method\": \"GET\",\n               \"url\": \"/hello\"\n            },\n            \"response\": {\n               \"status\": 200,\n               \"body\": \"Hello world!\",\n               \"headers\": {\n                   \"Content-Type\": \"text/plain\"\n               }\n            } \n          }]\n        }\n      }\n    }\n  ]\n}\n

Deleting a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"deleting a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"delete_mappings\",\n        \"arguments\": {\n          \"filter\": [{\n             \"method\": \"GET\",\n             \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Adding a global fixed delay:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a global fixed delay\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"global_fixed_delay\",\n        \"arguments\": {\n          \"fixedDelay\": 10\n        }\n      }\n    }\n  ]\n}\n

Adding a global random delay:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a global random delay\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"global_random_delay\",\n        \"arguments\": {\n          \"delayDistribution\": {\n            \"type\": \"lognormal\",\n            \"median\": 20,\n            \"sigma\": 0.1\n          }\n        }\n      }\n    }\n  ]\n}\n

Adding a fixed delay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a fixed delay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"fixed_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello1\"\n          }],\n          \"fixedDelayMilliseconds\": 1000\n        }\n      }\n    }\n  ]\n}\n

Adding a random delay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a random delay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"random_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello2\"\n          }],\n          \"delayDistribution\": {\n            \"type\": \"lognormal\",\n            \"median\": 2000,\n            \"sigma\": 0.5\n          }\n        }\n      }\n    }\n  ]\n}\n

Adding a ChunkedDribbleDelay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a ChunkedDribbleDelay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"chunked_dribble_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }],\n          \"chunkedDribbleDelay\": {\n            \"numberOfChunks\": 5,\n            \"totalDuration\": 1000\n          }\n        }\n      }\n    }\n  ]\n}\n

Taking a list of mappings down (heavy distribution delay). This action will use the parameters specified in the \"down\" key of the configuration section:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"down\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Taking a list of mappings up back again:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"up\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Resetting the wiremock server (deleting all mappings):

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"reset\"\n      }\n    }\n  ]\n}\n
"},{"location":"drivers/wiremock/#experiments","title":"Experiments","text":"

The driver comes with an experiments directory where you can find snippets to test all APIs against a WireMock server listening on localhost:8080.

"},{"location":"drivers/wiremock/#discovery","title":"Discovery","text":"

You may use the Chaos Toolkit to discover the capabilities of this extension:

$ chaos discover chaostoolkit-wiremock  --no-install\n
"},{"location":"drivers/wiremock/#credits","title":"Credits","text":"

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

"},{"location":"drivers/wiremock/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/wiremock/#actions","title":"actions","text":""},{"location":"drivers/wiremock/#add_mappings","title":"add_mappings","text":"Type action Module chaoswm.actions Name add_mappings Return list

adds more mappings to wiremock returns the list of ids of the mappings added

Signature:

def add_mappings(mappings: List[Any],\n                 configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required mappings list Yes

Usage:

JSONYAML
{\n\"name\": \"add-mappings\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"add_mappings\",\n\"arguments\": {\n\"mappings\": []\n}\n}\n}\n
name: add-mappings\nprovider:\narguments:\nmappings: []\nfunc: add_mappings\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#chunked_dribble_delay","title":"chunked_dribble_delay","text":"Type action Module chaoswm.actions Name chunked_dribble_delay Return list

adds a chunked dribble delay to a list of mappings

Signature:

def chunked_dribble_delay(\n        filter: List[Any],\n        chunkedDribbleDelay: Mapping[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes chunkedDribbleDelay object Yes

Usage:

JSONYAML
{\n\"name\": \"chunked-dribble-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"chunked_dribble_delay\",\n\"arguments\": {\n\"filter\": [],\n\"chunkedDribbleDelay\": null\n}\n}\n}\n
name: chunked-dribble-delay\nprovider:\narguments:\nchunkedDribbleDelay: null\nfilter: []\nfunc: chunked_dribble_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#delete_mappings","title":"delete_mappings","text":"Type action Module chaoswm.actions Name delete_mappings Return list

deletes a list of mappings returns the list of ids of the mappings deleted

Signature:

def delete_mappings(\n        filter: List[Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"delete-mappings\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"delete_mappings\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: delete-mappings\nprovider:\narguments:\nfilter: []\nfunc: delete_mappings\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#down","title":"down","text":"Type action Module chaoswm.actions Name down Return list

set a list of services down more correctly it adds a chunked dribble delay to the mapping as defined in the configuration section (or action attributes) Returns the list of delayed mappings

Signature:

def down(filter: List[Any],\n         configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"down\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"down\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: down\nprovider:\narguments:\nfilter: []\nfunc: down\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#fixed_delay","title":"fixed_delay","text":"Type action Module chaoswm.actions Name fixed_delay Return list

adds a fixed delay to a list of mappings

Signature:

def fixed_delay(filter: List[Any],\n                fixedDelayMilliseconds: int,\n                configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes fixedDelayMilliseconds integer Yes

Usage:

JSONYAML
{\n\"name\": \"fixed-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"fixed_delay\",\n\"arguments\": {\n\"filter\": [],\n\"fixedDelayMilliseconds\": 0\n}\n}\n}\n
name: fixed-delay\nprovider:\narguments:\nfilter: []\nfixedDelayMilliseconds: 0\nfunc: fixed_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#global_fixed_delay","title":"global_fixed_delay","text":"Type action Module chaoswm.actions Name global_fixed_delay Return integer

add a fixed delay to all mappings

Signature:

def global_fixed_delay(fixedDelay: int = 0,\n                       configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required fixedDelay integer 0 No

Usage:

JSONYAML
{\n\"name\": \"global-fixed-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"global_fixed_delay\"\n}\n}\n
name: global-fixed-delay\nprovider:\nfunc: global_fixed_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#global_random_delay","title":"global_random_delay","text":"Type action Module chaoswm.actions Name global_random_delay Return integer

adds a random delay to all mappings

Signature:

def global_random_delay(\n        delayDistribution: Mapping[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required delayDistribution object Yes

Usage:

JSONYAML
{\n\"name\": \"global-random-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"global_random_delay\",\n\"arguments\": {\n\"delayDistribution\": null\n}\n}\n}\n
name: global-random-delay\nprovider:\narguments:\ndelayDistribution: null\nfunc: global_random_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#populate_from_dir","title":"populate_from_dir","text":"Type action Module chaoswm.actions Name populate_from_dir Return list

adds all mappings found in the passed folder returns the list of ids of the mappings added

Signature:

def populate_from_dir(\n        dir: str = '.',\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required dir string \u201d.\u201d No

Usage:

JSONYAML
{\n\"name\": \"populate-from-dir\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"populate_from_dir\"\n}\n}\n
name: populate-from-dir\nprovider:\nfunc: populate_from_dir\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#random_delay","title":"random_delay","text":"Type action Module chaoswm.actions Name random_delay Return list

adds a random delay to a list of mapppings

Signature:

def random_delay(filter: List[Any],\n                 delayDistribution: Mapping[str, Any],\n                 configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes delayDistribution object Yes

Usage:

JSONYAML
{\n\"name\": \"random-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"random_delay\",\n\"arguments\": {\n\"filter\": [],\n\"delayDistribution\": null\n}\n}\n}\n
name: random-delay\nprovider:\narguments:\ndelayDistribution: null\nfilter: []\nfunc: random_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#reset","title":"reset","text":"Type action Module chaoswm.actions Name reset Return integer

resets the wiremock server: deletes all mappings!

Signature:

def reset(configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"reset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"reset\"\n}\n}\n
name: reset\nprovider:\nfunc: reset\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#up","title":"up","text":"Type action Module chaoswm.actions Name up Return list

deletes all delays connected with a list of mappings

Signature:

def up(filter: List[Any],\n       configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"up\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"up\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: up\nprovider:\narguments:\nfilter: []\nfunc: up\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#probes","title":"probes","text":""},{"location":"drivers/wiremock/#mappings","title":"mappings","text":"Type probe Module chaoswm.probes Name mappings Return list

Signature:

def mappings(c: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"mappings\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.probes\",\n\"func\": \"mappings\"\n}\n}\n
name: mappings\nprovider:\nfunc: mappings\nmodule: chaoswm.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/wiremock/#server_running","title":"server_running","text":"Type probe Module chaoswm.probes Name server_running Return integer

Signature:

def server_running(c: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"server-running\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.probes\",\n\"func\": \"server_running\"\n}\n}\n
name: server-running\nprovider:\nfunc: server_running\nmodule: chaoswm.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/wiremock/#utils","title":"utils","text":""},{"location":"drivers/wiremock/#can_connect_to","title":"can_connect_to","text":"Type Module chaoswm.utils Name can_connect_to Return boolean

Test a connection to a host/port

Signature:

def can_connect_to(host: str, port: int) -> bool:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer Yes

Usage:

JSONYAML
{\n\"name\": \"can-connect-to\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"can_connect_to\",\n\"arguments\": {\n\"host\": \"\",\n\"port\": 0\n}\n}\n}\n
name: can-connect-to\nprovider:\narguments:\nhost: ''\nport: 0\nfunc: can_connect_to\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"drivers/wiremock/#check_configuration","title":"check_configuration","text":"Type Module chaoswm.utils Name check_configuration Return boolean

Signature:

def check_configuration(c: Dict[str, Any] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"check-configuration\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"check_configuration\"\n}\n}\n
name: check-configuration\nprovider:\nfunc: check_configuration\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"drivers/wiremock/#get_wm_params","title":"get_wm_params","text":"Type Module chaoswm.utils Name get_wm_params Return Optional[Dict[str, Any]]

Signature:

def get_wm_params(c: Dict[str, Any]) -> Optional[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required c mapping Yes

Usage:

JSONYAML
{\n\"name\": \"get-wm-params\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"get_wm_params\",\n\"arguments\": {\n\"c\": {}\n}\n}\n}\n
name: get-wm-params\nprovider:\narguments:\nc: {}\nfunc: get_wm_params\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"reference/concepts/","title":"Chaos Engineering Concepts in the Chaos Toolkit","text":"

If you haven\u2019t already, we strongly recommend reading the fantastic Chaos Engineering book from O\u2019Reilly Media. This book will give you some fantastic background on the whole Chaos Engineering discipline, and it\u2019s free!

Chaos Engineering is a discipline that allows you to surface weaknesses, and eventually build confidence, in complex and often distributed systems.

The Chaos Toolkit aims to give you the simplest experience for writing and running your own Chaos Engineering experiments. The main concepts are all expressed in an experiment definition, of which the following is an example from the Chaos Toolkit Samples project:

JSONYAML
{\n\"title\": \"System is resilient to provider's failures\",\n\"description\": \"Can our consumer survive gracefully a provider's failure?\",\n\"tags\": [\n\"service\",\n\"kubernetes\",\n\"spring\"\n],\n\"steady-state-hypothesis\": {\n\"title\": \"Services are all available and healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"all-services-are-healthy\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"all_microservices_healthy\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"stop-provider-service\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"kill_microservice\",\n\"arguments\": {\n\"name\": \"my-provider-service\"\n}\n},\n\"pauses\": {\n\"after\": 10\n}\n},\n{\n\"ref\": \"all-services-are-healthy\"\n},\n{\n\"type\": \"probe\",\n\"name\": \"consumer-service-must-still-respond\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://192.168.42.58:31018/invokeConsumedService\"\n}\n}\n],\n\"rollbacks\": []\n}\n
title: System is resilient to provider's failures\ndescription: Can our consumer survive gracefully a provider's failure?\ntags:\n- service\n- kubernetes\n- spring\nsteady-state-hypothesis:\ntitle: Services are all available and healthy\nprobes:\n- type: probe\nname: all-services-are-healthy\ntolerance: true\nprovider:\ntype: python\nmodule: chaosk8s.probes\nfunc: all_microservices_healthy\nmethod:\n- type: action\nname: stop-provider-service\nprovider:\ntype: python\nmodule: chaosk8s.actions\nfunc: kill_microservice\narguments:\nname: my-provider-service\npauses:\nafter: 10\n- ref: all-services-are-healthy\n- type: probe\nname: consumer-service-must-still-respond\nprovider:\ntype: http\nurl: http://192.168.42.58:31018/invokeConsumedService\nrollbacks: []\n

The key concepts of the Chaos Toolkit are Experiments, Steady State Hypothesis and the experiment\u2019s Method. The Method contains a combination of Probes and Actions.

"},{"location":"reference/concepts/#experiments","title":"Experiments","text":"

A Chaos Toolkit experiment is provided in a single file and is currently expressed in JSON.

"},{"location":"reference/concepts/#steady-state-hypothesis","title":"Steady State Hypothesis","text":"

A Steady State Hypothesis describes \u201cwhat normal looks like\u201d for your system in order for the experiment to surface information about weaknesses when compared against the declared \u201cnormal\u201d tolerances of what is measured.

The Chaos Toolkit uses the Steady State Hypothesis for two purposes. It is used as a check before an experiment is run that the target system is in a recognised normal state. It is also used as the template for comparison of the state of your system after the experiment has been run, forming the results provided by the experiment\u2019s report.

"},{"location":"reference/concepts/#method","title":"Method","text":"

An experiment\u2019s activities are contained within its Method block.

"},{"location":"reference/concepts/#probes","title":"Probes","text":"

A probe is a way of observing a particular set of conditions in the system that is undergoing experimentation.

"},{"location":"reference/concepts/#actions","title":"Actions","text":"

An action is a particular activity that needs to be enacted on the system under experimentation.

"},{"location":"reference/concepts/#rollbacks","title":"Rollbacks","text":"

An experiment may define a sequence of actions that revert what was undone during the experiment.

"},{"location":"reference/concepts/#controls","title":"Controls","text":"

An experiment may declare a set of controls which have an impact over the execution of the experiment itself. Controls are operational elements rather than experimental.

"},{"location":"reference/contributing/","title":"Contributing to the Chaos Toolkit","text":"

The Chaos Toolkit is a free and open source tool and a community-driven set of projects. The community\u2019s input is what makes this project special and a success.

Your input could take the form of raising issues, voting for issues, starring projects, joining us on our community Slack team, submitting pull requests, or even suggesting whole new extension projects.

Whatever you can contribute, we\u2019re listening and want you to help us drive the project forward.

"},{"location":"reference/contributing/#the-chaos-toolkit-incubator","title":"The Chaos Toolkit Incubator","text":"

New potential projects should be first incubated in the Chaos Toolkit Incubator until they are ready to be moved into the main Chaos Toolkit suite of projects. Conditions for graduating a project from the Incubator to the main suite of projects include:

"},{"location":"reference/contributing/#how-to-submit-your-own-project-to-the-incubator","title":"How to submit your own project to the incubator?","text":"

The incubator is a place for community projects to be collected. If you think your extension makes sense as a community project, please don\u2019t hesitate to suggest it. The best place to start is on the community Slack team to announce it.

Generally speaking, you should consider the followings:

Notice also that we deal with contributors on a repository basis. Collaborators are external contributors with little permissions to the org and write permissions to the repositories they contribute to. We suggest that accounts should have 2FA enabled. This reduces the security surface risks in case a contributor account is breached.

"},{"location":"reference/contributing/#licensing-and-certification-of-origin","title":"Licensing and Certification of Origin","text":"

Every project in the Chaos Toolkit and the Chaos Toolkit Incubator is licensed under the Apache License, Version 2.0 and abides by the Developer Certificate of Origin on all accepted commits to the master branch.

"},{"location":"reference/tutorial/","title":"Getting Started with the Chaos Toolkit","text":"

When you practice chaos engineering, you are discovering how your system reacts following certain conditions you inject. By doing this in a controlled fashion, you may learn how to change the system accordingly.

This tutorial will quickly give you a tour of the basic elements of an experiment.

Tip

You will find many more in-depth labs on GitHub.

"},{"location":"reference/tutorial/#get-ready","title":"Get Ready","text":"

Before you can run the experiment against your system, you will need to have it setup.

"},{"location":"reference/tutorial/#get-the-code","title":"Get the Code","text":"

You can fetch the code as follows:

git clone https://github.com/chaostoolkit/chaostoolkit-documentation-code\n

This particular tutorial is under tutorials/a-simple-walkthrough.

cd chaostoolkit-documentation-code/tutorials/a-simple-walkthrough\n
"},{"location":"reference/tutorial/#third-party-binaries","title":"Third-party binaries","text":"

The experiment will use the following binaries, make sure you have them in your PATH:

"},{"location":"reference/tutorial/#install-the-application-dependencies","title":"Install the Application dependencies","text":"

Our application is made of a simple set of two microservices that converse with each other over HTTPS.

Tip

It\u2019s recommended that you use a Python virtual environment to keep your project dependencies isolated from any other projects.

As you should already run Python 3 for the toolkit itself, we assume you are set accordingly, please install only the application dependencies:

pip install -U -r requirements.txt\n
"},{"location":"reference/tutorial/#install-the-chaos-toolkit","title":"Install the Chaos Toolkit","text":"

You must install the Chaos Toolkit and its dependencies for the purpose of this tutorial. While we suggest you go through the install section, it boils down to:

pip install -U chaostoolkit\n
"},{"location":"reference/tutorial/#your-first-experiment","title":"Your First Experiment","text":""},{"location":"reference/tutorial/#explore-a-potential-weakness","title":"Explore a Potential Weakness","text":"

So, looking at our application, what could we consider as of interest to discover through an experiment? Well, we are using HTTPS between the two services in our application, what if the certificate expired?

Tip

In such a simple setup, we appreciate that things will likely break and, in general there is no point to run an experiment when you already know the outcome. However, let\u2019s humor ourselves for the sake of learning the basics behind the Chaos Toolkit.

We can intuit things will fall apart if the sunset service cannot talk the astre service but, should the chain be part of much more complex graph of services, it could be difficult to fully understand all the branches that would be affected nor how badly. So, it may still be useful to experiment by injecting an expired certificate.

"},{"location":"reference/tutorial/#define-the-steady-state-hypothesis","title":"Define the Steady State Hypothesis","text":"

You can only learn if you know where you start from and what a good baseline for your application is.

Here we assume two things:

During our experiment, we will vary the conditions of the system and expect the state to remain valid.

"},{"location":"reference/tutorial/#changing-the-conditions","title":"Changing the Conditions","text":"

In this tutorial, we are going to set an expired certificate and restart the services. We will then call our application and see how it responds.

"},{"location":"reference/tutorial/#declare-an-experiment-to-observe-the-weakness","title":"Declare an Experiment to Observe the Weakness","text":"

At this stage, we can create an experiment that tells how the system behaves when a certificate expires.

JSON

```json { \u201ctitle\u201d: \u201cWhat is the impact of an expired certificate on our application chain?\u201d, \u201cdescription\u201d: \u201cIf a certificate expires, we should gracefully deal with the issue.\u201d, \u201ctags\u201d: [\u201ctls\u201d], \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cApplication responds\u201d, \u201cprobes\u201d: [ { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cthe-astre-service-must-be-running\u201d, \u201ctolerance\u201d: true, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cos.path\u201d, \u201cfunc\u201d: \u201cexists\u201d, \u201carguments\u201d: { \u201cpath\u201d: \u201castre.pid\u201d } } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cthe-sunset-service-must-be-running\u201d, \u201ctolerance\u201d: true, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cos.path\u201d, \u201cfunc\u201d: \u201cexists\u201d, \u201carguments\u201d: { \u201cpath\u201d: \u201csunset.pid\u201d } } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cwe-can-request-sunset\u201d, \u201ctolerance\u201d: 200, \u201cprovider\u201d: { \u201ctype\u201d: \u201chttp\u201d, \u201ctimeout\u201d: 3, \u201cverify_tls\u201d: false, \u201curl\u201d: \u201chttps://localhost:8443/city/Paris\u201d } } ] }, \u201cmethod\u201d: [ { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cswap-to-expired-cert\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201ccp\u201d, \u201carguments\u201d: \u201cexpired-cert.pem cert.pem\u201d } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cread-tls-cert-expiry-date\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201copenssl\u201d, \u201carguments\u201d: \u201cx509 -enddate -noout -in cert.pem\u201d } }, { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201crestart-astre-service-to-pick-up-certificate\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201cpkill\u201d, \u201carguments\u201d: \u201c\u2013echo -HUP -F astre.pid\u201d } }, { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201crestart-sunset-service-to-pick-up-certificate\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201cpkill\u201d, \u201carguments\u201d: \u201c\u2013echo -HUP -F sunset.pid\u201d }, \u201cpauses\u201d: { \u201cafter\u201d: 1 } } ], \u201crollbacks\u201d: [ { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cswap-to-valid-cert\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201ccp\u201d, \u201carguments\u201d: \u201cvalid-cert.pem cert.pem\u201d } }, { \u201cref\u201d: \u201crestart-astre-service-to-pick-up-certificate\u201d }, { \u201cref\u201d: \u201crestart-sunset-service-to-pick-up-certificate\u201d } ]

} ```

YAML

title: What is the impact of an expired certificate on our application chain? description: If a certificate expires, we should gracefully deal with the issue. tags: - tls steady-state-hypothesis: title: Application responds probes: - type: probe name: the-astre-service-must-be-running tolerance: true provider: type: python module: os.path func: exists arguments: path: astre.pid - type: probe name: the-sunset-service-must-be-running tolerance: true provider: type: python module: os.path func: exists arguments: path: sunset.pid - type: probe name: we-can-request-sunset tolerance: 200 provider: type: http timeout: 3 verify_tls: false url: https://localhost:8443/city/Paris method: - type: action name: swap-to-expired-cert provider: type: process path: cp arguments: expired-cert.pem cert.pem - type: probe name: read-tls-cert-expiry-date provider: type: process path: openssl arguments: x509 -enddate -noout -in cert.pem - type: action name: restart-astre-service-to-pick-up-certificate provider: type: process path: pkill arguments: \u201c\u2013echo -HUP -F astre.pid\u201d - type: action name: restart-sunset-service-to-pick-up-certificate provider: type: process path: pkill arguments: \u201c\u2013echo -HUP -F sunset.pid\u201d pauses: after: 1 rollbacks: - type: action name: swap-to-valid-cert provider: type: process path: cp arguments: valid-cert.pem cert.pem - ref: restart-astre-service-to-pick-up-certificate - ref: restart-sunset-service-to-pick-up-certificate ```

"},{"location":"reference/tutorial/#yaml","title":"```yaml","text":""},{"location":"reference/tutorial/#the-various-sections-of-an-experiment","title":"The Various Sections of an Experiment","text":"

Let\u2019s now go through the experiment blocks.

The steady state hypothesis declares the various probes that will be applied as part of the hypothesis check.

The hypothesis is played twice. The first time before we do anything else to ensure the system is indeed in a normal state, here we check the services are running by looking up their PID files and we call the sunset service which should respond OK. The second time the hypothesis is applied is after the conditions were changed in the system, to validate it is still in a normal state.

The method is the block which changes the conditions of our system/application. Here, we swap the valid certificate for an expired one and restart the services by sending them a SIGHUP signal.

Finally, the rollback section (which is optional) tries to remediate to the changes we made, in this case by swapping back to the valid certificate.

"},{"location":"reference/tutorial/#different-kinds-of-activities","title":"Different Kinds of Activities","text":"

It is interesting to notice that the hypothesis uses probes while rollbacks are made of actions only. The method may use both. The reason is that the hypothesis is only about querying the system while rollbacks act on it. Finally, it is often useful to query the system while we change the conditions, for future analysis.

Probes and Actions are activities that do not differ in the way they work, it\u2019s only their goal that differs.

You can create activities that make HTTP calls, execute processes or perform more complex operations through extensions (often implemented in Python). This tutorial showcases a bit of all of those.

"},{"location":"reference/tutorial/#tolerances-in-the-hypothesis","title":"Tolerances in the Hypothesis","text":"

Hypothesis probes expect a tolerance property which tells the Chaos Toolkit how to validate a certain aspect of the state. In our example, tolerances are rather simple. We check file exists and that a HTTP request returns a status code of 200. Richer tolerances can be created by using regex or jsonpath.

"},{"location":"reference/tutorial/#run-the-experiment","title":"Run the Experiment","text":""},{"location":"reference/tutorial/#start-the-experiment-without-the-application","title":"Start the Experiment without the Application","text":"

To run the experiment, simply execute the following command:

chaos run experiment.json\n
[2018-05-14 18:38:04 INFO] Validating the experiment's syntax\n[2018-05-14 18:38:04 INFO] Experiment looks valid\n[2018-05-14 18:38:04 INFO] Running experiment: What is the impact of an expired certificate on our application chain?\n[2018-05-14 18:38:04 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:38:04 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:38:04 CRITICAL] Steady state probe 'the-astre-service-must-be-running' is not in the given tolerance so failing this experiment\n[2018-05-14 18:38:04 INFO] Let's rollback...\n[2018-05-14 18:38:04 INFO] Rollback: swap-to-valid-cert\n[2018-05-14 18:38:04 INFO] Action: swap-to-valid-cert\n[2018-05-14 18:38:04 INFO] Rollback: None\n[2018-05-14 18:38:04 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:38:04 INFO] Rollback: None\n[2018-05-14 18:38:04 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:38:04 INFO] Pausing after activity for 1s...\n[2018-05-14 18:38:05 INFO] Experiment ended with status: failed\n

Because we ran this command before we even started our application, our steady-state hypothesis failed and bailed the experiment immediately.

Note that the rollbacks will run anyway. They are only bypassed when you send a SIGINT or SIGTERM signal to the chaos process because the toolkit assumes you may want to review your system.

"},{"location":"reference/tutorial/#start-the-application","title":"Start the Application","text":"

You may now run the application.

First, copy the valid certificate as follows:

cp valid-cert.pem cert.pem\n

Next, start the services, in one terminal:

python3 astre.py\n

[14/May/2018:16:11:09] ENGINE Listening for SIGTERM.\n[14/May/2018:16:11:09] ENGINE Listening for SIGHUP.\n[14/May/2018:16:11:09] ENGINE Listening for SIGUSR1.\n[14/May/2018:16:11:09] ENGINE Bus STARTING\n[14/May/2018:16:11:09] ENGINE Serving on https://127.0.0.1:8444\n[14/May/2018:16:11:09] ENGINE Bus STARTE\n
Then, in another terminal:

python3 sunset.py\n
[14/May/2018:16:13:58] ENGINE Listening for SIGTERM.\n[14/May/2018:16:13:58] ENGINE Listening for SIGHUP.\n[14/May/2018:16:13:58] ENGINE Listening for SIGUSR1.\n[14/May/2018:16:13:58] ENGINE Bus STARTING\n[14/May/2018:16:13:58] ENGINE Serving on https://127.0.0.1:8443\n[14/May/2018:16:13:58] ENGINE Bus STARTED\n

Now you may perform a simple call:

curl -k https://localhost:8443/city/Paris\n
The sunset will occur at 2018-05-14T21:23:09+02:00 in Paris\n

What happens is that the sunset service performs a call to the astre service for the data and simply render them to you, as plain text. Both services are chained together over HTTPS.

"},{"location":"reference/tutorial/#run-the-experiment_1","title":"Run the Experiment","text":"

Now your application is running, execute the experiment once again:

chaos run experiment.json\n
[2018-05-14 18:41:09 INFO] Validating the experiment's syntax\n[2018-05-14 18:41:09 INFO] Experiment looks valid\n[2018-05-14 18:41:09 INFO] Running experiment: What is the impact of an expired certificate on our application chain?\n[2018-05-14 18:41:09 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:41:09 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:41:09 INFO] Probe: the-sunset-service-must-be-running\n[2018-05-14 18:41:09 INFO] Probe: we-can-request-sunset\n[2018-05-14 18:41:09 INFO] Steady state hypothesis is met!\n[2018-05-14 18:41:09 INFO] Action: swap-to-expired-cert\n[2018-05-14 18:41:09 INFO] Probe: read-tls-cert-expiry-date\n[2018-05-14 18:41:09 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:41:09 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:41:09 INFO] Pausing after activity for 1s...\n[2018-05-14 18:41:10 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:41:10 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:41:10 INFO] Probe: the-sunset-service-must-be-running\n[2018-05-14 18:41:10 INFO] Probe: we-can-request-sunset\n[2018-05-14 18:41:10 CRITICAL] Steady state probe 'we-can-request-sunset' is not in the given tolerance so failing this experiment\n[2018-05-14 18:41:10 INFO] Let's rollback...\n[2018-05-14 18:41:10 INFO] Rollback: swap-to-valid-cert\n[2018-05-14 18:41:10 INFO] Action: swap-to-valid-cert\n[2018-05-14 18:41:10 INFO] Rollback: None\n[2018-05-14 18:41:10 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:41:10 INFO] Rollback: None\n[2018-05-14 18:41:10 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:41:10 INFO] Pausing after activity for 1s...\n[2018-05-14 18:41:11 INFO] Experiment ended with status: failed\n

Each activity is run in the order it appears in the experiment. Notice now how the hypothesis is not met after we swapped the certificates. But, we learn something interesting, even if expected, using an expired certificate does not prevent our services to even start.

"},{"location":"reference/tutorial/#report-on-your-findings","title":"Report on your Findings","text":""},{"location":"reference/tutorial/#review-the-journal-of-the-run","title":"Review the Journal of the Run","text":"

You may now review the journal generated by the run:

cat journal.json\n

It contains the activities runs and the output of each of them.

"},{"location":"reference/tutorial/#generate-a-report","title":"Generate a Report","text":"

You can generate a PDF (or HTML, markdown\u2026) report from the journal if you install the chaostoolkit-reporting plugin first:

chaos report --export-format=pdf journal.json report.pdf\n
"},{"location":"reference/tutorial/#learnings-and-responses","title":"Learnings and Responses","text":"

In this experiment, we proved what we guessed initially, that an expired certificate will create trouble and break the application for our users. What could be the responses?

For each of these potential responses, you could create an experiment should they unearth potential new questions.

"},{"location":"reference/tutorial/#next","title":"Next?","text":"

An experiment is never the end game. The flow should be continuous and you should create and run experiments regularly.

"},{"location":"reference/walkthrough/","title":"Learning Chaos Toolkit by Practicing","text":"

You can find progressive labs here to help you use Chaos Toolkit in much more realistic settings than the base tutorials.

"},{"location":"reference/api/experiment/","title":"An Open API for Chaos Engineering Experiments","text":""},{"location":"reference/api/experiment/#introduction","title":"Introduction","text":"

The purpose of this specification is to formalize the elements of a Chaos Engineering experiment and offer a way to federate the community around a common syntax and semantic.

As a fairly recent field, Chaos Engineering is a dynamic and its foundations are still emerging. However, it appears certain concepts are settling down enough to start agreeing on a shared understanding.

This specification is not prescriptive and does not aim at forcing the community into one direction, rather it strives at providing a common vocabulary that new practitioners can easily make sense of.

It is necessary to appreciate that this document does not specify what tools, such as the Chaos Monkey or similar, should look like. Instead, this document specifies how Chaos Engineering Experiment could be described, shared and conducted collaboratively.

"},{"location":"reference/api/experiment/#conventions-used-in-this-document","title":"Conventions Used in This Document","text":"

The key words \u201cMUST\u201d, \u201cMUST NOT\u201d, \u201cREQUIRED\u201d, \u201cSHALL\u201d, \u201cSHALL NOT\u201d, \u201cSHOULD\u201d, \u201cSHOULD NOT\u201d, \u201cRECOMMENDED\u201d, \u201cMAY\u201d, and \u201cOPTIONAL\u201d in this document are to be interpreted as described in RFC 2119.

The terms \u201cJSON\u201d, \u201cJSON text\u201d, \u201cJSON value\u201d, \u201cmember\u201d, \u201celement\u201d, \u201cobject\u201d, \u201carray\u201d, \u201cnumber\u201d, \u201cstring\u201d, \u201cboolean\u201d, \u201ctrue\u201d, \u201cfalse\u201d, and \u201cnull\u201d in this document are to be interpreted as defined in RFC 7159.

"},{"location":"reference/api/experiment/#other-formats","title":"Other formats","text":"

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

"},{"location":"reference/api/experiment/#chaos-engineering-elements","title":"Chaos Engineering Elements","text":""},{"location":"reference/api/experiment/#overview","title":"Overview","text":"

An Experiment is one possible description of the principles of the Chaos Engineering. The intention of such a description is to provide shared understanding around a hypothesis on how to discover system\u2019s behavior under certain conditions.

An Experiment declares a steady state hypothesis, alongside probes to validate this steady state is met, and a method as a sequence actions and probes, to interact and query the system respectively.

By using a variety of probes, experiments should gather information to sense behaviors in the system, potentially leading to systemic patterns that can be stabilized.

"},{"location":"reference/api/experiment/#experiment","title":"Experiment","text":"

A Chaos Engineering experiment, or simply an experiment, describes both the elements and the order in which they should be applied.

An experiment is a JSON object.

An experiment MUST declare:

The experiment\u2019s title and description are meant for humans and therefore should be as descriptive as possible to clarify the experiment\u2019s rationale.

Title and description are JSON strings with no maximum length.

An experiment SHOULD also declare:

An experiment MAY finally declare:

Tags provide a way of categorizing experiments. It is a sequence of JSON strings.

Extensions define opaque payloads for vendors to carry valuable information.

Contribution describes valuable properties of the target system, such as \u201creliability\u201d or \u201cdurability\u201d, that an experiment contribute to. This information can be aggregated together with other experiments\u2019 contributions to better appreciate where the focus is put and where it is not.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#steady-state-hypothesis","title":"Steady State Hypothesis","text":"

The Steady State Hypothesis element describes what normal looks like in your system before the Method element is applied. If the steady state is not met, the Method element is not applied and the experiment MUST bail out.

The Steady State Hypothesis element is a JSON object.

Steady State Hypothesis element MUST declare:

The title is meant for humans and therefore should clarify the rationale for this hypothesis.

Each Probe MUST define a tolerance property that acting as a gate mechanism for the experiment to carry on or bail. Any Probe that does not fall into the tolerance zone MUST fail the experiment.

Steady State Hypothesis element MAY declare:

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#steady-state-probe-tolerance","title":"Steady State Probe Tolerance","text":"

Probes of the Steady State Hypothesis MUST declare an additional property named tolerance.

The tolerance property\u2019s value MUST be one of:

In the case of a scalar or the sequence, the tolerance validation MUST be strict. The value returned by the Probe MUST be checked against the scalar value. The experiment MUST bail when both fail to match.

When the tolerance is a sequence. If it has only two values, those two values represent a lower and upper bound within which the Probe returned value must fall (inclusive).

When the sequence has more than two elements, the Probe returned value must be contained in that sequence.

When the tolerance is an object, it MUST have a type property which MUST be one of the followings: \"probe\", \"regex\", \"jsonpath\" or \"range\".

When the type property is \"probe\", the object MUST be a Probe that is applied. The probe should take two arguments, value and secrets where the value is the Probe returned value and secrets a Secret object or null. Its returned status MUST be successful for the tolerance to be considered valid.

When the type property is \"regex\", the object MUST have a pattern property which MUST be a valid regular expression. The tolerance succeeds if the Probe returned value is matched against the pattern. Object MAY have a target property which MUST be a valid value returned for a given provider.

When the type property is \"jsonpath\", the object MUST have a path property which MUST be a valid JSON Path. In addition, the object MAY have a expect property which is used to compare each value matched by the JSON Path to that value. The expect property value MUST be a scalar. When the expect property is not present, the tolerance succeeds if the JSON Path matched at least one item.

When the type property is \"range\", the object MUST have a range property which MUST be a sequence of length two. The first entry of the sequence MUST be the lower bound and the second entry MUST be the upper bound. Both entries MUST be JSON numbers.

In addition, when the Probe returned value is an object with a status property, the tested value is the value of that property.

Some examples of tolerance properties.

A boolean tolerance:

JSONYAML
\"tolerance\": true\n
tolerance: true\n

A integer tolerance:

JSONYAML
\"tolerance\": 8\n
tolerance: 8\n

A string tolerance:

JSONYAML
\"tolerance\": \"OK\"\n
tolerance: \"OK\"\n

A sequence tolerance with lower and upper bounds:

JSONYAML
\"tolerance\": [4, 9]\n
tolerance:\n- 4\n- 9\n

A sequence tolerance, the value must be contained in that sequence:

JSONYAML
\"tolerance\": [4, 9, 78]\n
tolerance:\n- 4\n- 9\n- 78\n

A Probe tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"should-exist\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n}\n}\n
tolerance:\ntype: probe\nname: should-exist\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: some/file\n

A regex tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"regex\",\n\"pattern\": \"[0-9]{3}\"\n}\n
tolerance:\ntype: regex\npattern: '[0-9]{3}'\n

A regex tolerance with a non default target:

JSONYAML
\"tolerance\": {\n\"type\": \"regex\",\n\"target\": \"stdout\",\n\"pattern\": \"[0-9]{2}\"\n}\n
tolerance:\ntype: regex\ntarget: stdout\npattern: '[0-9]{2}'\n

A jsonpath tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"foo[*].baz\"\n}\n
tolerance:\ntype: jsonpath\npath: 'foo[*].baz'\n

A jsonpath tolerance with an expected value to match:

JSONYAML
\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"foo[*].baz\",\n\"expect\": 4\n}\n
tolerance:\ntype: jsonpath\npath: 'foo[*].baz'\nexpect: 4\n

Two range tolerances:

JSONYAMLJSONYAML
\"tolerance\": {\n\"type\": \"range\",\n\"range\": [4, 8]\n}\n
tolerance:\ntype: range\nrange:\n- 4\n- 8\n
\"tolerance\": {\n\"type\": \"range\",\n\"range\": [4.6, 8.9]\n}\n
tolerance:\ntype: range\nrange:\n- 4.6\n- 8.9\n
"},{"location":"reference/api/experiment/#contributions","title":"Contributions","text":"

Contributions describe the valuable system properties an experiment targets as well as how much they contributes to it. Those properties usually refer to aspects stakeholders care about. Aggregated they offer a powerful metric about the effort and focus on building confidence across the system.

Contributions are declared under the top-level contributions property as an object. Properties of that object MUST be JSON strings representing the name of a contribution. The values MUST be the weight of a given contribution and MUST be one of \"high\", \"medium\", \"low\" or \"none\". The \"none\" value is not the same as a missing contribution from the contributions object. That value marks explicitly that a given contribution is not addressed by an experiment. A missing contribution means impact via this experiment is unknown for this contribution.

Here is a contribution example:

JSONYAML
\"contributions\": {  \"reliability\": \"high\",\n\"security\": \"none\",\n\"scalability\": \"medium\"\n}\n
contributions:\nreliability: high\nsecurity: none\nscalability: medium\n

This sample tells us that the experiment contributes mainly to exploring reliability of the system and moderately to its scalability. However, it is explicit here this experiment does not address security.

On the other hand:

JSONYAML
\"contributions\": {  \"reliability\": \"high\",\n\"scalability\": \"medium\"\n}\n
contributions:\nreliability: high\nscalability: medium\n

This tells us the same about reliability and scalability but we can\u2019t presume anything about security.

"},{"location":"reference/api/experiment/#method","title":"Method","text":"

The Method describes the sequence of Probe and Action elements to apply. The Method is declared under method property at the top-level of the experiment.

The method MAY have at least one element which can be either a Probe or an Action.

The elements MUST be applied in the order they are declared.

An empty method is allowed for running experiments with Steady States Hypothesis only.

"},{"location":"reference/api/experiment/#probe","title":"Probe","text":"

A Probe collects information from the system during the experiment.

A Probe is a JSON object. A Probe is declared fully or reference another Probe through the ref property.

When declared fully, a Probe MUST declare:

The type property MUST be the JSON string \"probe\".

The name property is a free-form JSON string that MAY be considered as an identifier within the experiment.

It MAY also declare:

The configuration property MUST be a JSON string referencing an identifier declared in the top-level configuration property. It is assumed that when not declared, the Probe requires no configuration.

The background property MUST be a JSON boolean value either true or false. It is assumed that, when that property is not declared, it is set to false. When that property is set to true it indicates the Probe MUST not block and the next Action or Probe should immediately be applied.

When a Probe references another Probe in the Experiment, the Probe MUST declare a single property called ref.

The ref property MUST be a JSON string which MUST be the name of a declared Probe.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#action","title":"Action","text":"

An Action performs an operation against the system.

An Action collects information from the system during the experiment.

An Action is a JSON object. An Action is declared fully or reference another Action through the ref property.

When declared fully, a Action MUST declare:

The type property MUST be the JSON string \"action\".

The name property is a free-form JSON string that MAY be considered as an identifier within the experiment.

It MAY also declare:

The configuration property MUST be a JSON string referencing an identifier declared in the top-level configuration property. It is assumed that when not declared, the Action requires no configuration.

The background property MUST be a JSON boolean value either true or false. It is assumed that, when that property is not declared, it is set to false. When that property is set to true it indicates the Action MUST not block and the next Action or Probe should immediately be applied.

The pauses property MUST be a JSON object which MAY have one or the two following properties:

In both cases, the value MUST be JSON number indicating the number of seconds to wait before continuing. The before pause MUST be performed before the Action while the after MUST be performed afterwards.

When a Action references another Action in the Experiment, the Action MUST declare a single property called ref.

The ref property MUST be a JSON string which MUST be the name of a declared Action.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#action-or-probe-provider","title":"Action or Probe Provider","text":"

A provider MUST be a JSON object which MUST declare a type property that decides the other expected properties.

The type property MUST be one of \"python\", \"http\" or \"process\".

Info

This specification only mentions those three providers but it could grow to support more, such as \"go\", \"rust\" or \"grpc\"\u2026

"},{"location":"reference/api/experiment/#python-provider","title":"Python Provider","text":"

A Python Provider declares a Python function to be applied.

A Python Provider MUST declare the following:

It SHOULD also declare an arguments property when the function expects them.

The module property is the fully qualified module exposing the function. It MUST be a JSON string.

The func property is the name of the function to apply. It MUST be a JSON string.

When provided, the arguments property MUST be a JSON object which properties are the names of the function\u2019s arguments. When a function\u2019s signature has default values for some of its arguments, those MAY be omitted from the arguments object. In that case, those default values will be used.

Argument values MUST be valid JSON entities.

In addition, the provider object MAY declare a secrets property. This secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

"},{"location":"reference/api/experiment/#http-provider","title":"HTTP Provider","text":"

A HTTP Provider declares a URL to be called.

A HTTP Provider MUST declare the following:

The url property MUST be a JSON string representing a URL as per RFC 3986.

In addition, the provider object MAY declare any of the followings:

The method property MUST be a JSON string, such as \"POST\", as per RFC 7231. It defaults to \"GET\".

The headers property MUST be a JSON object which properties are header names and values are header values, as per RFC 7231.

When provided, the arguments property MUST be a JSON object which properties are parameters of the HTTP request.

When method is \"GET\", the arguments are mapped as a query-string of the URL. Otherwise, the arguments are passed as the request body\u2019s data and the encoding depends on the \"Content-Type\" provided in the headers object.

The timeout property MUST be either a JSON number specifying how long the request should take to complete. Or a JSON array that MUST made of two JSON numbers, the first one indicating the connection timeout, the second the request timeout to respond.

The secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

The HTTP provider MUST return an object with the following properties:

"},{"location":"reference/api/experiment/#process-provider","title":"Process Provider","text":"

A Process Provider declares a process to be called.

A Process Provider MUST declare the following:

The path property MUST be a JSON string of a path to an executable.

In addition, the provider object MAY declare any of the followings:

The arguments property MUST be a JSON array or a JSON string which defines the process arguments. Those arguments are passed in order to the process arguments.

The timeout property MUST be a JSON number specifying how long the process should take to complete.

The secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

The Process provider MUST return an object with the following properties:

"},{"location":"reference/api/experiment/#rollbacks","title":"Rollbacks","text":"

Rollbacks declare the sequence of actions that attempt to put the system back to its initial state.

The experiment MAY declare a single rollbacks property which is a JSON array consisting of Actions.

A failed rollback MUST not bail the sequence of rollbacks.

"},{"location":"reference/api/experiment/#secrets","title":"Secrets","text":"

Secrets declare values that need to be passed on to Actions or Probes in a secure manner.

The secrets property MUST be a JSON object. Its properties are identifiers referenced by Actions and Probes.

The value of each identifier is a JSON object which properties are the secrets keys and the properties values are the secrets values.

Referenced secrets MUST be injected into probes and actions when they are applied. Probes and actions MUST NOT modify the secrets.

Secrets MUST be passed a mapping of keys and values to probes and actions.

An example of a secrets element at the top-level:

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": \"XYZ\"\n}\n}\n}\n
secrets:\nkubernetes:\ntoken: XYZ\n

This can then referenced from probes or actions:

JSONYAML
{\n\"type\": \"probe\",\n\"secrets\": \"kubernetes\"\n}\n
type: probe\nsecrets: kubernetes\n
"},{"location":"reference/api/experiment/#inline-secrets","title":"Inline Secrets","text":"

Secrets MAY be inlined in the Experiment directly.

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": \"ABCDEF-1234-XYZ\"\n}\n}\n}\n
secrets:\nkubernetes:\ntoken: ABCDEF-1234-XYZ\n
"},{"location":"reference/api/experiment/#environment-secrets","title":"Environment Secrets","text":"

Secrets MAY be retrieved from the environment. In that case, they must be declared as a JSON object with a type property set to \"env\". The environment variable MUST be declared in the key property as a JSON string.

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"KUBERNETES_TOKEN\"\n}\n}\n}\n}\n
secrets:\nkubernetes:\ntoken:\ntype: env\nkey: KUBERNETES_TOKEN\n
"},{"location":"reference/api/experiment/#vault-secrets","title":"Vault Secrets","text":"

Secrets MAY be retrieved from a HashiCorp vault instance. In that case, they must be declared as a JSON object with a type property set to \"vault\". The path to the key MUST be declared in the path property as a JSON string.

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\n

When only the path property is set, the whole secrets payload at the given path MUST be set to the Chaos Toolkit secret key.

A key property MAY be set to select a specific value from the Vault secret payload.

The Vault url MUST be provided in the Configuration section via the \"vault_addr\" property.

Vault authentication MUST at least support:

The Vault KV secrets version MAY be provided via the \"vault_kv_version\" Configuration key. If not provided, it MUST default to \"2\".

Examples:

Vault secret at path secret/something:

JSONYAML
{\n\"foo\": \"bar\",\n\"baz\": \"hello\"\n}\n
foo: bar\nbaz: hello\n

Then in your Chaos Toolkit experiment:

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\n

means the secrets will become:

JSONYAML
\"token\": {\n\"foo\": \"bar\",\n\"baz\": \"hello\"\n}\n
token:\nfoo: bar\nbaz: hello\n

However:

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\",\n\"key\": \"foo\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\nkey: foo\n

means the secrets will become:

JSONYAML
\"token\": \"bar\"\n
token: bar\n
"},{"location":"reference/api/experiment/#configuration","title":"Configuration","text":"

Configuration is meant to provide runtime values to actions and probes.

The configuration element MUST be a JSON object. The value of each property MUST be a JSON string, number, or object whose properties are considered the configuration lookup. Configuration must be passed to all Probes and actions requiring it. Probes and actions MUST NOT modify the configuration.

Configurations MUST be passed a mapping of keys and values to probes and actions.

An example of a configuration element at the top level:

JSONYAML
{\n\"configuration\": {\n\"some_service\": \"http://127.0.0.1:8080\",\n\"vault_addr\": {\n\"type\": \"env\",\n\"key\": \"VAULT_ADDR\"\n}\n}\n}\n
configuration:\nsome_service: 'http://127.0.0.1:8080'\nvault_addr:\ntype: env\nkey: VAULT_ADDR\n
"},{"location":"reference/api/experiment/#inline-configurations","title":"Inline Configurations","text":"

Configurations MAY be inlined in the Experiment directly.

JSONYAML
{\n\"configuration\": {\n\"some-service\": \"http://127.0.0.1:8080\"\n}\n}\n
configuration:\nsome-service: 'http://127.0.0.1:8080'\n
"},{"location":"reference/api/experiment/#environment-configurations","title":"Environment Configurations","text":"

Configurations MAY be retrieved from the environment. In that case, they must be declared as a JSON object with a type property set to \"env\". The environment variable MUST be declared in the key property as a JSON string.

The default key is OPTIONAL and MAY be used when the environment variable can be undefined and fallback to a default value for the experiment.

JSONYAML
{\n\"configuration\": {\n\"vault_addr\": {\n\"type\": \"env\",\n\"key\": \"VAULT_ADDR\",\n\"default\": \"https://127.0.0.1:8200\"\n}\n}\n}\n
configuration:\nvault_addr:\ntype: env\nkey: VAULT_ADDR\ndefault: 'https://127.0.0.1:8200'\n
"},{"location":"reference/api/experiment/#variable-substitution","title":"Variable Substitution","text":"

Probes and Actions argument values MAY be dynamically resolved at runtime.

Dynamic values MUST follow the syntax ${name} where name is an identifier declared in either the Configuration or Secrets sections. When name is declared in both sections, the Configuration section MUST take precedence.

Dynamic values MUST be substituted before being passed to Probes or Actions.

Other values, such as the HTTP Probe url, MAY be substituted as well.

"},{"location":"reference/api/experiment/#controls","title":"Controls","text":"

Controls describe out-of-band capabilities applied when the experiment is executed. Controls are used to declare operations that should be carried by external tools.

Controls MAY be declared at each of the following levels:

Controls MUST be applied before and after each of those levels. Schematically, this looks like this:

apply experiment control before experiment starts\nstart experiment\n    apply steady state control before steady-state probes are started\n        start steady-state processing\n            apply activity control before each probe is applied\n            run each probe\n            apply activity control after each probe is applied\n    apply steady state control after steady-state probes have completed\n    apply steady state control before method activities are started\n        start method processing\n            apply activity control before each activity is applied\n            run each activity\n            apply activity control after each activity is applied\n    apply steady state control after method activities have completed\n    apply steady state control before rollback activities are started\n        start rollback processing\n            apply activity control before each activity is applied\n            run each activity\n            apply activity control after each activity is applied\n    apply steady state control after rollback activities have completed\napply experiment control after experiment completes\n

Controls MAY be omitted anywhere and MUST NOT be applied at a level they are not declared.

Controls MUST NOT fail the experiment\u2019s execution due to unforeseen conditions.

Controls are declared with the controls property which is set to a JSON array.

Controls MAY modify Configuration and Secrets. In that case changes MUST be made visible to the experiment.

An item of that array MUST be a control, which is a JSON object which MUST have the following properties:

The provider object indicates which implementation of the control to use. It MUST declare the following properties:

A control object MAY also declare the following property:

The scope value MUST be one of \"before\" or \"after\". When the scope property is omitted, the control MUST be applied before and after. When the scope property is set, the control MUST be applied only on that scope.

When the automatic property is set to false, it MUST be understood that the control cannot be applied anywhere but where it is declared.

Examples of Controls:

Just a generic declaration of a control at the top-level of the experiment:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nprovider:\ntype: python\nmodule: chaostracing.control\n

Another control by applied only as post-control:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"scope\": \"post\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nscope: post\nprovider:\ntype: python\nmodule: chaostracing.control\n

Finally, a top-level level control not applied anywhere else down the tree:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"automatic\": false,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nautomatic: false\nprovider:\ntype: python\nmodule: chaostracing.control\n
"},{"location":"reference/api/experiment/#extensions","title":"Extensions","text":"

An Experiment MAY declare an extensions property which MUST be an array of objects. Each object MUST declare a non-empty name property.

Extensions are used in two scenarios:

In both cases, their actual usage is runtime dependent, this specification does not declare any meaning to an extension.

Below is an example of an Extension:

JSONYAML
{\n\"extensions\": [{\n\"name\": \"vendorX\",\n\"data\": \"...\"\n}]\n}\n
extensions:\n- name: vendorX\ndata: ...\n
"},{"location":"reference/api/experiment/#examples","title":"Examples","text":"

The following examples MUST NOT be considered normative.

"},{"location":"reference/api/experiment/#minimal-experiment","title":"Minimal Experiment","text":"

Here is an example of the most minimal experiment:

JSONYAML
{\n\"title\": \"Moving a file from under our feet is forgivable\",\n\"description\": \"Our application should re-create a file that was removed\",\n\"contributions\": {\n\"reliability\": \"high\",\n\"availability\": \"high\"\n},\n\"steady-state-hypothesis\": {\n\"title\": \"The file must be around first\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"file-must-exist\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"file-be-gone\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os\",\n\"func\": \"remove\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n},\n{\n\"ref\": \"file-must-exist\"\n}\n]\n}\n
title: Moving a file from under our feet is forgivable\ndescription: Our application should re-create a file that was removed\ncontributions:\nreliability: high\navailability: high\nsteady-state-hypothesis:\ntitle: The file must be around first\nprobes:\n- type: probe\nname: file-must-exist\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: some/file\nmethod:\n- type: action\nname: file-be-gone\nprovider:\ntype: python\nmodule: os\nfunc: remove\narguments:\npath: some/file\npauses:\nafter: 5\n- ref: file-must-exist\n
"},{"location":"reference/api/experiment/#more-complex-experiment","title":"More Complex Experiment","text":"

Below is an example of a fully featured experiment that uses various extensions to perform actions, probing and steady-state hypothesis validation.

JSONYAML
{\n\"title\": \"Are our users impacted by the loss of a function?\",\n\"description\": \"While users query the Astre function, they should not be impacted if one instance goes down.\",\n\"contributions\": {\n\"reliability\": \"high\",\n\"availability\": \"high\",\n\"performance\": \"medium\",\n\"security\": \"none\"\n},\n\"tags\": [\n\"kubernetes\",\n\"openfaas\",\n\"cloudnative\"\n],\n\"configuration\": {\n\"prometheus_base_url\": \"http://demo.foo.bar\"\n},\n\"secrets\": {\n\"global\": {\n\"auth\": \"Basic XYZ\"\n}\n},\n\"controls\": [\n{\n\"name\": \"tracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n],\n\"steady-state-hypothesis\": {\n\"title\": \"Function is available\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"function-must-exist\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"secrets\": [\"global\"],\n\"url\": \"http://demo.foo.bar/system/function/astre\",\n\"headers\": {\n\"Authorization\": \"${auth}\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"function-must-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": [3, 5],\n\"secrets\": [\"global\"],\n\"url\": \"http://demo.foo.bar/function/astre\",\n\"method\": \"POST\",\n\"headers\": {\n\"Content-Type\": \"application/json\",\n\"Authorization\": \"${auth}\"\n},\n\"arguments\": {\n\"city\": \"Paris\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"simulate-user-traffic\",\n\"background\": true,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"vegeta\",\n\"arguments\": \"-cpus 2 attack -targets=data/scenario.txt -workers=2 -connections=1 -rate=3 -timeout=3s -duration=30s -output=result.bin\"\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"terminate-one-function\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"ns\": \"openfaas-fn\",\n\"label_selector\": \"faas_function=astre\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"before\": 5\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-openfaas-gateway-logs\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"read_pod_logs\",\n\"arguments\": {\n\"label_selector\": \"app=gateway\",\n\"last\": \"35s\",\n\"ns\": \"openfaas\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"query-total-function-invocation\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"secrets\": [\"global\"],\n\"arguments\": {\n\"query\": \"gateway_function_invocation_total{function_name='astre'}\",\n\"start\": \"1 minute ago\",\n\"end\": \"now\",\n\"step\": 1\n}\n}\n}\n],\n\"rollbacks\": []\n}\n
---\ntitle: Are our users impacted by the loss of a function?\ndescription: While users query the Astre function, they should not be impacted if one instance goes down.\ncontributions:\nreliability: high\navailability: high\nperformance: medium\nsecurity: none\ntags:\n- kubernetes\n- openfaas\n- cloudnative\nconfiguration:\nprometheus_base_url: http://demo.foo.bar\nsecrets:\nglobal:\nauth: Basic XYZ\ncontrols:\n- name: tracing\nprovider:\ntype: python\nmodule: chaostracing.control\nsteady-state-hypothesis:\ntitle: Function is available\nprobes:\n- type: probe\nname: function-must-exist\ntolerance: 200\nprovider:\ntype: http\nsecrets:\n- global\nurl: http://demo.foo.bar/system/function/astre\nheaders:\nAuthorization: \"${auth}\"\n- type: probe\nname: function-must-respond\ntolerance: 200\nprovider:\ntype: http\ntimeout:\n- 3\n- 5\nsecrets:\n- global\nurl: http://demo.foo.bar/function/astre\nmethod: POST\nheaders:\nContent-Type: application/json\nAuthorization: \"${auth}\"\narguments:\ncity: Paris\nmethod:\n- type: action\nname: simulate-user-traffic\nbackground: true\nprovider:\ntype: process\npath: vegeta\narguments: \"-cpus 2 attack -targets=data/scenario.txt -workers=2 -connections=1 -rate=3 -timeout=3s -duration=30s -output=result.bin\"\n- type: action\nname: terminate-one-function\nprovider:\ntype: python\nmodule: chaosk8s.pod.actions\nfunc: terminate_pods\narguments:\nns: openfaas-fn\nlabel_selector: faas_function=astre\nrand: true\npauses:\nbefore: 5\n- type: probe\nname: fetch-openfaas-gateway-logs\nprovider:\ntype: python\nmodule: chaosk8s.pod.probes\nfunc: read_pod_logs\narguments:\nlabel_selector: app=gateway\nlast: 35s\nns: openfaas\n- type: probe\nname: query-total-function-invocation\nprovider:\ntype: python\nmodule: chaosprometheus.probes\nfunc: query_interval\nsecrets:\n- global\narguments:\nquery: gateway_function_invocation_total{function_name='astre'}\nstart: 1 minute ago\nend: now\nstep: 1\nrollbacks: []\n
"},{"location":"reference/api/journal/","title":"Experiment Journal","text":""},{"location":"reference/api/journal/#introduction","title":"Introduction","text":"

This document describes the syntax and grammar of a Chaos Engineering experiment\u2019s output, called a journal. One should be able to walkthrough the experiment\u2019s run through its journal alone.

This specification makes sense in regards to the Experiment specification itself. It is indeed a mirror to that document.

"},{"location":"reference/api/journal/#conventions-used-in-this-document","title":"Conventions Used in This Document","text":"

The key words \u201cMUST\u201d, \u201cMUST NOT\u201d, \u201cREQUIRED\u201d, \u201cSHALL\u201d, \u201cSHALL NOT\u201d, \u201cSHOULD\u201d, \u201cSHOULD NOT\u201d, \u201cRECOMMENDED\u201d, \u201cMAY\u201d, and \u201cOPTIONAL\u201d in this document are to be interpreted as described in RFC 2119.

The terms \u201cJSON\u201d, \u201cJSON text\u201d, \u201cJSON value\u201d, \u201cmember\u201d, \u201celement\u201d, \u201cobject\u201d, \u201carray\u201d, \u201cnumber\u201d, \u201cstring\u201d, \u201cboolean\u201d, \u201ctrue\u201d, \u201cfalse\u201d, and \u201cnull\u201d in this document are to be interpreted as defined in RFC 7159.

"},{"location":"reference/api/journal/#other-formats","title":"Other formats","text":"

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

"},{"location":"reference/api/journal/#journal-elements","title":"Journal Elements","text":""},{"location":"reference/api/journal/#overview","title":"Overview","text":"

A Journal is one potential output of a Chaos Engineering experiment. The objective of such journal is to collect all events that took place during the experiment\u2019s run.

The journal contains static information, such as the experiment that was run, as well as runtime entries.

"},{"location":"reference/api/journal/#format","title":"Format","text":"

A journal is a JSON object.

"},{"location":"reference/api/journal/#required-properties","title":"Required Properties","text":"

A journal MUST declare:

The experiment property MUST be a copy of the run experiment as-is and is therefore a JSON object. It MUST follow the Experiment definition.

The \u0300status property MUST be a JSON string, one of:

Note

It is important to understand the \"completed\" status expresses that everything ran all the way. An action may not have resulted in what the operator wanted but it did not fail. Always review the entire journal to fully appreciate the actual outcome of the experiment.

There are two reasons it could be marked as \"failed\". Either a tolerance failed or if an extension made a check for a condition. So, for instance, let\u2019s say the extension made a HTTP call to your service, that call returned a 400 rather than 200. If the extension was not designed to care for this difference, then the status will be marked as \"completed\". However, if the extension validated the HTTP response, it may have decided to fail the action which would lead to a \u0300 \u201cfailed\u201d` status.

The \"aborted\" and \"interrupted\" are different, the former means of a crash somehow (say, because of a bug). The latter indicates a signal was received. Both MUST bail the entire process.

The deviated property MUST be a boolean flag that MUST be set to true when the steady-state was executed after the experimental method but reported that, at least, one of its probes failed to match the expected tolerance.

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

"},{"location":"reference/api/journal/#recommended-properties","title":"Recommended Properties","text":"

In addition to those required properties, the journal SHOULD also declare the followings:

The steady_states property MUST be a JSON object defining the result of the steady state hypothesis outcome.

The run property MUST be a JSON array defining the result of each activity in the method element of the experiment.

The rollbacks property MUST be a JSON array defining the result of each action in the rollbacks element of the experiment.

"},{"location":"reference/api/journal/#optional-properties","title":"Optional Properties","text":"

In addition to those required properties, the journal MAY also declare the followings:

The platform property MUST be a JSON string defining the machine on which the experiment was executed. The content is free form but may be similar to the output of the uname -a command.

The node property MUST be a JSON string representing the name of the machine where the experiment was run. The content is free form.

"},{"location":"reference/api/journal/#steady-state","title":"Steady State","text":"

The steady_states property holds the outcomes of the steady state hypothesis.

The steady_states property MAY declare the following properties:

The before property MUST be a JSON object describing the outcome of the hypothesis run before the method is executed.

The after property MUST be a JSON object describing the outcome of the hypothesis run after the method is executed.

Notice that either of those properties MAY be missing if they were not run.

"},{"location":"reference/api/journal/#steady-state-outcomes","title":"Steady State Outcomes","text":"

Both the before and after properties follow the same definition.

The steady_state_met property MUST be a JSON boolean. It MUST be true if the steady state hypothesis was met, false otherwise.

A steady state is met when all its probes matched their tolerance. A steady state is not met at the first non-matching tolerance probe.

The probes property MUST be a JSON array of probes results.

Each probe result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed probe.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The tolerance_met MUST be a JSON boolean indicating if the probe matched its tolerance or not.

The output MUST be a JSON string or null.

In addition, the probe result MAY contain an additional property:

This property is set when the probe failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

"},{"location":"reference/api/journal/#run","title":"Run","text":"

The run property holds the outcomes of the method element.

The run property MUST be a JSON array of activity results.

Each activity result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed probe or action.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

This property is set when the activity failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

"},{"location":"reference/api/journal/#rollbacks","title":"Rollbacks","text":"

The rollbacks property holds the outcomes of the rollbacks element.

The rollbacks property MUST be a JSON array of action results.

Each action result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed action.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

This property is set when the action failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks MUST NOT to be applied when the experiment status is \"interrupted\".

"},{"location":"reference/developing/core/","title":"Core Projects","text":"

The Chaos Toolkit is made of several projects that work together to provide its service.

"},{"location":"reference/developing/core/#chaostoolkit","title":"chaostoolkit","text":"

The chaostoolkit project is the command-line interface (CLI), in other words the command executed by users to run their experiments.

That project tries to remain as shallow as possible, only providing the user interface commands by gluing other projects together.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-lib","title":"chaostoolkit-lib","text":"

The chaostoolkit-lib project is the core library which implements the core concepts of the Chaos Toolkit.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-documentation","title":"chaostoolkit-documentation","text":"

The chaostoolkit-documentation is the documentation source and renderer of the Chaos Toolkit. Namely, that project generates the website you are currently reading.

This project is implemented in Python 3 by generating HTML from Markdown documents.

"},{"location":"reference/developing/core/#chaostoolkit-kubernetes","title":"chaostoolkit-kubernetes","text":"

The chaostoolkit-kubernetes project is the Kubernetes extension.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-addons","title":"chaostoolkit-addons","text":"

The chaostoolkit-addons project is a set of addons for Chaos Toolkit: useful controls, probes, actions and tolerances.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-reporting","title":"chaostoolkit-reporting","text":"

The chaostoolkit-reporting project is a plugin for Chaos Toolkit to create PDF/HTMl reports from executions.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-bundler","title":"chaostoolkit-bundler","text":"

The chaostoolkit-bundler project is a binary package of Chaos Toolkit and its most common extensions. In case you want a drop in Chaos Toolkit for your system.

This project is implemented in Python 3.

"},{"location":"reference/developing/extensions/","title":"Extension Projects","text":"

In addition to the core projects, the Chaos Toolkit manages some extension projects which provide probes and/or actions for experiments.

Extensions can be found on the incubator GitHub organisation.

"},{"location":"reference/developing/guidelines/","title":"Developer Guidelines","text":"

Contributors to the Chaos Toolkit are always welcome. This guide describes the general elements you probably need to know to get started. Once past those elements, you should dive into the code of each project and come discuss on our Slack.

"},{"location":"reference/developing/guidelines/#overview","title":"Overview","text":""},{"location":"reference/developing/guidelines/#programming-environment","title":"Programming Environment","text":"

The programming environment really is up to you. However, since the Chaos Toolkit is implemented in Python so make sure to have the right tooling for it.

The most basics are:

If you\u2019re not familiar with Python, you will find a few helpful books online, such The Hitchhiker\u2019s Guide to Python.

"},{"location":"reference/developing/guidelines/#the-ultimate-trick","title":"The Ultimate Trick","text":"

Whenever you code on one of the projects, you should run the following command so that the project you are hacking on is part of your virtual environment without being installed:

cd <project-name>\npython setup.py develop\n

Sometimes, your virtual env may be borked and not point to your development directory. In that case, make sure to remove any previously installed version of the project:

pip uninstall <project-name>\n

Then make sure your virtual environment point at your local directory with:

pip freeze\n
"},{"location":"reference/developing/guidelines/#github","title":"GitHub","text":"

The Chaos Toolkit projects are hosted on GitHub. If you wish to contribute, you will need to have an account there.

The general workflow is to fork the project you wish to contribute to, make your changes in a dedicated branch, rebase against the original master and finally submit a pull-request to the project with a clear description of the what and why.

"},{"location":"reference/developing/guidelines/#chaos-toolkit-projects-at-a-glance","title":"Chaos Toolkit Projects At A Glance","text":"

The Chaos Toolkit is made of several projects. The core ones are:

Basically, those projects represent the Chaos Toolkit itself. However, the toolkit is naked without extensions. The currently core extensions are:

In addition, there are a bunch of incubating projects.

"},{"location":"reference/developing/guidelines/#creating-an-extension","title":"Creating an Extension","text":"

Please review the various approaches to extend the toolkit.

"},{"location":"reference/developing/guidelines/#creating-a-notification-plugin","title":"Creating a Notification Plugin","text":"

The Chaos Toolkit triggers events while it runs. Those events may be forwarded to any endpoint that you care for through HTTP or, when you need more control, a full Python project.

There is no template for such a project yet but it is very close to an extension project except it doesn\u2019t have probes and actions. You can therefore start by cloning the extension template project and start from there.

Instead, it should define a function in a module. That function takes two parameters:

The event has a payload key which is the content associated to the event. It can be one of:

Three kind of events can be triggered: started, completed and failed for each phase of the flow. Those events are defined here.

A typical notification callback function will look like this:

from typing import Any, Dict\n\nfrom chaoslib.notification import RunFlowEvent\nfrom chaoslib.types import EventPayload\nimport logzero\n\ndef notify(settings: Dict[str, Any], event: EventPayload):\n    if event[\"name\"] == RunFlowEvent.RunStarted.value:\n        logzero.info(\"Event phase \" + event[\"phase\"])\n        logzero.info(\"Event timestamp \" + event[\"ts\"])\n        logzero.info(\"Event payload \" + event[\"payload\"])\n        logzero.info(\"Event error \" + event.get(\"error\", \"N/A\"))\n

logzero is a third-party package that the Chaos Toolkit uses to log when it runs.

"},{"location":"reference/developing/technologies/","title":"Technology Choices","text":""},{"location":"reference/developing/technologies/#python-3","title":"Python 3","text":"

The Chaos Toolkit is implemented in Python 3. A high-level language with a long successfully story for writing great software. It\u2019s a common choice for tooling purpose.

The language supports readability well and has a large ecosystem of libraries. It is also well-spread and easy to install. The choice to not support Python 2 is a look at Python\u2019s present and future.

The choice for a dynamic language was also motivated because the Chaos Toolkit manipulates a lot of strings and that task is made straightforward with Python.

Although Python natively does not generate (though it can be done) standalone binaries like golang would. We do not believe this will harm the project and hope that package managers will eventually provide native installers.

"},{"location":"reference/developing/technologies/#functional","title":"Functional","text":"

Well, this project is not truly a functional piece of code but the code relies as little as possible on stateful constructions as provided by classes.

Mutable data structures are used but mostly created and returned from functions rather than modified.

Generally speaking, the project draws inspirations from certain ideas of functional paradigms but does not enforce them strictly. One notable area where the code strays away from these principles is the use of exceptions rather than returning error codes. This may change if the community expresses such an intention.

"},{"location":"reference/developing/values/","title":"Key Project Values","text":"

The following key values of the Chaos Toolkit reflect the mindset the community has when engineering the Chaos Toolkit project. Refer to our Code of Conduct as well.

"},{"location":"reference/developing/values/#simplicity","title":"Simplicity","text":"

The Chaos Toolkit aims at being a simple piece of technology both from a user and developer perspective.

To achieve simplicity, the Chaos Toolkit comes as a command line interface driven by a description file. As a user, this means no code and no need to learn a programming language. As a developer, this reduces the functional surface area to consider.

"},{"location":"reference/developing/values/#extensibility","title":"Extensibility","text":"

The Chaos Toolkit does not wish to be a monolith and strives to be extended to fully reach its goal through community driven efforts.

By using a description file, the implementation is not prescribed by the Chaos Toolkit project. Although we fully expect the community to eventually settle on certain implementations of probes and actions.

"},{"location":"reference/developing/values/#readability","title":"Readability","text":"

We believe code readability is a factor for positive maintenance and evolutivity.

Readable code never goes out of fashion. As the code of the Chaos Toolkit is mostly written in Python, best practices such as defined in PEP8.

"},{"location":"reference/developing/values/#diversity","title":"Diversity","text":"

Although not strictly speaking referring to the technological aspect of the project, having diversity in the community will contribute to a better project overall.

"},{"location":"reference/extending/approaches/","title":"Extending the Chaos Toolkit","text":"

The Chaos Toolkit is designed to be extended with new probes and actions so that you can work with any failure injection and system observability systems that you choose. The toolkit has a growing number of open source extensions for just this purpose, but the intention is that you may also want to extend the Chaos Toolkit for your own unique, possible closed, systems as well.

The ChaosToolkit currently supports three extension approaches:

You can extend your actions and probes by implementing them using one of these approaches.

Tip

The Chaos Toolkit maintains a set of open-source extensions ready to be integrated into your Chaos experiments.

"},{"location":"reference/extending/create-control-extension/","title":"Create a Control Extension","text":"

A control extension implements the interface defined by the Chaos Toolkit to support the Controls element of the specification.

Controls are good for changing the experiment or its environment during execution. They have the power to impact the experiment, configuration, secrets on the fly, which is unlike probes and actions.

"},{"location":"reference/extending/create-control-extension/#controls-interface","title":"Controls Interface","text":"

When implementing a control module, you must simply define a set of functions that are called by the Chaos Toolkit when executing the experiment.

Tip

All of these functions are optional, only implement the one you need.

from typing import Any, Dict, List\n\nfrom chaoslib.types import Activity, Configuration, \\\n    Experiment, Hypothesis, Journal, Run, Secrets, Settings\n\n\ndef configure_control(configuration: Configuration = None,\n                      secrets: Secrets = None, settings: Settings = None,\n                      experiment: Experiment = None):\n\"\"\"\n    Configure the control's global state\n\n    This is called once only per Chaos Toolkit's run and should be used to\n    initialize any state your control may require.\n\n    The `settings` are only passed when the control is declared in the\n    settings file of the Chaos Toolkit.\n    \"\"\"\n    pass\n\n\ndef cleanup_control():\n\"\"\"\n    Cleanup the control's global state\n\n    Called once only during the experiment's execution.\n    \"\"\"\n    pass\n\n\ndef before_loading_experiment_control(context: str, **kwargs):\n\"\"\"\n    before loading the experiment from its source.\n\n    The context is the file path or URL given to the loader. Use this loader\n    if you want to interact with that source before it is loaded.\n    \"\"\"\n    pass\n\n\ndef after_loading_experiment_control(context: str, state: Experiment, **kwargs):\n\"\"\"\n    after loading the experiment from its source.\n\n    Use this loader if you want to interact with the experiment once it's been\n    loaded and parsed but before the validation or execution take place.\n    \"\"\"\n    pass\n\n\ndef before_experiment_control(context: Experiment,\n                              configuration: Configuration = None,\n                              secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the experiment's execution\n\n    Called by the Chaos Toolkit before the experiment's begin but after the\n    configuration and secrets have been loaded.\n    \"\"\"\n    pass\n\n\ndef after_experiment_control(context: Experiment, state: Journal, \n                             configuration: Configuration = None,\n                             secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the experiment's execution\n\n    Called by the Chaos Toolkit after the experiment's completed. It passes the\n    journal of the execution. At that stage, the after control has no influence\n    over the execution however. Please see\n    https://docs.chaostoolkit.org/reference/api/journal/#journal-elements\n    for more information about the journal.\n    \"\"\"\n    pass\n\n\ndef before_hypothesis_control(context: Hypothesis,\n                              configuration: Configuration = None,\n                              secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the hypothesis's execution\n\n    Called by the Chaos Toolkit before the steady-state hypothesis is\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_hypothesis_control(context: Hypothesis, state: Dict[str, Any],\n                             configuration: Configuration = None,\n                             secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the hypothesis's execution\n\n    Called by the Chaos Toolkit after the steady-state hypothesis is\n    complete. The `state` contains the result of the hypothesis. Refer to\n    https://docs.chaostoolkit.org/reference/api/journal/#steady-state-outcomes\n    for the description of that state.\n    \"\"\"\n    pass\n\n\ndef before_method_control(context: Experiment, \n                          configuration: Configuration = None,\n                          secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the method's execution\n\n    Called by the Chaos Toolkit before the activities of the method are\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_method_control(context: Experiment, state: List[Run], \n                         configuration: Configuration = None,\n                         secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the method's execution\n\n    Called by the Chaos Toolkit after the activities of the method have been\n    applied. The `state` is the list of activity results. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n\n\ndef before_rollback_control(context: Experiment, \n                            configuration: Configuration = None,\n                            secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the rollback's execution\n\n    Called by the Chaos Toolkit before the actions of the rollback are\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_rollback_control(context: Experiment, state: List[Run], \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the rollback's execution\n\n    Called by the Chaos Toolkit after the actions of the rollback have been\n    applied. The `state` is the list of actions results. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n\n\ndef before_activity_control(context: Activity, \n                            configuration: Configuration = None,\n                            secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the activity's execution\n\n    Called by the Chaos Toolkit before the activity is applied.\n    \"\"\"\n    pass\n\n\ndef after_activity_control(context: Activity, state: Run,  \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the activity's execution\n\n    Called by the Chaos Toolkit before the activity is applied. The result of\n    the execution is passed as `state`. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n
"},{"location":"reference/extending/create-control-extension/#use-your-control","title":"Use your control","text":"

Define those functions into a module that is used as a provider. For instance, assume the above definition is stored into a module chaosstuff.control, in other words a control.py module of the chaosstuff package.

The package must obviously be available to the PYTHONPATH in which the chaos runs.

"},{"location":"reference/extending/create-control-extension/#declare-it-in-the-experiment","title":"Declare it in the experiment","text":"

Controls can be applied per-experiment only:

JSONYAML
\"controls\": [\n{\n\"name\": \"my-stuff\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosstuff.control\"\n}\n}\n]\n
controls:\n- name: my-stuff\nprovider:\ntype: python\nmodule: chaosstuff.control\n
"},{"location":"reference/extending/create-control-extension/#declare-it-in-your-settings","title":"Declare it in your settings","text":"

Controls can be also applied globally to all runs by declaring them in the Chaos Toolkit settings file:

controls:\nmy-stuff:\nprovider:\ntype: python\nmodule: chaosstuff.control\n
"},{"location":"reference/extending/create-control-extension/#things-to-note","title":"Things to note","text":""},{"location":"reference/extending/create-control-extension/#unforeseen-errors","title":"Unforeseen errors","text":"

The Chaos Toolkit will not let a control abort the execution of the experiment. So if an exception is raised, it will be caught by the Chaos Toolkit, logged and the execution will carry on.

"},{"location":"reference/extending/create-control-extension/#interrupting-the-execution","title":"Interrupting the execution","text":"

While unforeseen errors in your controls cannot stop the execution, you can interrupt the execution by raising chaoslib.exceptions.InterruptExecution from any of your control functions.

Note however, this is a harsh way to terminate the execution since, none of the rollbacks will be applied.

Here is an example:

from chaoslib.exceptions import InterruptExecution\n\n\ndef after_activity_control(context: Activity, state: Run,  \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n    if check_stuff(state[\"output\"]):\n        raise InterruptExecution(\"Well things went really bad!\")\n

In that case, the experiment\u2019s execution will have its status set to \"interrupted\" as described here.

"},{"location":"reference/extending/extending-with-python/","title":"Extending Chaos Toolkit with Python","text":""},{"location":"reference/extending/extending-with-python/#create-your-new-chaos-toolkit-extension-project","title":"Create your new Chaos Toolkit extension project","text":"

All Chaos Toolkit extensions follow the same structure and you can benefit from a project template. You can create a repository using that template from the GitHub UI or using the gh.

$ gh repo create mytest --private -p chaostoolkit/chaostoolkit-extension-template\n
"},{"location":"reference/extending/extending-with-python/#where-to-put-your-code","title":"Where to put your code","text":"

There are two extension points for a Chaos Toolkit Python extension, and they are captured in two files: actions.py and probes.py.

It is conventional to use the actions.py module as the place where you expose the actions that you would like to conduct as part of your Chaos Toolkit experimental method against the environment you want to inject failure into.

It\u2019s also conventional to use the probes.py module as the place where you can integrate with your system\u2019s existing observability so that those values can be used either for an experiment\u2019s Steady State Hypothesis, or as simple additional data-gathering probes that can be declared throughout an experiment\u2019s method.

"},{"location":"reference/extending/extending-with-python/#running-discover-on-a-new-extension","title":"Running Discover on a New Extension","text":"

Chaos Toolkit extensions often implement functionality that assists in discovering what a system, and the extension against that system, supports. This is executed using the chaos discover command.

When writing your own implementation of discovery you will often want to test the new functionality locally. To do this you should first execute from your extension workspace:

$ python setup.py develop

Then you can exercise your discovery functionality using the --no-install flag on the chaos discover command, for example:

chaos discover --no-install ext-name

"},{"location":"reference/extending/extending-with-python/#log-from-your-extension","title":"Log From Your Extension","text":"

You can write to the Chaos Toolkit log by using the logzero package.

from logzero import logger\n\nlogger.info(\"Hello!\")\n

Make sure to add logzero as an entry of the requirements.txt file of your extension.

"},{"location":"reference/tutorials/authoring_operating/","title":"Authoring vs Operating","text":"

The Chaos Toolkit specifies an experimental protocol and format for your chaos engineering capabilities. It is often interesting to distinguish, at least in your mind, two roles.

"},{"location":"reference/tutorials/authoring_operating/#author","title":"Author","text":"

The author of an experiment is responsible for defining the structure of the experiment and its objective. The author does not have to be the one who comes with the question the experiment tries to produce evidence for. Rather, the author knows how to structure the experiment and ensures the outcome of an experiment\u2019s execution can be interpreted in an objective way.

An author manipulates the following elements: steady-state hypothesis, method, rollbacks.

"},{"location":"reference/tutorials/authoring_operating/#operator","title":"Operator","text":"

The operator of an experiment executes it. This role is not as clear cut as the author\u2019s role and, quite often, both are the same person. However, it is useful to keep in mind what an experiment requires to be operated. Since you may end up with a fleet of Chaos Toolkit experiments running concurrently, the operator should work to ensure the executions happen in a safe and controlled manner.

An operator manipulates the following elements: controls, settings

"},{"location":"reference/tutorials/batch/","title":"Running Chaos Toolkit experiments as AWS Batch Jobs","text":"

It is common when using AWS for hosting your infrastructure that you\u2019ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we\u2019re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

"},{"location":"reference/tutorials/batch/#why-batch","title":"Why Batch?","text":"

You may have followed our Running Chaos Toolkit from an EC2 instance guide and wonder why we would write a guide for Batch - Batch has some benefits over EC2:

"},{"location":"reference/tutorials/batch/#why-not-ecs-and-fargate","title":"Why not ECS and Fargate?","text":"

We sometimes get asked about how to run Chaos Toolkit on ECS with Fargate, whilst we understand why you might want to do this, Chaos Toolkit experiments aren\u2019t analogous to something like a microservice. We don\u2019t run Chaos Toolkit continuously and request it to run jobs, rather we invoke Chaos Toolkit when we want to use it.

Because of this difference in thinking, we recommend you use Batch (With Fargate as the compute provider) to invoke Chaos Toolkit experiments.

"},{"location":"reference/tutorials/batch/#the-steps","title":"The Steps","text":"

For the purposes of this guide, we\u2019ll run you through setting up your Chaos Toolkit experiments manually. If however, you\u2019re familiar with the AWS Cloud Development Kit (CDK), we have an example repository deploying the same infrastructure using CDK here.

There are a few pre-requisites required to be able to follow this guide:

"},{"location":"reference/tutorials/batch/#1-create-your-system-an-ec2-instance","title":"1. Create your system (an EC2 instance)","text":"

Similar to our Running Chaos Toolkit from an EC2 instance guide, we\u2019ll be using an EC2 instance as our \u2018system\u2019 to run our experiment against. We\u2019ll setup our SSH to ensure that the EC2 instance is in a running state.

AWS ConsoleAWS CLI

You can leave this instance up for the duration of this guide.

"},{"location":"reference/tutorials/batch/#2-create-your-experiment","title":"2. Create your experiment","text":"

In an empty directory, create a folder named experiments:

mkdir experiments\n

Create a file named experiment-1.json inside experiments/ with the following contents:

{\n\"title\": \"Running Chaos Toolkit from AWS Batch\",\n\"description\": \"N/A\",\n\"tags\": [],\n\"steady-state-hypothesis\": {\n\"title\": \"EC2 is RUNNING\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"instance_state\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"running\",\n\"instance_ids\": [\n\"<INSTANCE_ID>\"\n],\n\"filters\": []\n}\n},\n\"tolerance\": true\n}\n]\n},\n\"method\": [],\n\"configuration\": {\n\"aws_region\": \"<REGION>\"\n}\n}\n

Replace the value of <INSTANCE_ID> with the value of the id of the deployed instance. Replace <REGION> with the name of the region the instance is deployed in.

"},{"location":"reference/tutorials/batch/#3-setup-your-docker-image","title":"3. Setup your Docker image","text":"

AWS Batch requires us to have a Docker image within the Job definition, this container will be what does the work for our Batch Job.

Make a file named Dockerfile alongside experiments/ with the following contents:

FROM chaostoolkit/chaostoolkit:latest\n\nRUN pip install chaostoolkit-aws\n\nRUN mkdir /home/svc/experiments\n\nCOPY experiments /home/svc/experiments\n\nWORKDIR /home/svc/experiments\n
"},{"location":"reference/tutorials/batch/#4-create-your-ecr-repository-and-push-the-image","title":"4. Create your ECR repository and push the image","text":"AWS ConsoleAWS CLI

Logging in to ECR with Docker

aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com\n

Login Succeeded\n

Building the image

docker build -t ctk-batch .\n

[+] Building 1.8s (10/10) FINISHED\n => [internal] load build definition from Dockerfile        0.0s\n => => transferring dockerfile: 220B                        0.0s\n => [internal] load .dockerignore                           0.0s\n => => transferring context: 2B                             0.0s\n => [internal] load metadata for docker.io/chaostoolkit/chaostoolkit:latest                                                         1.5s\n => [1/5] FROM docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => => resolve docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => [internal] load build context                           0.0s\n => => transferring context: 959B                           0.0s\n => CACHED [2/5] RUN pip install chaostoolkit-aws           0.0s\n => CACHED [3/5] RUN mkdir /home/svc/experiments            0.0s\n => [4/5] COPY experiments /home/svc/experiments            0.0s\n => [5/5] WORKDIR /home/svc/experiments                     0.0s\n => exporting to image                                      0.1s\n => => exporting layers                                     0.0s\n => => writing image sha256:4a3ce8f2824518bffa47ff3d293488f18f83e25711bedc32e13611a5c7e7e0af                                        0.0s\n => => naming to docker.io/library/ctk-batch                0.0s\n

Tagging the image

docker tag ctk-batch:latest <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch:latest\n

Pushing the image

docker push <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch:latest\n

The push refers to repository [<your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch]\n5f70bf18a086: Pushed\ned804ed04ee1: Pushed\n8ac8250b5bff: Pushed\n65bb6a66824b: Pushed\n381a8a9c329b: Pushed\n7a767cefe1f5: Pushed\n011386fb6049: Pushed\nac4086fc0a4e: Pushed\n065eb9ef9cc4: Pushed\n93ee5bc36b87: Pushed\n9cc956b239dd: Pushed\nbc276c40b172: Pushed\nlatest: digest: sha256:9702b9cf63a6e4961689a661340fc0573d28d0e7f506b90fa5d080e4e7c9d275 size: 2826\n
"},{"location":"reference/tutorials/batch/#5-create-your-batch-compute-environment","title":"5. Create your Batch Compute environment","text":"

To actually run your Jobs, Batch needs a Compute environment configured. This is where you tell AWS what runs the jobs (i.e EC2 instances/Fargate/etc.).

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#6-create-your-batch-job-queue","title":"6. Create your Batch Job queue","text":"

When you submit Jobs, Batch uses a Job queue to manage what is and needs to be running and where it needs to run.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#7-create-your-batch-job-execution-role","title":"7. Create your Batch Job execution role","text":"

Because you\u2019ve set up an ECR repository with your Docker image in, you need to provide Batch with an execution role that will allow it to pull the image from ECR. It will also enable Batch to output the logs of the container to CloudWatch.

Don\u2019t be confused when we refer to Elastic Container Service, Batch is using it under the hood.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#8-create-your-batch-job-job-role","title":"8. Create your Batch Job job role","text":"

The nature of chaostoolkit-aws means that we use boto3 to make AWS requests within our experiment. To be able to make these calls, the container that is running our experiment needs credentials and permissions to do so.

By creating a job role for our Job, we can:

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#9-create-your-batch-job-definition","title":"9. Create your Batch Job definition","text":"

This is where we tell AWS what our Job is and needs.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#10-run-your-experiment","title":"10. Run your experiment","text":"

Now that you have:

It\u2019s a great time to try and run it!

AWS ConsoleAWS CLI

Here you\u2019ll find the CloudWatch logs of the experiment:

No older events at this moment. Retry\n[2021-08-19 14:02:42 INFO] Validating the experiment's syntax\n[2021-08-19 14:02:42 INFO] Experiment looks valid\n[2021-08-19 14:02:42 INFO] Running experiment: Running Chaos Toolkit from AWS Batch\n[2021-08-19 14:02:42 INFO] Steady-state strategy: default\n[2021-08-19 14:02:42 INFO] Rollbacks strategy: default\n[2021-08-19 14:02:42 INFO] Steady state hypothesis: EC2 is RUNNING\n[2021-08-19 14:02:42 INFO] Probe: instance_state\n[2021-08-19 14:02:43 INFO] Steady state hypothesis is met!\n[2021-08-19 14:02:43 INFO] Playing your experiment's method now...\n[2021-08-19 14:02:43 INFO] No declared activities, let's move on.\n[2021-08-19 14:02:43 INFO] Steady state hypothesis: EC2 is RUNNING\n[2021-08-19 14:02:43 INFO] Probe: instance_state\n[2021-08-19 14:02:43 INFO] Steady state hypothesis is met!\n[2021-08-19 14:02:43 INFO] Let's rollback...\n[2021-08-19 14:02:43 INFO] No declared rollbacks, let's move on.\n[2021-08-19 14:02:43 INFO] Experiment ended with status: completed\nNo newer events at this moment. Auto retry paused. Resume\n

You\u2019ll then see the CloudWatch logs of the experiment:

b/36345990587319449028074048616721581140117476148622393344      f/36345990607367818961553078820962191867228353142498787343\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Validating the experiment's syntax   1629810585420\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Experiment looks valid       1629810585571\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Running experiment: Running Chaos Toolkit from AWS Batch     1629810585572\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Steady-state strategy: default       1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Rollbacks strategy: default  1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Steady state hypothesis: EC2 is RUNNING      1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Probe: instance_state        1629810585578\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis is met!      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Playing your experiment's method now...      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] No declared activities, let's move on.       1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis: EC2 is RUNNING      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Probe: instance_state        1629810586239\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis is met!      1629810586318\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Let's rollback...    1629810586319\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] No declared rollbacks, let's move on.        1629810586319\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Experiment ended with status: completed      1629810586319\n

"},{"location":"reference/tutorials/batch/#summary","title":"Summary","text":"

Like our Running Chaos Toolkit from an EC2 instance guide, our experiment was extremely simple. Again, this guide was not meant to teach you to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure, in a more reactive process.

Rather than having an EC2 instance running and not doing any work, you have the ability now to fire off Chaos Toolkit experiments and only use the compute you need.

You should now have an appreciation and the ability to:

"},{"location":"reference/tutorials/batch/#extras","title":"Extras","text":"

Whilst the above guide will tell you all you need to know to get started with AWS Batch and running Chaos Toolkit experiments with jobs, it is very manual and has a few shortcomings that are easily fixed with some more work.

"},{"location":"reference/tutorials/batch/#aws-cloud-development-kit-cdk","title":"AWS Cloud Development Kit (CDK)","text":"

As mentioned near the start of this guide, we have this repository which contains an AWS CDK project which deploys almost the same infrastructure as this guide.

The infrastructure differs slightly in:

We also modify the experiment-1.json file to accept an environment variable for the EC2 instance ID as this will be provided by CDK.

If you wish to try this project out, clone the repository and ensure you install all of the requirements first.

Once you\u2019re setup with the requirements, you can check what infrastructure will be deployed with:

make diff\n
...\nResources\n[+] AWS::S3::Bucket journal-bucket-your-name-dev journalbucketyour-namedev58D204DE\n[+] AWS::S3::BucketPolicy journal-bucket-your-name-dev/Policy journalbucketyour-namedevPolicyDFBFADE1\n[+] Custom::S3AutoDeleteObjects journal-bucket-your-name-dev/AutoDeleteObjectsCustomResource journalbucketyour-namedevAutoDeleteObjectsCustomResourceB5FE1104\n[+] AWS::IAM::Role Custom::S3AutoDeleteObjectsCustomResourceProvider/Role CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092\n[+] AWS::Lambda::Function Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F\n[+] AWS::EC2::VPC vpc-your-name-dev vpcyour-namedev8A672852\n[+] AWS::EC2::Subnet vpc-your-name-dev/PublicSubnet1/Subnet vpcyour-namedevPublicSubnet1Subnet4E80B3F7\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PublicSubnet1/RouteTable vpcyour-namedevPublicSubnet1RouteTable3BA26768\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PublicSubnet1/RouteTableAssociation vpcyour-namedevPublicSubnet1RouteTableAssociationF3D844E7\n[+] AWS::EC2::Route vpc-your-name-dev/PublicSubnet1/DefaultRoute vpcyour-namedevPublicSubnet1DefaultRouteD7E793DD\n[+] AWS::EC2::EIP vpc-your-name-dev/PublicSubnet1/EIP vpcyour-namedevPublicSubnet1EIP712EAA5B\n[+] AWS::EC2::NatGateway vpc-your-name-dev/PublicSubnet1/NATGateway vpcyour-namedevPublicSubnet1NATGatewayCC6D84C6\n[+] AWS::EC2::Subnet vpc-your-name-dev/PublicSubnet2/Subnet vpcyour-namedevPublicSubnet2Subnet3E3E0046\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PublicSubnet2/RouteTable vpcyour-namedevPublicSubnet2RouteTable1AB520E0\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PublicSubnet2/RouteTableAssociation vpcyour-namedevPublicSubnet2RouteTableAssociation2FEAAF25\n[+] AWS::EC2::Route vpc-your-name-dev/PublicSubnet2/DefaultRoute vpcyour-namedevPublicSubnet2DefaultRouteC103C9D2\n[+] AWS::EC2::EIP vpc-your-name-dev/PublicSubnet2/EIP vpcyour-namedevPublicSubnet2EIP6AD92B60\n[+] AWS::EC2::NatGateway vpc-your-name-dev/PublicSubnet2/NATGateway vpcyour-namedevPublicSubnet2NATGatewayA09AEBA1\n[+] AWS::EC2::Subnet vpc-your-name-dev/PrivateSubnet1/Subnet vpcyour-namedevPrivateSubnet1SubnetB315A65A\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PrivateSubnet1/RouteTable vpcyour-namedevPrivateSubnet1RouteTableA5FAAF1C\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PrivateSubnet1/RouteTableAssociation vpcyour-namedevPrivateSubnet1RouteTableAssociationE3B5D7DD\n[+] AWS::EC2::Route vpc-your-name-dev/PrivateSubnet1/DefaultRoute vpcyour-namedevPrivateSubnet1DefaultRoute9152FB24\n[+] AWS::EC2::Subnet vpc-your-name-dev/PrivateSubnet2/Subnet vpcyour-namedevPrivateSubnet2Subnet414716F0\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PrivateSubnet2/RouteTable vpcyour-namedevPrivateSubnet2RouteTable225072CD\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PrivateSubnet2/RouteTableAssociation vpcyour-namedevPrivateSubnet2RouteTableAssociationF9EA82A2\n[+] AWS::EC2::Route vpc-your-name-dev/PrivateSubnet2/DefaultRoute vpcyour-namedevPrivateSubnet2DefaultRoute7BE0AFBF\n[+] AWS::EC2::InternetGateway vpc-your-name-dev/IGW vpcyour-namedevIGW70FB840E\n[+] AWS::EC2::VPCGatewayAttachment vpc-your-name-dev/VPCGW vpcyour-namedevVPCGWB8F53F81\n[+] AWS::EC2::SecurityGroup instance-your-name-dev/InstanceSecurityGroup instanceyour-namedevInstanceSecurityGroup50C02701\n[+] AWS::IAM::Role instance-your-name-dev/InstanceRole instanceyour-namedevInstanceRoleF653EE93\n[+] AWS::IAM::InstanceProfile instance-your-name-dev/InstanceProfile instanceyour-namedevInstanceProfile6799F951\n[+] AWS::EC2::Instance instance-your-name-dev instanceyour-namedev8DD0F85A\n[+] AWS::IAM::Role batch-service-role-your-name-dev batchserviceroleyour-namedevB064BF84\n[+] AWS::IAM::Role batch-execution-role-your-name-dev batchexecutionroleyour-namedev39DE3188\n[+] AWS::IAM::Policy batch-execution-policy-your-name-dev batchexecutionpolicyyour-namedev8BCEF321\n[+] AWS::IAM::Role batch-job-role-your-name-dev batchjobroleyour-namedevAC17F802\n[+] AWS::IAM::Policy batch-job-role-your-name-dev/DefaultPolicy batchjobroleyour-namedevDefaultPolicy44B9665C\n[+] AWS::IAM::Policy batch-job-policy-your-name-dev batchjobpolicyyour-namedev9C329AAB\n[+] AWS::Batch::ComputeEnvironment compute-env-your-name-dev computeenvyour-namedev\n[+] AWS::Batch::JobQueue job-queue-your-name-dev jobqueueyour-namedev\n[+] AWS::Batch::JobDefinition job-def-your-name-dev jobdefyour-namedev\n

To deploy the infrastructure, run:

make deploy\n
...\nChaosToolkitBatchExampleStack-your-name-dev: creating CloudFormation changeset...\n[\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258f\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7] (35/43)\n09:24:07 | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack            | ChaosToolkitBatchExampleStack-your-name-dev\n09:24:52 | CREATE_IN_PROGRESS   | AWS::IAM::InstanceProfile             | instance-your-name-dev/InstanceProfile\n09:25:13 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                  | vpc-your-name-dev/PublicSubnet2/NATGateway\n09:25:13 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                  | vpc-your-name-dev/PublicSubnet1/NATGateway\n...\n

You can then navigate to the Batch console and run jobs as previously outlined in the guide above.

"},{"location":"reference/tutorials/batch/#storing-your-journal","title":"Storing your journal","text":"

You might have noticed that being able to view the Chaos Toolkit experiment journal presents a pickle of a situation. As Batch Job containers are ephemeral, once the Job has run and terminated (either successfully or not), the place your experiment just ran in is destroyed for good.

There are likely several ways you could get around this issue, you could implement an extension to upload journals somewhere, you could extend chaostoolkit-aws to upload journal runs to S3 or to an EBS volume (if you\u2019d deployed that too).

In the CDK example, we actually snuck in a way to store journals; we use a wrapper script which calls chaostoolkit and then uses boto3 in a Python script to upload the journal to S3, into a bucket we also deploy in the stack.

Take a look at our Dockerfile compared to the one in the guide above:

FROM chaostoolkit/chaostoolkit:latest\n\nRUN pip install chaostoolkit-aws\n\nRUN mkdir /home/svc/experiments\n\nCOPY experiments /home/svc/experiments\nCOPY run_experiment.sh /home/svc/experiments/\nCOPY upload_journal.py /home/svc/experiments/\n\nWORKDIR /home/svc/experiments\n\nENTRYPOINT [ \"sh\", \"run_experiment.sh\" ]\n

We\u2019ve added two new COPY statements, moving our wrapper script and our upload script into the container. We\u2019ve also added an override to the containers ENTRYPOINT value, which in chaostoolkit/chaostoolkit:latest is chaos.

The wrapper script is very simple, it just looks like:

#!/bin/bash\n\nchaos run $1 --journal-path=/home/svc/experiments/journal.json\n\npython3 upload_journal.py\n

Our upload script is also very basic:

import os\nfrom datetime import datetime\n\nimport boto3\n\n\ndef upload_journal():\n    s3 = boto3.client(\"s3\")\n    with open(\"/home/svc/experiments/journal.json\", \"rb\") as journal:\n        s3.upload_fileobj(\n            journal,\n            os.environ[\"JOURNAL_BUCKET\"],\n            f\"{datetime.now().strftime('%Y%m%d-%H%M%S')}.json\",\n        )\n\n\nif __name__ == \"__main__\":\n    upload_journal()\n

With these changes and a small modification to the command of our Job definition, we can now invoke our experiment, specify a location for our journal, and then upload the journal with a suitable name - we set our journal name to the current datetime. You could also include your experiment name if you have many of them.

"},{"location":"reference/tutorials/blockchain/","title":"Chaos Engineering experiments against a blockchain","text":"

Credits

This article has been authored by Yolanne Lee and you can find the original article code on Yolanne\u2019s repository

Blockchains are interesting concepts to test using chaos engineering principles. This is because they operate based on user usage, taking advantage of a network of participants and internal algorithms to create a distributed, decentralized ledger.

This tutorial will not focus on teaching core blockchain concepts. While the setup may be done by simply pulling from my github repository, you may alternatively invest some time reading through the great tutorial here!

If you choose to proceed with the tutorial, you will need to ensure that your HTTP requests match logically with those in this tutorial.

Ready? Great! Let\u2019s get started.

"},{"location":"reference/tutorials/blockchain/#setup","title":"Setup","text":"

First, clone the code using the command below in your command line. This fetches an up-to-date version of all files required to run the experiment.

$ git clone https://github.com/yolannel/CTKBlockchain

Assuming you are running Python 3.6 or higher, you can install all required dependencies via the following command in your command line. Please note that it is highly recommended that you work inside of a virtual environment. A simple explanation of virtual environments may be found here; if you\u2019re running PyCharm or another editor which has in-built venv support then check your project settings!

$ pip install -U -r requirements.txt

Now you\u2019re all set up to dive into the experiments!

"},{"location":"reference/tutorials/blockchain/#chaos-toolkit-and-blockchain","title":"Chaos Toolkit and Blockchain","text":""},{"location":"reference/tutorials/blockchain/#looking-forward","title":"Looking forward","text":"

Blockchains are inherently user dependent which is why it presents a unique case to test with Chaos Toolkit. This tutorial will guide you through the thought process of creating two experiments:

  1. Testing a simple transaction
  2. Testing the consensus mechanism

We will follow the above order because the consensus mechanism naturally builds off of the transaction model. If you require additional help at any point regarding the CTK, you can view the documentation.

You can consider an experiment as an automator for the process you\u2019d normally do to test your program: you preset a full task flow so that your testing is repeatable and easy to run. The results of your experiment are also automatically recorded, so you can continuously expose your system to stressors and understand its strengths and weaknesses from reading the records which are automatically recorded in your journal file.

"},{"location":"reference/tutorials/blockchain/#transaction-experiment","title":"Transaction Experiment","text":"

We\u2019ll use this as an introduction to the CTK experiment as well. An experiment is a single json file which tests a functionality of your program. It has several components that must be declared:

When we start to think about creating an experiment, we need to have a well-defined goal of testing. For example, the blockchain should support making a simple transaction which can be mined; before and after mining, the chain should exist and be callable. No rollbacks should be supported since a blockchain should be immutable.

This is the beginning of my experiment:

{\n\"title\": \"Can we make a new transaction?\",\n\"description\": \"The system should respond to a transaction request.\",\n\"tags\": [\"tx\"],\n...\n

The format of the json file is quite simple. Similarly to a dictionary, there is a property, and a value assigned to the property. In the case of a property which can take multiple values, such as \"tags\", square brackets are put around the values. Try adding an additional tag to the experiment by adding a comma after the first value and adding a second tag!

Below, we see the \"steady-state-hypothesis\". We previously mentioned what the blockchain should be capable of both before and after the experiment. The steady state hypothesis tests for this condition - in this case, the condition is simply that the chain should exist.

We also introduce a probe! This is the workhorse of any experiment. Probes are able to carry out tests and listen for responses. They have the following properties:

    \"steady-state-hypothesis\": {\n\"title\": \"Chain exists\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"chain-exists\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 5,\n\"url\": \"http://127.0.0.1:5000/chain\"\n}\n}\n]\n},\n

Now we reach the main body of the json file, the method. The basic structure is simply a list of probes and actions. Actions are very similar to probes, but should introduce new information or a change to the system being tested rather than simply checking its state.

As an example, checking that the chain exists is a probe but creating a new transaction is an action.

We have to POST a request, which differs from the previous check-chain probe which used a simple \u2018GET\u2019, so we define the \"method\" to be POST.

The \"header\" is a property which defines header names. These provide information/context about the type of information being sent - in our case, the content should be read as a json request so the header defines the content-type.

Certain arguments must be included (see line 173 in blockchain.py) in the json for the request to be valid according to our blockchain.py file:

We can include arguments in our action by simply including \"arguments\" and listing them in name-value pairs.

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"make-new-transaction\",\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 1,\n\"url\": \"http://127.0.0.1:5000/transactions/new\",\n\"method\": \"POST\",\n\"headers\": {\n\"Content-Type\": \"application/json\"\n},\n\"arguments\": {\n\"sender\": \"me\",\n\"recipient\": \"new-other-address\",\n\"amount\": 20\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"check-chain\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"mine-block\",\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 3,\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"check-chain\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n}\n],\n

Finally, we reach the rollbacks! When designing an experiment, you should be aware of the capabilities of your system and also what it should be able to do. For example, I could include code in my blockchain.py file that allows a user to delete a transaction which hasn\u2019t been mined yet; however, this would violate the operation of a blockchain because blockchains derive trust from immutability (as mentioned before). So, you can see below that no rollbacks are included because a user should not be able to delete changes nor does my blockchain.py file include an option to.

\"rollbacks\": [\n]\n}\n
"},{"location":"reference/tutorials/blockchain/#running-the-experiment","title":"Running the experiment","text":"

In your command line, you should create the blockchain before running the experiment by running the blockchain.py file:

$ python blockchain.py

Then, you can run the experiment by using the command:

$ chaos run testTransaction.json

That\u2019s your first experiment!

"},{"location":"reference/tutorials/blockchain/#consensus-experiment","title":"Consensus Experiment","text":"

While our blockchain is a very simple one, it should be able to demonstrate arguably the key reason why we can call it \u2018decentralized\u2019 and \u2018distributed\u2019: the consensus mechanism. As before, see the brilliant tutorial linked above if you really want to get into the details!

On a topical level, the consensus mechanism is how you determine the global truth. If one person posts a transaction on a block that was mined at the exact same time, it could accidentally branch off of the original chain. Additionally, there must be a verifiable task involved in mining that is unbiased and sufficiently difficult, but still easy to check. Both of these requirements are addressed by the consensus mechanism, which is the task required to mine a block.

We will demo a simple Proof of Work, which essentially is an extremely difficult computation to solve a math puzzle. We will then start a second chain as an example of the branching that may occasionally occur; this blockchain resolves itself by taking the longest chain.

We will not walk through the entire experiment this time, but the procedure planned out is as follows.

  1. Like before, we should ensure that the chain exist on two separate nodes.
  2. Simulate activity.
  3. Check the chains exist still.
  4. Resolve the chains to identify the global truth.

Steps 1 and 3 should be familiar to you and I invite you to try coding them yourself! Step 2 brings an opportunity to show another use case for CTK. So far we have used the http provider, but we may also use a python provider.

{\n\"type\": \"action\",\n\"name\": \"simulate activity\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os\",\n\"func\": \"system\",\n\"arguments\": {\n\"command\": \"python -c \\\"import activity; activity.run(100)\\\"\"\n}\n}\n}\n

The activity.py file run by simulate activity randomly posts transactions from either of the two nodes and occasionally mines a block. For reference, the approximate probability of posting a transaction to any of the two chains is 75% and accordingly, the probability of mining from either of the two chains is 25%.

Finally, we want to resolve the chains. This is an http request which we\u2019ve learned earlier, and I again invite you to try your hand at it!

"},{"location":"reference/tutorials/blockchain/#running-the-experiment_1","title":"Running the experiment","text":"

In your command line, you should create the blockchain and start both nodes (here we use 127.0.0.1:5000 and 127.0.0.1:5001) before running the experiment:

$ python blockchain.py --port 5000

.. and on a new terminal,

$ python blockchain.py --port 5001

Then, you can run the experiment by using the command:

$ chaos run testConsensus.json

You\u2019ve completed the tutorial!

"},{"location":"reference/tutorials/blockchain/#some-key-takeaways","title":"Some key takeaways","text":""},{"location":"reference/tutorials/blockchain/#thanks","title":"Thanks","text":"

Chaos Toolkit is an open source project hosted on Github. If you have any issues then raise them on the Github, and if you\u2019d like to contribute, start here!

The blockchain tutorial linked in the beginning is completely external to this tutorial and all credits go to Daniel van Flymen.

"},{"location":"reference/tutorials/containerising/","title":"Containerising Chaos Toolkit","text":"

You may find yourself in a situation that requires you to run your Chaos Toolkit Experiments from within a container. This may be to encapsulate the dependencies required or to run CTK in a different environment, for whichever reason you have, containerising CTK is straightforward.

Chaos Toolkit provides three images you can use as bases for your own needs:

"},{"location":"reference/tutorials/containerising/#using-the-vanilla-chaostoolkit-image","title":"Using the vanilla chaostoolkit image","text":"

Chaos Toolkit builds and pushes a Docker Image upon every release of a new version of the chaostoolkit package. This can then be used out of the box by referring to it locally on the command line with:

docker run chaostoolkit/chaostoolkit:latest info core\n
Unable to find image 'chaostoolkit/chaostoolkit:latest' locally\nlatest: Pulling from chaostoolkit/chaostoolkit\nDigest: sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3\nStatus: Downloaded newer image for chaostoolkit/chaostoolkit:latest\nNAME                VERSION   \nCLI                 1.9.2     \nCore library        1.19.0\n

It should be noted that this only contains vanilla chaostoolkit.

You could then mount a directory containing your experiments (if they are only using vanilla chaostoolkit) and run them:

docker run \\\n-v $PWD/experiments:/experiments \\\nchaostoolkit/chaostoolkit:latest \\\n--log-file /experiments/chaostoolkit.log \\\nrun /experiments/experiment.json \\\n--journal-path /experiments/journal.json\n

You\u2019d then find in $PWD/experiments:

ls $PWD/experiments\n
chaostoolkit.log experiment.json  journal.json\n
"},{"location":"reference/tutorials/containerising/#containerising-with-extensions","title":"Containerising with extensions","text":"

You can obviously use the chaostoolkit/chaostoolkit:full image which contains the most commonly used extensions. But you can also tailor to your need as follows. We will be using the chaostoolkit/chaostoolkit:basic image as base so we build using a Debian image.

"},{"location":"reference/tutorials/containerising/#chaostoolkit-aws-example","title":"chaostoolkit-aws example","text":"

If for example, you needed certain AWS activities for your chaos experiments, you could create a Dockerfile like so:

FROM chaostoolkit/chaostoolkit:basic\n\nRUN pip install chaostoolkit-aws\n

To then use this, you\u2019d first build the image:

docker build -t ctk-aws .\n
[+] Building 2.1s (6/6) FINISHED                                                                                                                                                            \n => [internal] load build definition from Dockerfile                                                                                0.0s\n => => transferring dockerfile: 114B                                                                                                0.0s\n => [internal] load .dockerignore                                                                                                   0.0s\n => => transferring context: 2B                                                                                                     0.0s\n => [internal] load metadata for docker.io/chaostoolkit/chaostoolkit:latest                                                         2.0s\n => [1/2] FROM docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => => resolve docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => CACHED [2/2] RUN pip install chaostoolkit-aws                                                                                   0.0s\n => exporting to image                                                                                                              0.0s\n => => exporting layers                                                                                                             0.0s\n => => writing image sha256:84f4579bee5ff42881a226643dbe37c8bc1e0ecb60e153c46395f9dc62a8f256                                        0.0s\n => => naming to docker.io/library/ctk-aws                                                                                          0.0s\n

Then you\u2019d confirm chaostoolkit-aws is available with:

docker run ctk-aws info extensions\n
NAME                                    VERSION   LICENSE                       DESCRIPTION\nchaostoolkit-aws                        0.16.0    Apache License Version 2.0    AWS\n
"},{"location":"reference/tutorials/ec2/","title":"Running Chaos Toolkit from an EC2 instance","text":"

It is common when using AWS for hosting your infrastructure that you\u2019ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we\u2019re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

"},{"location":"reference/tutorials/ec2/#why-ec2","title":"Why EC2?","text":"

The reasons for providing a guide on running Chaos Toolkit from an EC2 instance are simple enough:

"},{"location":"reference/tutorials/ec2/#the-steps","title":"The Steps","text":"

There are a few pre-requisites required to be able to follow this guide:

"},{"location":"reference/tutorials/ec2/#1-create-your-instance","title":"1. Create your instance","text":"AWS ConsoleAWS CLI

To be able to connect to your instance via Session Manager, you\u2019ll first need to create a few IAM components.

Now that your instances IAM entities are sorted, you can create your instance.

"},{"location":"reference/tutorials/ec2/#2-connect-to-your-instance","title":"2. Connect to your instance","text":""},{"location":"reference/tutorials/ec2/#3-setup-chaos-toolkit","title":"3. Setup Chaos Toolkit","text":"

You\u2019ll see a prompt like:

sh-4.2$\n

Change to the home directory with:

cd ~\n

Create a new directory for your experimentation and navigate inside:

mkdir my-experiments && cd my-experiments\n

Create a virtual environment for the Chaos Toolkit dependencies:

python3 -m venv .venv && source .venv/bin/activate && python3 -m pip install --upgrade pip\n

Install chaostoolkit and its AWS extension chaostoolkit-aws:

pip3 install chaostoolkit chaostoolkit-aws\n
"},{"location":"reference/tutorials/ec2/#4-create-an-experiment","title":"4. Create an experiment","text":"

For the purpose of this guide, we will just create an experiment with a Steady State Hypothesis that interrogates EC2 and checks that our current instance, is in the running state. We don\u2019t have a method, we\u2019re merely showing that we can talk to AWS from within AWS.

Create a file named experiment.json with the following contents:

{\n\"title\": \"Running Chaos Toolkit from an EC2 instance\",\n\"description\": \"N/A\",\n\"tags\": [],\n\"steady-state-hypothesis\": {\n\"title\": \"Current EC2 is RUNNING\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"instance_state\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"running\",\n\"instance_ids\": [\n\"<INSTANCE_ID>\"\n],\n\"filters\": []\n}\n},\n\"tolerance\": true\n}\n]\n},\n\"method\": [],\n\"configuration\": {\n\"aws_region\": \"<REGION>\"\n}\n}\n

Replace the value of <INSTANCE_ID> with the value of the id of the current instance. Replace <REGION> with the name of the region the instance is deployed in.

You can then run the experiment with:

chaos run ./experiment.json\n
[2021-08-18 10:12:29 INFO] Validating the experiment's syntax\n[2021-08-18 10:12:29 INFO] Experiment looks valid\n[2021-08-18 10:12:29 INFO] Running experiment: Running Chaos Toolkit from an EC2 instance\n[2021-08-18 10:12:29 INFO] Steady-state strategy: default\n[2021-08-18 10:12:29 INFO] Rollbacks strategy: default\n[2021-08-18 10:12:29 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:12:29 INFO] Probe: instance_state\n[2021-08-18 10:12:29 ERROR]   => failed: botocore.exceptions.ClientError: An error occurred\n(UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to\nperform this operation.\n[2021-08-18 10:12:29 WARNING] Probe terminated unexpectedly, so its tolerance could not be validated\n[2021-08-18 10:12:29 CRITICAL] Steady state probe 'instance_state' is not in the given tolerance so\nfailing this experiment\n[2021-08-18 10:12:29 INFO] Experiment ended with status: failed\n

You\u2019ll notice the error you just received:

failed: botocore.exceptions.ClientError: An error occurred\n(UnauthorizedOperation) when calling the DescribeInstances operation: You are not\nauthorized to perform this operation.\n

This is because your instance profile role you created earlier doesn\u2019t have a suitable policy statement allowing you to describe EC2 instances.

Navigate to the IAM console and find the Policy you created earlier, add the following statement to it:

{\n\"Effect\": \"Allow\",\n\"Action\": [\n\"ec2:DescribeInstance*\"\n],\n\"Resource\": \"*\"\n}\n

Run your experiment again:

chaos run ./experiment.json\n
[2021-08-18 10:24:56 INFO] Validating the experiment's syntax\n[2021-08-18 10:24:56 INFO] Experiment looks valid\n[2021-08-18 10:24:56 INFO] Running experiment: Running Chaos Toolkit from an EC2\ninstance\n[2021-08-18 10:24:56 INFO] Steady-state strategy: default\n[2021-08-18 10:24:56 INFO] Rollbacks strategy: default\n[2021-08-18 10:24:56 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:24:56 INFO] Probe: instance_state\n[2021-08-18 10:24:56 INFO] Steady state hypothesis is met!\n[2021-08-18 10:24:56 INFO] Playing your experiment's method now...\n[2021-08-18 10:24:56 INFO] No declared activities, let's move on.\n[2021-08-18 10:24:56 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:24:56 INFO] Probe: instance_state\n[2021-08-18 10:24:56 INFO] Steady state hypothesis is met!\n[2021-08-18 10:24:56 INFO] Let's rollback...\n[2021-08-18 10:24:56 INFO] No declared rollbacks, let's move on.\n[2021-08-18 10:24:56 INFO] Experiment ended with status: completed\n

As you\u2019ll notice, your EC2 profile now has the suitable permissions. This should ultimately give you a good sense on how IAM allows you to give specific permissions to the instances running your Chaos Toolkit experiments.

"},{"location":"reference/tutorials/ec2/#summary","title":"Summary","text":"

Whilst the experiment within this guide was simple, the guide was not meant to teach you how to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure.

You should now have an appreciation and the ability to:

"},{"location":"reference/tutorials/ec2/#notes","title":"Notes","text":"

It should be noted that several things could be done differently in this guide to suit your own setup, they could be as follows:

"},{"location":"reference/tutorials/extend/","title":"Learn the basic of extending the Chaos Toolkit","text":"

The Chaos Toolkit comes with a rich catalog of extensions. Sometimes however, this library is not enough. So, how do you go about extending the Chaos Toolkit?

It turns out there are a variety of ways.

"},{"location":"reference/tutorials/extend/#generate-a-binary-and-execute-it-from-the-experiment","title":"Generate a binary and execute it from the experiment","text":"

The Chaos Toolkit is written in Python 3, but you may not have the Python skills or willingness to develop it. One quick solution is to write your own small binary (say you are a rust or golang shop) and call it as a process action. Keep in mind that the binary may be used as a probe in the steady-state so ensure its returned value is easily processed via regex or jsonpath tolerance types. At the very least, the process should signal through its exit code if it completed normally (with 0).

For example, let\u2019s create a simple binary with rust. In a file named echo.rs:

use std::env;\n\nfn main() {\nlet args: Vec<String> = env::args().collect();\nprintln!(&args[1..]);\n}\n
rustc echo.rs\n
./echo hello world\n
[\"hello\", \"world\"]\n
echo $?\n
0\n

An action using this binary would look like this:

JSONYAML
{\n\"name\": \"echo-my-message\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"echo\",\n\"arguments\": \"hello world\"\n}\n}\n
name: echo-my-message\ntype: action\nprovider:\ntype: process\npath: echo\narguments: hello world\n

This assumes the binary is on the chaos PATH and the user has permissions.

"},{"location":"reference/tutorials/extend/#call-a-http-endpoint","title":"Call a HTTP endpoint","text":"

Sometimes, you have HTTP endpoints that are used internally for specific operational tasks. They are internals and crafted for your unique needs. This can be enough to create the bespoke condition for your probes and actions to call via a http provider.

"},{"location":"reference/tutorials/extend/#create-a-simple-python-function","title":"Create a simple Python function","text":"

While extending with a piece of Python code may sound more work, it does not have to be. Indeed, you can create a simple Python module and have a set of functions that are called from your experiment directly. THe trick is to ensure the module can be found in the PYTHONPATH.

Let\u2019s see an example:

Assuming a Python module called kettle.py:

from chaoslib.types import Configuration, Secrets\n\n__all__ = [\"put_on\"]\n\n\ndef put_on(temperature: int = 90, configuration: Configuration = None,\n           secrets: Secrets = None) -> None:\n\"\"\"\n    Sets the kettle to the expected temperature (celsius) and put it on.\n\n    Will return when the kettle has reached it.\n    \"\"\"\n    # do something here\n    pass\n

If kettle.py lives next to experiment.json then the action could be:

{\n\"name\": \"put-kettle-on\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"kettle\",\n\"func\": \"put_on\",\n\"arguments\": {\n\"temperature\": 80\n}\n}\n}\n

You could finally make it available as follows:

ls\n
kettle.py experiment.json\n
export PYTHONPATH=`pwd`\nchaos run experiment.json\n

The Python module does not have to live next to the experiment. It can also contain more than one function of course.

"},{"location":"reference/tutorials/run-flow/","title":"Learn all about the experiment execution\u2019s flow","text":""},{"location":"reference/tutorials/run-flow/#execution-flow-diagram","title":"Execution Flow Diagram","text":"

The diagram below shows the flow used by Chaos Toolkit when running an experiment:

"},{"location":"reference/tutorials/run-flow/#whats-happening-when-running-an-experiment","title":"What\u2019s happening when running an experiment?","text":"

Chaos Toolkit runs an experiment as given in the experiment\u2019s file. The default behavior is straightforward, it runs the activities from the file sequentially in the order they are declared.

The first block executed, if found, is the steady-state hypothesis block. In this particular instances, it acts as a sort of a gateway to say \u201cthe system is normal and meeting its baseline, you can carry on\u201d. By doing so, we notify the world is in a state which we can comprehend and make sense of.

Then, the method is applied. Usually the method consists of at least an action but can also contain probes and other actions. The first action defines the turbulence we want to introduce into the system and see if it impacts our initial baseline. Other actions should be few in numbers or they may render the reading of the results challenging. Probes are merely data collectors of what is happening in your system as the turbulence is happening. It helps the analysis.

Next, the steady state hypothesis is executed again but, this time, it tells us if our baseline has deviated considering the perturbation.

Finally, rollbacks are applied. They serve to usually undo the condition but should not be misunderstood as a way to put the system back to a normal state when the deviation really triggered a dire chain of events for your system.

"},{"location":"reference/tutorials/run-flow/#one-experiment-but-a-variety-of-execution-strategies","title":"One experiment but a variety of execution strategies","text":"

Schematically, the execution flow runs the hypothesis, the method, the hypothesis again and finally the rollbacks. However, this flow can somewhat controlled via the Chaos Toolkit runtime flags.

"},{"location":"reference/tutorials/run-flow/#hypothesis-strategies","title":"Hypothesis strategies","text":"

The default behavior is to execute the hypothesis before and after the method. Unless, the hypothesis fails during the \u201cbefore\u201d phase. In that case, the execution terminates as \"failed\" to signal the system wasn\u2019t in an appropriate baseline state for the experiment to make sense.

The chaos run command provides the --hypothesis-strategy flag to change the default behavior.

Sometimes, you have an experiment where you know the state is not appropriate but you want to see if a specific condition could bring it back and make the hypothesis valid after the method was applied. In that case, you should use --hypothesis-strategy=after-method-only.

On the contrary, if you don\u2019t want to assert any deviation, you can decide to run the hypothesis only before with --hypothesis-strategy=before-method-only.

More interesting use cases can then be applied. What if you have a long method and wish to not wait until it finishes to verify the hypothesis. Well, then you can use `--hypothesis-strategy=continuously to indicate that, on top of the default behavior, you want the hypothesis block to be applied during the method periodically. You can change the period, which defaults to every second, with --hypothesis-frequency=10. Notice that, in that case, Chaos Toolkit will not interrupt as soon as a deviation is found. To do that, you need to pass the additional --fail-fast flag.

Finally, you can also use --hypothesis-strategy=during-method-only to have the same behavior as continuously but removing the default verification before and after the method.

"},{"location":"reference/tutorials/run-flow/#rollback-strategies","title":"Rollback strategies","text":"

Rollbacks are always executed save for three conditions:

You may change that behavior with a chaos run flag.

Pass --rollback-strategy=always to apply rollbacks no matter the state of the execution.

Use --rollback-strategy=never to never play them. This can be useful during authoring of the experiment sometimes.

Use --rollback-strategy=deviated to play rollbacks only if a deviation was found.

"},{"location":"reference/tutorials/run-flow/#terminating-the-execution-gracefully","title":"Terminating the execution gracefully","text":"

Chaos Engineering is a powerful practice that may lead to undesirable side effects in your system. Sometimes, it is expected that an operator, or an automated service, terminates an experiment much earlier to prevent further difficulties.

"},{"location":"reference/tutorials/run-flow/#lets-start-with-the-default-behavior","title":"Let\u2019s start with the default behavior","text":"

When an experiment runs to its end it means that, even if a deviation was found, the Chaos Toolkit should leave nothing hanging around, such as zombie processes. Also, if rollbacks were declared and requested to be applied, they will be played. In other words, if your experiment is properly constructed, you should not have to do anything else.

Chaos Toolkit makes no promises that your system will be back to its normal however. The discovery you make along the way usually resolves in impacts that cannot be anticipated.

This means that when an experiment finishes, your system may well be in a very strange state but it does not mean Chaos Toolkit failed at doing its job. In fact, it\u2019s quite the exact nature of the beast: Chaos Engineering is making those pain points very clear to all.

Experiments can be interrupted. In that case, Chaos Toolkit tries its best to abide by the runtime condition that you set. For instance, if you decided to always play the rollbacks, Chaos Toolkit will execute them. The default behavior is not to play them however for the simple reason that if you interrupted an experiment, you may well want to investigate the system and if rollbacks were executed, you may lose some important traces or state.

"},{"location":"reference/tutorials/run-flow/#digging-into-the-interruptions-flow","title":"Digging into the interruption\u2019s flow","text":"

When the Chaos Toolkit receives a signal, it starts the termination flow of the experiment:

"},{"location":"reference/tutorials/run-flow/#reacting-to-signals-aka-being-a-good-citizen","title":"Reacting to signals, aka being a good citizen","text":"

The Chaos Toolkit knows it makes operators confident it will act appropriately upon receiving a variety of signals. It supports therefore the following signals:

In all cases, the termination flow is triggered. The only different one is SIGUSR2 which will always ignore rollbacks and will not wait for background activities to terminate normally. In other words, SIGUSR2 is the only way you can terminate harshly an experiment.

Otherwise, there are no visible difference between SIGINT, SIGTERM and SIGUSR1.

"},{"location":"reference/tutorials/tolerance/","title":"Learn all about Steady-State Hypothesis Tolerances","text":"

A Chaos Engineering experiment starts and ends with a steady-state hypothesis.

The objective is initially to act as a validation gateway whereby, if the steady-state is not met before we execute the method, then the experiment bails out. What can you learn from an unknown state already?

Then, once the method has been applied, the goal is understand if the system coped with the turbulence or if it deviated, implying a weakness may have been uncovered.

To achieve this, the Chaos Toolkit experiment expects you use probes to query your system\u2019s state during the steady-state hypothesis. The validation of the probes\u2019 output is performed by what we call tolerances.

"},{"location":"reference/tutorials/tolerance/#lets-get-started-with-a-basic-example","title":"Let\u2019s get started with a basic example","text":"

Let\u2019s take the simple experiment below:

JSONYAML
{\n\"title\": \"Our default language is English\",\n\"description\": \"We find the expected English language in the file\",\n\"steady-state-hypothesis\": {\n\"title\": \"Our hypothesis is that lang file is in English\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"lookup-lang-file\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"default.locale.txt\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"switch-language-to-french\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"sed\",\n\"arguments\": \"-i s/hello/bonjour/ default.locale.txt\"\n}\n}\n],\n\"rollbacks\": [\n{\n\"type\": \"action\",\n\"name\": \"switch-language-back-to-english\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"sed\",\n\"arguments\": \"-i s/bonjour/hello/ default.locale.txt\"\n}\n}\n]\n}\n
title: Our default language is English\ndescription: We find the expected English language in the file\nsteady-state-hypothesis:\ntitle: Our hypothesis is that lang file is in English\nprobes:\n- type: probe\nname: lookup-lang-file\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: default.locale.txt\n- type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\nmethod:\n- type: action\nname: switch-language-to-french\nprovider:\ntype: process\npath: sed\narguments: '-i s/hello/bonjour/ default.locale.txt'\nrollbacks:\n- type: action\nname: switch-language-back-to-english\nprovider:\ntype: process\npath: sed\narguments: '-i s/bonjour/hello/ default.locale.txt'\n

This experiment looks for the welcome message in the default locale file and expected \"hello\".

Here is an example of it running:

chaos run experiment.json\n
[2019-06-25 21:37:59 INFO] Validating the experiment's syntax\n[2019-06-25 21:37:59 INFO] Experiment looks valid\n[2019-06-25 21:37:59 INFO] Running experiment: Our default language is English\n[2019-06-25 21:37:59 INFO] Steady state hypothesis: Our hypothesis is that lang file is in English\n[2019-06-25 21:37:59 INFO] Probe: lookup-lang-file\n[2019-06-25 21:37:59 INFO] Probe: lookup-text-in-lang-file\n[2019-06-25 21:37:59 INFO] Steady state hypothesis is met!\n[2019-06-25 21:37:59 INFO] Action: switch-language-to-french\n[2019-06-25 21:37:59 INFO] Steady state hypothesis: Our hypothesis is that lang file is in English\n[2019-06-25 21:37:59 INFO] Probe: lookup-lang-file\n[2019-06-25 21:37:59 INFO] Probe: lookup-text-in-lang-file\n[2019-06-25 21:37:59 INFO] Steady state hypothesis is met!\n[2019-06-25 21:37:59 INFO] Let's rollback...\n[2019-06-25 21:37:59 INFO] Rollback: switch-language-back-to-english\n[2019-06-25 21:37:59 INFO] Action: switch-language-back-to-english\n[2019-06-25 21:37:59 INFO] Experiment ended with status: completed\n

In this experiment, we have two probes checking two basic facets of our system. First, we ensure the locale file exists and then we validate the file contains our expected value.

Let\u2019s now analyse the two tolerances we used.

First, we use a Python provider which calls the os.path.exists(path) standard library function. This function returns a boolean and that is what the tolerance checks for.

The second probe calls a process which sets its exit code to 0 when the command succeeds. Again, this is the value that the tolerance validates.

Now that we know the basics, let\u2019s move on to see what are the supported tolerances.

"},{"location":"reference/tutorials/tolerance/#built-in-supported-tolerances","title":"Built-in supported tolerances","text":"

The experiment specification describes the supported tolerances but let\u2019s review them more pragmatically here.

Chaos Toolkit aims at being easy for simple tasks whenever it can. In this case, for the general use-cases, we support the following tolerances:

In these three cases, the probe\u2019s output must equal the given tolerance.

On top of this native types, we support also more advance cases such as:

JSONYAML
{\n\"type\": \"range\",\n\"range\": [6.4, 7.5]\n}\n
type: range\nrange:\n- 6.4\n- 7.5\n

The range is an inclusive min-max range made of numerical values. This is handy when validating a gauge for instance.

JSONYAML
{\n\"type\": \"regex\",\n\"target\": \"stdout\",\n\"pattern\": \"^welcome=hello$\"\n}\n
type: regex\ntarget: stdout\npattern: \"^welcome=hello$\"\n

Currently supported targets per provider are as follows:

Provider Default Values process \"status\" \"stdout\", \"stderr\" http \"status\" \"headers\", \"body\" python Undefined Undefined JSONYAML
{\n\"type\": \"jsonpath\",\n\"path\": \"...\"\n}\n
type: jsonpath\npath: ...\n

The path must be a valid JSONPath supported by the jsonpath2 library. This is handy when looking for a value in a mapping output.

JSONYAML
{\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n...\n}\n}\n
type: probe\nprovider:\ntype: python\n

In that case the tolerance is run as yet another probe which must return a boolean. The probe must accept an argument called value that is set to the output of the steady-state probe. In essence, a probe validating the output of another probe. This is advanced stuff only used when the builtin probes won\u2019t cut it.

"},{"location":"reference/tutorials/tolerance/#common-scenarios","title":"Common scenarios","text":"

Let\u2019s now review how to apply these tolerances to most common scenarios.

"},{"location":"reference/tutorials/tolerance/#validate-the-return-code-of-a-boolean-python-probe","title":"Validate the return code of a boolean Python probe","text":"

In this case, the simple boolean tolerance will do.

For instance:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-lang-file\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"default.locale.txt\"\n}\n}\n}\n
type: probe\nname: lookup-lang-file\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: default.locale.txt\n
"},{"location":"reference/tutorials/tolerance/#validate-the-exit-code-of-a-process","title":"Validate the exit code of a process","text":"

In this case, the simple integer tolerance will do. Indeed, the Chaos Toolkit will look by default to the exit code of the process for validation.

In the above example:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\n

Assuming, we would be expecting an error, which commonly translates to an exit code 1, we would switch to \"tolerance\": 1.

"},{"location":"reference/tutorials/tolerance/#validate-the-status-code-of-a-http-probe","title":"Validate the status code of a HTTP probe","text":"

In this case, the simple integer tolerance will do. Indeed, the Chaos Toolkit will look by default to the status code of the HTTP response for validation.

For instance:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entity\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance: 200\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entity'\n
"},{"location":"reference/tutorials/tolerance/#specific-scenarios","title":"Specific scenarios","text":""},{"location":"reference/tutorials/tolerance/#validate-the-stdoutstderr-of-a-process","title":"Validate the stdout/stderr of a process","text":"

Assuming you want to validate the actual standard output of a process, you need to got a regular expression approach, as follows:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": {\n\"type\": \"regex\",\n\"pattern\": \"welcome=hello\",\n\"target\": \"stdout\"\n},\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"cat\",\n\"arguments\": \"default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance:\ntype: regex\npattern: welcome=hello\ntarget: stdout\nprovider:\ntype: process\npath: cat\narguments: default.locale.txt\n

The important extra property to set here is target which tells the Chaos Toolkit where to locate the value to apply the pattern against. The reason we set stdout here is because a process probe returns an object made of three properties: \"status\", \"stdout\" and \"stderr\".

"},{"location":"reference/tutorials/tolerance/#validate-the-json-body-of-a-http-probe","title":"Validate the JSON body of a HTTP probe","text":"

In this case, use a jsonpath tolerance.

For instance, let\u2019s assume you receive the following JSON payload:

{\n\"foo\": [{\"baz\": \"hello\"}, {\"baz\": \"bonjour\"}]\n}\n
JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"expect\": [\"hello\", \"bonjour\"],\n\"target\": \"body\"\n},\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entities\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\nexpect:\n- hello\n- bonjour\ntarget: body\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entities'\n

The expect property tells the Chaos Toolkit what are the values to match against once the JSON Path has been applied against the body of the response of the HTTP probe\u2019s output.

You may also validate against a number of extracted values instead:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"count\": 2,\n\"target\": \"body\"\n},\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entities\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\ncount: 2\ntarget: body\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entities'\n
"},{"location":"reference/tutorials/tolerance/#validate-the-output-of-a-python-probe-returning-a-mapping","title":"Validate the output of a Python probe returning a mapping","text":"

In this case, use a jsonpath tolerance.

For instance, let\u2019s assume you receive the following payload:

{\n\"foo\": [{\"baz\": \"hello\"}, {\"baz\": \"bonjour\"}]\n}\n
JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"expect\": [\"hello\", \"bonjour\"]\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"...\",\n\"func\": \"...\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\nexpect:\n- hello\n- bonjour\nprovider:\ntype: python\nmodule: ...\nfunc: ...\n

The expect property tells the Chaos Toolkit what are the values to match against once the JSON Path has been applied against the probe\u2019s output.

You may also validate against a number of extracted values instead:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"count\": 2\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"...\",\n\"func\": \"...\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\ncount: 2\nprovider:\ntype: python\nmodule: ...\nfunc: ...\n
"},{"location":"reference/tutorials/tolerance/#advanced-scenarios","title":"Advanced Scenarios","text":"

The last case you may be reviewing now is when the default tolerances cannot support your use case. Then, you want to create your own tolerance by writing a new probe that takes the output, of the tolerance under validation, as an argument. Usually, this tolerance probe is implemented in Python to have more power but this isn\u2019t compulsory.

For instance, the following:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\n

could be written as follows:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": {\n\"name\": \"search-text\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"my.package\",\n\"func\": \"search_text\",\n\"arguments\": {\n\"path\": \"default.local.txt\",\n\"search_for\": \"welcome=hello\"\n}\n}\n},\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"cat\",\n\"arguments\": \"default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance:\nname: search-text\ntype: probe\nprovider:\ntype: python\nmodule: my.package\nfunc: search_text\narguments:\npath: default.local.txt\nsearch_for: welcome=hello\nprovider:\ntype: process\npath: cat\narguments: default.locale.txt\n

In that case, implement the search_text(path: str, search_for: str, value: dict) -> bool function in the my.package Python module.

import re\n\n\ndef search_text(path: str, search_for: str, value: dict = None) -> bool:\n    with open(path) as f:\n        content = f.read()\n        return re.compile(search_for).match(value[\"stdout\"]) is not None\n

As you can see, the value argument is not declared but must exist in the signature of the function. It is injected by the Chaos Toolkit and is set to the probe\u2019s output.

"},{"location":"reference/usage/cli/","title":"Overview","text":"

The heart of the Chaos Toolkit is the chaos command line.

Activate the Python virtual environment

If you run the Chaos Toolkit directly, rather than using a container, always ensure you have activated the virtual environment so that it can be found along its dependencies:

source ~/.venvs/chaostk/bin/activate\n

Once installed, the Chaos Toolkit CLI will display the commands it supports by executing:

chaos --help\n
Usage: chaos [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --version                   Show the version and exit.\n  --verbose                   Display debug level traces.\n  --no-version-check          Do not search for an updated version of the\n                              chaostoolkit.\n  --change-dir TEXT           Change directory before running experiment.\n  --no-log-file               Disable logging to file entirely.\n  --log-file TEXT             File path where to write the command's log.\n                              [default: chaostoolkit.log]\n  --log-format [string|json]  Console logging format: string, json.\n  --settings TEXT             Path to the settings file.  [default:\n                              /Users/ciaran/.chaostoolkit/settings.yaml]\n  --help                      Show this message and exit.\n\nCommands:\n  discover  Discover capabilities and experiments.\n  info      Display information about the Chaos Toolkit environment.\n  init      Initialize a new experiment from discovered capabilities.\n  run       Run the experiment loaded from SOURCE, either a local file or...\n  settings  Read, write or remove from your settings file.\n  validate  Validate the experiment at SOURCE.\n

"},{"location":"reference/usage/cli/#configure-the-chaos-toolkit","title":"Configure the Chaos Toolkit","text":"

For the most part, the Chaos Toolkit does not need to be configured. However, if it does, the settings are stored in a YAML file on your local machine.

Tip

Unless you enable one of the features requiring extra configuration, you don\u2019t need to create that file. If a feature requires extra configuration, its documentation will say so.

"},{"location":"reference/usage/cli/#create-the-settings-file","title":"Create the settings file","text":"

The settings file for the Chaos Toolkit should be located under the following path:

$HOME/.chaostoolkit/settings.yaml\n

As this file may hold sensitive data, it is advised to make it readable only for your own user:

chmod 600 $HOME/.chaostoolkit/settings.yaml\n
"},{"location":"reference/usage/cli/#how-to-investigate-issues","title":"How to Investigate Issues","text":"

When your experiment fails to work as you would expect, you should start looking at the chaostoolkit.log file written to by the chaos command.

This file contains a lot of traces from the Chaos Toolkit core but also any extensions that used the toolkit\u2019s logger.

As new logs are appended to that file, it may grow big. Do not hesitate to wipe it out from time to time.

Please, do make sure to visit our Slack or GitHub when you have a question around how the toolkit does things. The community will be pleased to help you out.

"},{"location":"reference/usage/discover/","title":"The chaos discover command","text":"

You use the chaos discover command to specify a Chaos Toolkit integration extension and, if supported by the integration, to then explore your target environment in order to build a discovery report that can be used by the chaos init command to help you bootstrap your own chaos engineering experiments.

You can see the options available to you by executing:

chaos discover --help\n
Usage: chaos discover [OPTIONS] PACKAGE\n\n  Discover capabilities and experiments.\n\nOptions:\n  --no-system-info       Do not discover system information.\n  --no-install           Assume package already in PYTHONPATH.\n  --discovery-path TEXT  Path where to save the the discovery outcome.\n                         [default: ./discovery.json]\n  --help                 Show this message and exit.\n

A tutorial on how to use the chaos discover command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/discover/#discovering-capabilities-and-experiments","title":"Discovering capabilities and experiments","text":"

To execute discover all you need to do is specify the Chaos Toolkit integration extension that you\u2019d like to use, for example to use Kubernetes:

chaos discover chaostoolkit-kubernetes\n
[2021-07-30 11:43:38 INFO] Attempting to download and install package 'chaostoolkit-kubernetes'\n[2021-07-30 11:43:45 INFO] Package downloaded and installed in current environment\n[2021-07-30 11:43:45 INFO] Discovering capabilities from chaostoolkit-kubernetes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.deployment.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.deployment.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.node.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.node.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.pod.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.pod.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.replicaset.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.service.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.service.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.statefulset.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.statefulset.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.crd.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.crd.probes\n[2021-07-30 11:43:45 INFO] Discovery outcome saved in ./discovery.json\n

The chaos discover command will produce a report saved in ./discovery.json by default, although you can specify where this report is produced by supplying the --discovery-report-path option.

"},{"location":"reference/usage/discover/#discovery-without-system-information","title":"Discovery without System Information","text":"

To not probe the target system during the discovery process you can supply the --no-system-info option.

"},{"location":"reference/usage/discover/#discovery-without-installation-of-an-integration-extension","title":"Discovery without Installation of an Integration Extension","text":"

If you already have the integration extension installed and available you can speed up the discovery process by specifying the --no-install option.

"},{"location":"reference/usage/init/","title":"The chaos init command","text":"

You use the chaos init command to take a discovery report, usually created by the chaos discover command, to then create an experiment based upon what has been discovered about the integration extension and, if applicable, the target environment.

You can see the options available to you by executing:

chaos init --help\n
Usage: chaos init [OPTIONS]\n\n  Initialize a new experiment from discovered capabilities.\n\nOptions:\n  --discovery-path PATH   Path to the discovery outcome.  [default:\n                          ./discovery.json]\n  --experiment-path PATH  Path where to save the experiment (.yaml or .json)\n                          [default: ./experiment.json]\n  --help                  Show this message and exit.\n

A tutorial on how to use the chaos init command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/init/#initialise-a-new-experiment","title":"Initialise a new experiment","text":"

To initialise a new experiment based on what has been discovered you simply need to execute the chaos init command:

chaos init\n
The following is a capture of the output after running chaos init and following the interactive prompts: [2018-01-30 15:54:50 INFO] Let's build a new experiment Experiment's title: My new experiment Add an activity to your method Activity (0 to escape): 1 Kill a microservice by `name` in the namespace `ns`. The microservice is killed by deleting the deployment for it without a graceful period to trigger an abrupt termination. The selected resources are matched by the given `label_selector`. Do you want to use this action? [y/N]: y Argument's value for 'name': Argument's value for 'ns' [default]: Argument's value for 'label_selector' [name in ({name})]: app=webapp-app Do you want to select another activity? [y/N]: N [2018-01-30 15:55:21 INFO] Experiment created and saved in './experiment.json'

By default, the chaos init command will look for a ./discovery.json file and use that as the basis of a new experiment\u2019s initialisation.

You can specify another file to be used by suppling the --discovery-report-path option.

In addition the default output from the init command will be a new Chaos Toolkit experiment definition in a ./experiment.json file. If you would prefer a different filename then this can be specified using the --experiment-path option.

"},{"location":"reference/usage/install/","title":"How to Install the Chaos Toolkit","text":""},{"location":"reference/usage/install/#python-requirements","title":"Python Requirements","text":"

The chaostoolkit CLI is implemented in Python 3 and this requires a working Python installation to run. It officially supports Python 3.7+. It has only been tested against CPython.

"},{"location":"reference/usage/install/#install-python","title":"Install Python","text":"

Install Python for your system:

On MacOS X:

brew install python3\n

On Debian/Ubuntu:

sudo apt-get install python3 python3-venv\n

On Windows:

Download the latest binary installer from the Python website.

"},{"location":"reference/usage/install/#create-a-virtual-environment","title":"Create a virtual environment","text":"

Dependencies can be installed for your system via its package management but, more likely, you will want to install them yourself in a local virtual environment.

python3 -m venv ~/.venvs/chaostk\n

Make sure to always activate your virtual environment before using it:

source  ~/.venvs/chaostk/bin/activate\n

Tip

You may want to use virtualenvwrapper to make this process much nicer.

"},{"location":"reference/usage/install/#install-the-cli","title":"Install the CLI","text":"

Install chaostoolkit in the virtual environment as follows:

pip install -U chaostoolkit\n

You can verify the command was installed by running:

chaos --version\n
"},{"location":"reference/usage/install/#install-extensions","title":"Install Extensions","text":"

At this stage, you have installed the chaos command line and its core library. To fully enjoy the Chaos Toolkit, you will also want to install extensions for the various facets of your journey into Chaos Engineering.

"},{"location":"reference/usage/notification/","title":"Get Notifications From The Chaos Toolkit Flow","text":"

The Chaos Toolkit generates events when it is executed. You may benefit from those events to get notified via your chosen notification channels.

"},{"location":"reference/usage/notification/#chaos-toolkit-flow-events","title":"Chaos Toolkit Flow Events","text":"

The Chaos Toolkit defines the following events:

Discovery flow

Init flow

Run flow

Validate flow

"},{"location":"reference/usage/notification/#notification-event-structure","title":"Notification Event Structure","text":"

The events structure is as follows:

{\n\"name\": \"run-started|...\",\n\"payload\": \"the payload for the given event\",\n\"phase\": \"run|discovery|init|validate\",\n\"error\": \"only set when an error was triggered. Set to the actual raw error\",\n\"ts\": \"<now>\"\n}\n

Note, the error is not a failure of the experiment\u2019s steady-state but an error during the processing of the flow (for instance, the experiment\u2019s file has a mistake somewhere in its syntax, or an exception is raised somehow).

"},{"location":"reference/usage/notification/#declare-notification-channels","title":"Declare Notification Channels","text":"

Notification channels are declared in the Chaos Toolkit settings file under the notifications: section.

Here is an example:

notifications:\n- type: http\nurl: https://mystuff.com/api\nverify_tls: false\nheaders:\nAuthorization: \"Bearer 1234\"\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

As you can see, channels are items in a list. Each channel is a mapping describing the kind of channel and its required information.

For instance, here we have two channels. The first one is a call to the HTTPS endpoint while the other one uses the Chaos Toolkit Extension for Slack to send messages to Slack channels.

Warning

Notification channels are run sequential to the whole chaos flow, so the more you declare, the bigger the impact they could have on the readability of the experiment results.

"},{"location":"reference/usage/notification/#filter-events","title":"Filter Events","text":"

By default, all events are sent to the channels. However, you may decide, on a per channel basis, which events you want to be sent. This is done by adding the events field to a channel:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\nevents:\n- run-failed\n

The Slack channel will only receive events when a run experiment fails. This is a list so declare as many events as you need.

"},{"location":"reference/usage/notification/#http-notification-channel","title":"HTTP Notification Channel","text":"

A HTTP notification channel tells the Chaos Toolkit it must send the event over HTTP (or HTTPS) to the given endpoint. Here is the description of its fields:

"},{"location":"reference/usage/notification/#plugin-notification-channel","title":"Plugin Notification Channel","text":"

A plugin notification channel is an integration between an external system and the Chaos Toolkit event notification flow. It is more capable than basic HTTP channels as they are fully fledged Python functions.

Warning

A plugin channel could also be understood as a hook point into the Chaos Toolkit flow. Nothing prevents you from writing a plugin that performs operations based on those hook events. Please note however that they run sequentially to the whole flow, so the longer your operation takes, the longer it takes for your chaos experiment to carry on. This may invalidate certain experiments when timing is critical.

Here are the fields to declare one:

Any other fields will be passed on as-is to the function for its internal usage. For instance:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

The token and channel fields will be provided directly to the notify function of the chaosslack.notification module.

"},{"location":"reference/usage/notification/#send-notifications-to-slack","title":"Send Notifications To Slack","text":"

Notifying about Chaos Experiment runs in a Slack channel is so common that we will describe this integration here.

First, you must install the Chaos Toolkit Integration for Slack:

pip install -U chaostoolkit-slack\n

Then, you should declare your notification channels as follows in the Chaos Toolkit settings file:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

You may define as many channels as you need, for instance for different kind of events.

The token and channel fields are mandatory in this case. The token field must be set to a valid Slack token. You may start with a legacy token before moving on to a Slack App as per Slack guidelines.

The Chaos Toolkit itself does not provide a Slack App at this moment.

The channel must be a name of an existing channel. The payload message sent to Slack is defined in the plugin. If you need to amend it, please open an issue there.

"},{"location":"reference/usage/notification/#debugging-notifications","title":"Debugging Notifications","text":"

The Chaos Toolkit does its best to not break the experiment when an event could not be pushed. If you do not see the notification you were expecting, you should start investigating in the chaostoolkit.log file. If Chaos Toolkit could handle the issue gracefully, it will log the error at the DEBUG level.

If the error occurs inside the core Chaos Toolkit library, please raise an issue there. Otherwise, raise an issue with the appropriate plugin.

"},{"location":"reference/usage/report/","title":"The chaos report command","text":"

You use the chaos report command to take the journal produced by the chaos run command and produce a report in a specified format.

Due to the many operating system-dependent features that the chaos report command relies upon, the chaos report command is not installed with the Chaos Toolkit CLI. To install the chaos report command you need to install the chaostoolkit-reporting plugin and the dependencies appropriate to your own operating system.

Once the plugin is installed you can see the options available to you by executing:

chaos report --help\n
Usage: chaos report [OPTIONS] [JOURNAL]... REPORT\n\n  Generate a report from the run journal(s).\n\nOptions:\n  --export-format TEXT  Format to export the report to: html, markdown, pdf.\n  --help                Show this message and exit.\n

A tutorial on how to use the chaos report command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/report/#generating-a-report","title":"Generating a report","text":"

When an experiment completes after using the chaos run command a journal is generated and stored in the chaos-report.json file. A PDF or HTML report may be generated from this journal using the chaostoolkit-reporting library.

The chaos report command expects the path to the chaos-report.json file and a path to the actual report file that you require.

You can export various formats of report by specifying what you want using the --export-format option.

For example, to generate a PDF report you can run the following command:

chaos report --export-format=pdf chaos-report.json report.pdf\n

An HTML report can be produced using:

chaos report --export-format=html5 chaos-report.json report.html\n
"},{"location":"reference/usage/run/","title":"The chaos run command","text":"

You use the chaos run command to execute your declarative chaos engineering experiments. To see the options that can be passed to the chaos run command, execute:

chaos run --help\n
Usage: chaos run [OPTIONS] SOURCE\n\n  Run the experiment loaded from SOURCE, either a local file or a HTTP\n  resource. SOURCE can be formatted as JSON or YAML.\n\nOptions:\n  --journal-path TEXT             Path where to save the journal from the\n                                  execution.\n  --dry                           Run the experiment without executing\n                                  activities.\n  --no-validation                 Do not validate the experiment before\n                                  running.\n  --no-verify-tls                 Do not verify TLS certificate.\n  --rollback-strategy [default|always|never|deviated]\n                                  Rollback runtime strategy. Default is to\n                                  never play them on interruption or failed\n                                  hypothesis.\n  --var TEXT                      Specify substitution values for\n                                  configuration only. Can be provided multiple\n                                  times. The pattern must be key=value or\n                                  key:type=value. In that latter case, the\n                                  value will be casted as the specified type.\n                                  Supported types are: int, float, bytes. No\n                                  type specified means a utf-8 decoded string.\n  --var-file PATH                 Specify files that contain configuration and\n                                  secret substitution values. Either as a\n                                  json/yaml payload where each key has a value\n                                  mapping to a configuration entry. Or a .env\n                                  file defining environment variables. Can be\n                                  provided multiple times.\n  --hypothesis-strategy [default|before-method-only|after-method-only|during-method-only|continuously]\n                                  Strategy to execute the hypothesis during\n                                  the run.\n  --hypothesis-frequency FLOAT    Pace at which running the hypothesis. Only\n                                  applies when strategy is either: during-\n                                  method-only or continuously\n  --fail-fast                     When running in the during-method-only or\n                                  continuous strategies, indicate the\n                                  hypothesis can fail the experiment as soon\n                                  as it deviates once. Otherwise, keeps\n                                  running until the end of the experiment.\n  --help                          Show this message and exit.\n

A tutorial on how to use the chaos run command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/run/#executing-an-experiment-plan","title":"Executing an Experiment Plan","text":"

To execute an experiment plan you simply pass it to the chaos run command:

chaos run experiment.json\n
[2018-01-30 16:35:04 INFO] Validating experiment's syntax\n[2018-01-30 16:35:04 INFO] Experiment looks valid\n[2018-01-30 16:35:04 INFO] Running experiment: My new experiment\n[2018-01-30 16:35:04 INFO] No steady state hypothesis defined. That's ok, just exploring.\n[2018-01-30 16:35:04 INFO] Action: kill_microservice\n[2018-01-30 16:35:04 INFO] No steady state hypothesis defined. That's ok, just exploring.\n[2018-01-30 16:35:04 INFO] Let's rollback...\n[2018-01-30 16:35:04 INFO] No declared rollbacks, let's move on.\n[2018-01-30 16:35:04 INFO] Experiment ended with status: completed\n

Chaos Toolkit will log all the steps it follows from your plan in a journal which by default is called journal.json. You can specify the name of this journal output file using the --journal-path option.

"},{"location":"reference/usage/run/#rehearsing-an-experiment-execution","title":"Rehearsing an experiment execution","text":"

To test that you have a valid experiment you can pass the --dry option.

"},{"location":"reference/usage/run/#run-an-experiment-without-validation","title":"Run an experiment without validation","text":"

You can run an experiment and skip the experiment\u2019s validation using the --no-validation option.

"},{"location":"reference/usage/run/#run-an-experiment-with-different-steady-state-strategies","title":"Run an experiment with different steady state strategies","text":"

By default, the steady state will be tested before and after an experiment runs. However, you can specify a different strategy through the --hypothesis-strategy parameter. The options are:

For example:

chaos run ./experiment.json --hypothesis-strategy continuously\n

"},{"location":"reference/usage/run/#run-an-experiment-with-different-rollback-strategies","title":"Run an experiment with different rollback strategies","text":"

In Chaos Toolkit, rollbacks are always played unless one of the two followings is true:

The Chaos Toolkit provides a mechanism (since v1.5.0) that gives the operator a chance to change that behavior.

"},{"location":"reference/usage/run/#always-run-rollbacks","title":"Always run rollbacks","text":"

Ensure rollbacks are always applied

chaos run --rollback-strategy=always experiment.json\n
"},{"location":"reference/usage/run/#run-rollbacks-only-on-deviation","title":"Run rollbacks only on deviation","text":"

Run the rollbacks only if your experiment deviated.

chaos run --rollback-strategy=deviated experiment.json\n
"},{"location":"reference/usage/run/#never-run-rollbacks-strategy","title":"Never run rollbacks strategy","text":"

Never run any rollbacks, for instance when you want to explore the system after a successful experiment without undoing what the experiment changed:

chaos run --rollback-strategy=never experiment.json\n
"},{"location":"reference/usage/run/#override-configuration-and-secrets-at-runtime","title":"Override configuration and secrets at runtime","text":"

While configuration and secrets are declared in the experiment itself, you may sometimes need to override the values at runtime. This can be achieved through the --var KEY[:TYPE]=VALUE or --var-file filepath.json|yaml|.env flags.

The --var KEY[:TYPE]=VALUE can only override configuration values to prevent laking secrets on the command line. The KEY is the final key used in the experiment, for instance:

{\n\"configuration\": {\n\"message\": \"hello world\"\n}\n}\n

or

{\n\"configuration\": {\n\"message\": {\n\"type\": \"env\",\n\"key\": \"MY_MESSAGE\"\n}\n}\n}\n

In both cases, the override key is message.

If you specify the TYPE it must be one of str, int, float, bytes with str the default so not required. Chaos Toolkit will try to convert the given VALUE to the specified type and fail if it cannot.

The --var-file filepath.json|yaml|.env gives you the opportunity to override the configuration and secrets blocks. the format of the json and yaml files are as follows:

{\n\"configuration\": {\n\"KEY\": VALUE\n},\n\"secrets\": {\n\"scope\": {\n\"KEY\": VALUE\n}\n}\n}\n
---\nconfiguration:\nKEY: VALUE\nsecrets:\nscope:\nKEY: VALUE\n

The secrets block follows the same format as the experiment so the scope is the scope given in the experiment. For example:

{\n\"configuration\": {\n\"service_name\": \"ec2\"\n},\n\"secrets\": {\n\"aws\": {\n\"api_token\": \"1234\",\n\"something\": \"whatever\"\n}\n}\n}\n

would turn as the following var file:

{\n\"secrets\": {\n\"aws\": {\n\"api_token\": \"56787\"\n}\n}\n}\n

We are not overridding the configuration section and only part of the secrets section.

Finally, should you keep your variables in a .env file, it will only be able to override the configuration.

"},{"location":"reference/usage/scheduling/","title":"Scheduling your Experiments","text":"

Scheduling is not built into the Chaos Toolkit itself. However it is common to want to run an experiment periodically when you may not be at the keyboard.

In these cases we recommend using a system such as cron to schedule your experiment executions. You can also use a Kubernetes job to give you full control over the lifecycle of that job using the common Kubernetes features.

"},{"location":"reference/usage/upgrade/","title":"How to Upgrade the Chaos Toolkit","text":"

You can update your Chaos Toolkit installation by executing:

pip install -U chaostoolkit\n
"},{"location":"resources/logos/","title":"Chaos Toolkit Resources: Logos","text":"

The following resources are licensed under the CC BY 4.0 license so you can use them wherever you (presentations, web sites etc) like as long as you attribute back to the Chaos Toolkit project:

"},{"location":"resources/slides/","title":"Chaos Toolkit Resources: Slides","text":"

The following is a growing collection of slides that can be used by anyone in the community when speaking about the Chaos Toolkit. These resources are licensed under the CC BY 4.0 license so you can use them wherever you like (presentations, web sites etc) as long as you attribute back to the Chaos Toolkit project:

"},{"location":"shared/code/","title":"Chaos Toolkit Documentation Support Code","text":"

Support code for the documentation.

You may want to clone this repository to play with the code used in the tutorials.

"}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Chaos Engineering Experiments Automation","text":"

The Chaos Toolkit aims to be the simplest and easiest way to explore building your own Chaos Engineering Experiments. It also aims to define a vendor and technology independent way of specifying Chaos Engineering experiments by providing an Open API.

We suggest you start with the tutorials to get a feel for how the Chaos Toolkit can help you automate your Chaos Engineering effort. Once you are ready for your own experiments, have a look at the various driver extensions we support, which ranges from platforms to cloud providers while giving you tools to observe your system as you run your experiments.

Finally, if you came to contribute, you are more than welcome. Start with joining the community and read our references like the Open API which specifies the Chaos Toolkit experiment format.

Above all, have fun!

"},{"location":"deployment/k8s/operator/","title":"Deploy Chaos Toolkit as a Kubernetes Operator","text":"

Kubernetes operators are a popular approach to create bespoke controllers of any application on top of the Kubernetes API.

The Chaos Toolkit operator listens for experiment declarations and triggers a new Kubernetes pod, running the Chaos Toolkit with the specified experiment.

"},{"location":"deployment/k8s/operator/#deploy-the-operator","title":"Deploy the operator","text":"

The operator can be found on the Chaos Toolkit incubator.

It is deployed via typical Kubernetes manifests which need to be applied via Kustomize, the native configuration manager.

First, download the Kustomize binary:

curl -s \"https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh\" | bash\n

For macOS, you can also install it via the Homebrew package manager:

brew install kustomize\n

Next, simply run the following:

kustomize build manifests/overlays/generic-rbac | kubectl apply -f -\n

This will build the manifests and apply them on your current default cluster. Notice how we use the RBAC variant of the deployment. If you have other requirements (no-RBAC, pod security or network policies), then check the operator\u2019s documentation to deploy the appropriate variant.

You can install another variant as follows:

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl apply -f -\n

By now, you should have the operator running in the chaostoolkit-crd.

kubectl -n chaostoolkit-crd get pods\nNAME                                READY   STATUS    RESTARTS   AGE\nchaostoolkit-crd-7ddb9b78d9-dgxx7   1/1     Running   0          35s\n
"},{"location":"deployment/k8s/operator/#what-the-operator-creates-deletes","title":"What the operator creates & deletes","text":"

The operator deployment creates two namespaces, by default: - the chaostoolkit-crd namespace contains the operator pod and Chaos Toolkit experiment definitions - the chaostoolkit-run namespace contains pods running the Chaos Toolkit experiments

When you apply an experiment object, the following other objects are created in the chaostoolkit-run namespace:

On top of that, if you setup a schedule, a cron job object is created too.

In all cases, when you delete the experiment, all these objects are also deleted.

"},{"location":"deployment/k8s/operator/#options","title":"Options","text":"

All the options are hanging under the spec element of the ChaosToolkitExperiment kind object.

apiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\n...\n

None of these options are required.

Option Path Description Value Type Default Value namespace: Namespace where to create the experiment objects string chaostoolkit-run serviceaccount:\u00a0\u00a0name: Name of the service account to attach to the experiment pod string chaostoolkit role:\u00a0\u00a0name: Name of the role to attach to the experiment pod string chaostoolkit-experiment role:\u00a0\u00a0bind: Name of the rolebinding to attach to the experiment pod string chaostoolkit-experiment role:\u00a0\u00a0binds_to_namespaces: List of namespaces to add the role and its binding to list[string] [] pod:\u00a0\u00a0configMapName: Name of the config map to attach to the experiment pod string chaostoolkit-env pod:\u00a0\u00a0image: Name of if the image to use for the pod string chaostoolkit/chaostoolkit:latest pod:\u00a0\u00a0env:\u00a0\u00a0\u00a0\u00a0enabled: Do we mount environment variables from the config map into the pod? boolean true pod:\u00a0\u00a0env:\u00a0\u00a0\u00a0\u00a0secretName: Mount the secrets values from this secret as environment variables string \"\" pod:\u00a0\u00a0settings:\u00a0\u00a0\u00a0\u00a0enabled: Should we mount settings as a file to the pod boolean false pod:\u00a0\u00a0settings:\u00a0\u00a0\u00a0\u00a0secretName: Mount the given secret holding Chaos Toolkit settings as a file to the pod string chaostoolkit-settings pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0asFile: Mount the experiment\u2019s payload as file (if true) or from a URL boolean true pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0configMapName: Name of the config map holding the experiment\u2019s payload string chaostoolkit-experiment pod:\u00a0\u00a0experiment:\u00a0\u00a0\u00a0\u00a0configMapExperimentFileName: Name of experiment file mounted into the container string experiment.json pod:\u00a0\u00a0chaosArgs: Replace the default pod\u2019s arguments with these ones list[string] [] schedule:\u00a0\u00a0kind: Cron kind (only CronJob supported) string cronjob schedule:\u00a0\u00a0value: Cron-like schedule syntax string \"\""},{"location":"deployment/k8s/operator/#run-an-experiment","title":"Run an experiment","text":"

Now that your controller is listening, you can ask it to schedule a Chaos Toolkit experiment by applying a resource with the following API:

apiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\n

Below is a basic example, assuming a file named basic.yaml:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment\nnamespace: chaostoolkit-run\ndata:\nexperiment.json: |\n{\n\"title\": \"Hello world!\",\n\"description\": \"Say hello world.\",\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"say-hello\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"echo\",\n\"arguments\": \"hello\"\n}\n}\n]\n}\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\n

First, we will use the default namespace in which the Chaos Toolkit will run.

Then, we need a config map to pass the experiment to execute.

Finally, we simply create a ChaosToolkitExperiment object that the controller picks up and understand as a new experiment to run in its own pod.

Apply it as follows:

kubectl apply -f basic.yaml\n

Then, you can check the Chaos Toolkit experiment has been registered, and will be scheduled to run as soon as possible:

kubectl -n chaostoolkit-crd get ctks\n

Look at the Chaos Toolkit running:

kubectl -n chaostoolkit-run get pods\n

The status of the experiment\u2019s run, if it deviated, defines the status if the pod. So, when the experiment does deviate, the pod should have a status set to Error. Otherwise, the status will be Completed.

"},{"location":"deployment/k8s/operator/#manage-the-chaos-toolkit-experiments","title":"Manage the Chaos Toolkit Experiments","text":""},{"location":"deployment/k8s/operator/#list-and-inspect-experiments","title":"List and inspect experiments","text":"

You can list your experiments as follows:

kubectl -n chaostoolkit-crd get chaosexperiments \n

You can describe one experiment as follows:

kubectl -n chaostoolkit-crd describe chaosexperiment my-chaos-exp \n

You can also use the short names for the custom resource ctks and ctk.

"},{"location":"deployment/k8s/operator/#delete-the-experiment-runs-resources","title":"Delete the experiment run\u2019s resources","text":"

You can delete an experiment and its related resources as follows:

kubectl -n chaostoolkit-crd delete ctk my-chaos-exp \n

However, the custom resources (ConfigMap, Secrets, etc.) won\u2019t be deleted. This command only deletes the resources that the operator creates for the experiment to be able to run.

To delete all the run\u2019s resources, simply delete the objects as follows:

kubectl delete -f basic.yaml\n
"},{"location":"deployment/k8s/operator/#various-configurations","title":"Various configurations","text":"

You may decide to change various aspects of the final pod (such as passing settings as secrets, changing the roles allowed to the pod, even override the entire pod template).

"},{"location":"deployment/k8s/operator/#make-the-operator-more-verbose","title":"Make the operator more verbose","text":"

By default, the operator logs at INFO level. To enable the DEBUG level, you need to change the operator\u2019s deployment command:

In the file manifests/base/common/deployment.yaml:

Change:

  - name: crd\nimage: chaostoolkit/k8scrd:latest\nimagePullPolicy: Always\n

to:

  - name: crd\nimage: chaostoolkit/k8scrd:latest\nimagePullPolicy: Always\ncommand:\n- kopf\nargs:\n- run\n- --verbose\n- --namespace\n- chaostoolkit-crd\n- controller.py\n

Then re-deploy using Kustomize.

"},{"location":"deployment/k8s/operator/#configure-the-toolkit-with-environment-variables","title":"Configure the toolkit with environment variables","text":"

Chaos Toolkit experiments often expect data to be passed as environment variables of the chaos\u2019s command shell.

The operator allows you to specify those values through the config map:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-env\nnamespace: chaostoolkit-run\ndata:\nNAME: \"Jane Doe\"\n

They will be injected into the Chaos Toolkit\u2019s pod as environment variables.

You might need several environment config maps for various experiments. You can tell the operator where to find the config map to be loaded as environment variables.

We\u2019ll assume you defined another config map named my-chaos-env-vars. You can use it by setting the configMapName in the env block of the pod spec:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nconfigMapName: my-chaos-env-vars\n

You can disable loading environment variables into the pod by using the enabled property:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nenabled: false\n

Plain text environment variables might not be secure enough in some use cases, such as database user name & passord, API keys, tokens, etc. You can define multiple encrypted key-value pairs in a Kubernetes secret and load them as environment variables. To to so, you shall indicate the name of the secret with the secretName property.

Assuming you created a generic secret named chaostoolkit-secrets, you can load the values as shown below:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nenv:\nsecretName: chaostoolkit-secrets\n

All the key-value pairs from the secret will be injected into the Chaos Toolkit\u2019s pod as environment variables.

"},{"location":"deployment/k8s/operator/#handle-multiple-experiment-files","title":"Handle multiple experiment files","text":"

In the basic example, the name of the config map holding the experiment is the default value chaostoolkit-experiment. Usually, you\u2019ll want a more unique name since you\u2019ll probably run multiple experiments from the chaostoolkit-run namespace.

In that case, do it as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment-1234\nnamespace: chaostoolkit-run\ndata:\nexperiment.json: |\n{\n\"title\": \"...\",\n}\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nconfigMapName: chaostoolkit-experiment-1234\n

You need to define the configMapName in the experiment block of the pod spec.

"},{"location":"deployment/k8s/operator/#use-the-experiment-in-yaml-format","title":"Use the experiment in YAML format","text":"

If your experiments are encoded using YAML, you can set it as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-experiment-1234\nnamespace: chaostoolkit-run\ndata:\nexperiment.yaml: |\n---\ntitle: \"...\"\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nconfigMapName: chaostoolkit-experiment-1234\nconfigMapExperimentFileName: experiment.yaml\n
"},{"location":"deployment/k8s/operator/#load-the-experiment-from-a-url","title":"Load the experiment from a URL","text":"

By default, the experiment is read from a file. But you may store it remotely e.g. GitHub and have it available over HTTP. You might want to load it from its remote URL instead.

You can tell the Chaos Toolkit to load it from a remote URL rather than from a local file, as follows:

---\napiVersion: v1\nkind: ConfigMap\nmetadata:\nname: chaostoolkit-env\nnamespace: chaostoolkit-run\ndata:\nEXPERIMENT_URL: \"https://example.com/experiment.json\"\n---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\npod:\nexperiment:\nasFile: false\n

First, you need to pass the EXPERIMENT_URL environment variable.

Then, tell the operator not to mount the default experiment volume. To do so, you need to set asFile to false in the experiment block of the pod spec.

"},{"location":"deployment/k8s/operator/#run-experiments-in-another-namespace","title":"Run experiments in another namespace","text":"

You may create the namespace in which the resources will be deployed:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: my-other-namespace\n

You need to defined the namespace value at the spec level.

If the namespace already exists, a message will be logged but this will not abort the operation.

However, this namespace will be entirely under your responsibility. No network nor pod securities will be managed in your namespace, if the operator was installed with those variants. You\u2019ll need to manage them yourself.

"},{"location":"deployment/k8s/operator/#pass-chaos-toolkit-settings-as-a-kubernetes-secret","title":"Pass Chaos Toolkit settings as a Kubernetes secret","text":"

Chaos Toolkit reads its settings from a file and you can pass yours by creating a Kubernetes secret named, by default, chaostoolkit-settings.

For instance, assuming you have a Chaos Toolkit settings file, you can create a secret from it as follows:

kubectl -n chaostoolkit-run \\\n    create secret generic chaostoolkit-settings \\\n    --from-file=settings.yaml=./settings.yaml\n

Note, the settings file must be named as settings.yaml within the secret.

Reading settings is disabled by default, so you need to let the operator know it should allow it for that run:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nsettings:\nenabled: true\n

You need to set the variable enabled to truein the settings block of the pod spec.

The default name for that secret is chaostoolkit-settings but you can change it with the secretName variable, as follows:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nsettings:\nenabled: true\nsecretName: my-super-secret\n
"},{"location":"deployment/k8s/operator/#keep-generated-resources-even-when-the-cro-is-deleted","title":"Keep generated resources even when the CRO is deleted","text":"

When you delete the ChaosToolkitExperiment resource, all the allocated resources are deleted too (pod, service account, \u2026). To prevent this, you may set the keep_resources_on_delete property to true at the spec level.

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nkeep_resources_on_delete: true\n

In that case, you are responsible to cleanup all resources.

"},{"location":"deployment/k8s/operator/#pass-your-own-role-to-bind-to-the-service-account","title":"Pass your own role to bind to the service account","text":"

If your cluster has enabled RBAC, then the operator automatically binds a basic role to the service account associated with the chaostoolkit pod. That role allows your experiment to create/get/list/delete other pods in the same namespace.

You probably have more specific requirements, here is how to do it:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nrole:\nname: my-role\n

The property name should be set to the name of the role you have created in the namespace which the experiment is executed in. The service account associated with the pod will be bound to that role.

"},{"location":"deployment/k8s/operator/#override-the-default-chaos-command-arguments","title":"Override the default chaos command arguments","text":"

The pod template executes the chaos run command by default. You may want to extends or change the sub-command to execute when running the pod. You can define the chaos arguments as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nchaosArgs:\n- --verbose\n- run\n- --dry\n- $(EXPERIMENT_PATH)\n

You need to set the list of arguments in the chaosArgs variable at pod spec level.

"},{"location":"deployment/k8s/operator/#label-your-chaos-toolkit-experiment","title":"Label your Chaos Toolkit experiment","text":"

Experiment labels can be defined in the ChaosToolkitExperiment\u2019s metadata. All labels will be forwarded, if not already defined, in the pod running the experiment.

You can define labels as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nlabels:\nenvironment: staging\ntier: backend\ntarget: database\n

These labels can then be used as selectors.

"},{"location":"deployment/k8s/operator/#allow-network-traffic-for-chaos-toolkit-experiments","title":"Allow network traffic for Chaos Toolkit experiments","text":"

When the operator is installed with the network security variant, the chaostoolkit pod has limited network access. The pod is, by default, isolated for ingress connectivity and is limited to only DNS lookup & HTTPS for external traffic.

To allow the pod for other access, you may create another network policy within the chaostoolkit-run namespace for pods matching the app: chaostoolkit label:

---\nkind: NetworkPolicy\napiVersion: networking.k8s.io/v1\nmetadata:\nname: my-custom-network-policy\nnamespace: chaostoolkit-run\nspec:\npodSelector:\nmatchLabels:\napp: chaostoolkit\n
"},{"location":"deployment/k8s/operator/#run-periodic-and-recurring-experiments","title":"Run periodic and recurring experiments","text":"

The operator supports crontab schedule for running Chaos Toolkit experiments periodically on a given schedule.

To do so, you can define a .spec.schedule section, as follow:

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\nschedule:\nkind: cronJob\nvalue: \"*/1 * * * *\"\n

This example runs a Chaos Toolkit experiment every minute.

You can list your scheduled experiments with the kubernetes\u2019 cronjob resource:

kubectl -n chaostoolkit-run get cronjobs\n
"},{"location":"deployment/k8s/operator/#run-an-experiment-with-specific-extensions","title":"Run an experiment with specific extensions","text":"

The default container image used by the operator is the official Chaos Toolkit image which embeds no Chaos Toolkit extensions.

This means that you will likely need to create your bespoke container image. For instance, to install the Chaos Toolkit Kubernetes extension, create a Dockerfile like this:

FROM chaostoolkit/chaostoolkit\n\nUSER root\nRUN apk update && \\\napk add --virtual build-deps libffi-dev openssl-dev gcc python3-dev \\\nmusl-dev && \\\npip install --no-cache-dir chaostoolkit-addons chaostoolkit-reliably && \\\napk del build-deps\nUSER 1001\n

Then create the image with docker:

docker build --tag my/chaostoolkit -f ./Dockerfile .\n

or, something such as Podman:

podman build --tag my/chaostoolkit -f ./Dockerfile\n

You can check your image contains the installed extensions as follows:

docker run --rm -it my/chaostoolkit info extensions\n

Once this image is pushed to any registry you can access, you need to let the operator know it must use it.

---\napiVersion: chaostoolkit.org/v1\nkind: ChaosToolkitExperiment\nmetadata:\nname: my-chaos-exp\nnamespace: chaostoolkit-crd\nspec:\nnamespace: chaostoolkit-run\npod:\nimage: my/chaostoolkit\n

Tip

Note that the first time the job will create a pod will be at the end of the first period.

"},{"location":"deployment/k8s/operator/#uninstall-the-operator","title":"Uninstall the operator","text":"

To uninstall the operator and its own resources, simply run the following command for the overlay that is deployed.

kustomize build manifests/overlays/generic[-rbac[-podsec[-netsec]]] | kubectl delete -f -\n
"},{"location":"drivers/addons/","title":"Extension chaosaddons","text":"Version 0.8.6 Repository https://github.com/chaostoolkit/chaostoolkit-addons

This project provides a set of commnly requested actions, probes, tolerances or controls that can benefit the community.

"},{"location":"drivers/addons/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-addons\n
"},{"location":"drivers/addons/#develop","title":"Develop","text":""},{"location":"drivers/addons/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/addons/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/addons/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/addons/#bypass","title":"bypass","text":"

Sets the dry property on activities that match either by type or by names.

This allows to bypass some activities in certain contexts. For instance, you want to run on development but not in production certain actions.

For instance, to bypass the execution of the say-hello activity:

\"controls\": [\n{\n\"name\": \"bypass-actions\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\",\n\"arguments\": {\n\"target_names\": [\n\"say-hello\"\n]\n}\n}\n}\n],\n

For instance, to bypass the execution of all actions in the experiment:

\"controls\": [\n{\n\"name\": \"bypass-actions\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\",\n\"arguments\": {\n\"target_type\": \"action\"\n}\n}\n}\n],\n

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True False Steady-state Hypothesis False False Method False False Rollback False False Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.bypass\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.bypass\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#repeat","title":"repeat","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.repeat\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.repeat\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#safeguards","title":"safeguards","text":"

The safeguard control provides a mechanism to keep an eye on the system while running an experiment to decide if the experiment ought to stop as soon as possible or not.

For instance, let\u2019s say your system detects a dire condition that has nothing to do with this experiment. It may decide it\u2019s time for the experiment to terminate as it could create even more noise or problems.

To use this control, simply add the following to your global (or per experiment) controls block:

\"controls\": [\n{\n\"name\": \"safeguard\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.safeguards\",\n\"arguments\": {\n\"probes\": [\n{\n\"name\": \"safeguard_1\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"background\": true,\n\"tolerance\": true\n},\n{\n\"name\": \"safeguard_2\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"tolerance\": true\n},\n{\n\"name\": \"safeguard_3\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"mymodule\",\n\"func\": \"checkstuff\"\n},\n\"frequency\": 2,\n\"tolerance\": true\n}\n]\n}\n}\n}\n],\n

In this example, we declare three safeguard probes. The first one will run once in the background as soon as possible. The second one will run once before the experiment starts. The third one will run repeatedly every 2 seconds.

If either of them doesn\u2019t meet its tolerance, the entire execution will terminate as soon as possible and leave the status of the experiment to interrupted.

Probes that do not declare the background or frequency properties are meant to run before the experiment really starts and will block until they are all finished. This offers a mechanism for pre-checking the system\u2019s health.

When the properties are set, the probes run as soon as possible but do not block the experiment from carrying on.

Bear in mind that your probes can also block the process from exiting. This means that while the experiment has ended, your probe could be not returning and therefore blocking the process. Make sure your probe do not make blocking calls for too long.

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control True Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.safeguards\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.safeguards\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#synchronization","title":"synchronization","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaddons\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.controls.synchronization\"\n}\n}\n]\n}\n
controls:\n- name: chaosaddons\nprovider:\nmodule: chaosaddons.controls.synchronization\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/addons/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/addons/#controls","title":"controls","text":""},{"location":"drivers/addons/#utils","title":"utils","text":""},{"location":"drivers/addons/#idle_for","title":"idle_for","text":"Type Module chaosaddons.utils.idle Name idle_for Return null

Pauses the experiment without blocking the process completely.

Signature:

def idle_for(duration: float) -> None:\n    pass\n

Arguments:

Name Type Default Required duration number Yes

Usage:

JSONYAML
{\n\"name\": \"idle-for\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaddons.utils.idle\",\n\"func\": \"idle_for\",\n\"arguments\": {\n\"duration\": null\n}\n}\n}\n
name: idle-for\nprovider:\narguments:\nduration: null\nfunc: idle_for\nmodule: chaosaddons.utils.idle\ntype: python\ntype: ''\n
"},{"location":"drivers/ansible/","title":"Extension chaosansible","text":"Version IN_PROGESS Repository https://github.com/Mickael-Roger/chaostoolkit-ansible

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Please NOTE This extension is in the early stages of development. Please feel free to create an issue in case of needed enhancement or misfunctioning.

"},{"location":"drivers/ansible/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

pip install -U chaostoolkit-ansible\n
"},{"location":"drivers/ansible/#principles","title":"Principles","text":"

This chaos toolkit driver provides you an easy way to execute probe and/or actions using ansible modules. By using it, you can execute tasks, gather facts, \u2026 on remote systems

"},{"location":"drivers/ansible/#usage","title":"Usage","text":""},{"location":"drivers/ansible/#basic","title":"Basic","text":""},{"location":"drivers/ansible/#probes","title":"Probes","text":"

To use the probes from this package, add the following to your experiment file:

In JSON:

\"steady-state-hypothesis\": {\n\"title\": \"Tests\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"test-current-directory\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.*.task\",\n\"expect\": \"/home/me\"\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.probes\",\n\"func\": \"chaosansible_probe\",\n\"arguments\": {\n\"host_list\": [\"myserver1\", \"myserver2\"],\n\"facts\": \"yes\",\n\"ansible\": {\n\"module\": \"shell\",\n\"args\": \"pwd\"\n}\n}\n}\n}\n]\n}\n

In YAML:

---\nsteady-state-hypothesis:\ntitle: The current working directory must be /home/me\nprobes:\n- type: probe\nname: test-current-directory\ntolerance:\ntype: jsonpath\ntarget: \"$.*.task\"\npattern: /home/me\nprovider:\ntype: python\nmodule: chaosansible.probes\nfunc: chaosansible_probe\narguments:\nhost_list: [\"myserver1\", \"myserver2\"]\nfacts: True\nansible:\nmodule: shell\nargs: pwd\n

That\u2019s it!

Probes can be gathered by using the stdout of an ansible task or through the ansible gather_facts module. Each time chaostoolkit-ansible runs, it returns a json that can be used in tolerance (using jsonpath, regex, \u2026)

This json is always formatted the same way (Example for a two targets host_list):

{\n\"target1\": {\n\"fact\": \" -> JSON result of the ansible gather_facts\",\n\"task\": \" -> String result containing the stdout value of the task result - Empty when ansible task do not return stdout\"\n},\n\"target2\": {\n\"fact\": \"...\",\n\"task\": \"...\"\n}\n}\n
"},{"location":"drivers/ansible/#actions","title":"Actions","text":"

To use the actions from this package, add the following to your experiment file:

In JSON:

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\", \"server2\"],\n\"become\": true,\n\"ansible\": {\n\"module\": \"file\",\n\"args\": {\n\"path\": \"/etc/hosts\",\n\"state\": \"absent\"\n}\n}\n}\n}\n}\n]\n

In YAML:

---\nmethod:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\", \"server2\"]\nbecome: True\nansible:\nmodule: file\nargs: path: /etc/hosts\nstate: absent\n

"},{"location":"drivers/ansible/#detailled-usage","title":"Detailled usage","text":""},{"location":"drivers/ansible/#configuration-block","title":"Configuration block","text":"

The configuration block can be used to specify specific parameters to use. This block can be omit unless you really need to change default ansible parameters to run your experiment

Configuration variables that can be used by this driver are:

In case you need to change one/or many default configuration(s), you can specify your value using the configuration block

Please feel free to ask, if you need access to other ansible configuration parameters

In JSON:

\"configuration\": {\n\"ansible_ssh_private_key\": \"/home/me/.ssh/mykey\"\n}\n

In YAML:

configuration:\nansible_ssh_private_key: \"/home/me/.ssh/mykey\"\n

"},{"location":"drivers/ansible/#arguments","title":"Arguments","text":"

chaosansible_run and chaosansible_probes use arguments (Most argument are classical ansible parameters):

Argument Type Required Default value Description host_list Array localhost List of host to use facts bool false Gather_facts become bool false Escalate privilege to run task run_once bool false Run the task only once on one target num_target str all \u201call\u201d or \u201cx\u201d where x is an integer. Run the task to only x target among the host_list. Ideal to create random event ansible dict {} Execute ansible task. Cf ansible dict format. If ansible is not set, no task except ansible gather_facts (if facts set to True)

Ansible dict format:

Classic ansible task are in the form:

name: task name\nansible-module-name:\nmodule-parameter1: value1\nmodule-parameter2: value2\n

This is translate into chaos experiment file like this: In JSON

  \"ansible\": {\n\"module\": \"ansible-module-name\",\n\"args\": {\n\"module-parameter1\": \"value1\",\n\"module-parameter2\": \"value2\"\n}\n}\n

In YAML

  ansible:\nmodule: ansible-module-name\nargs:\nmodule-parameter1: value1\nmodule-parameter2: value2\n

Example with the ansible mount module (Umount a filesystem):

In JSON

  \"ansible\": {\n\"module\": \"mount\",\n\"args\": {\n\"path\": \"/data\",\n\"state\": \"unmounted\"\n}\n}\n

In YAML

  ansible:\nmodule: mount\nargs:\npath: /data\nstate: unmounted\n

"},{"location":"drivers/ansible/#example-of-usage","title":"Example of usage","text":""},{"location":"drivers/ansible/#delete-etchosts-file-on-2-random-servers-out-of-5","title":"Delete /etc/hosts file on 2 random servers out of 5","text":"

In JSON

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"],\n\"num_target\": \"2\",\n\"become\": true,\n\"ansible\": {\n\"module\": \"file\",\n\"args\": {\n\"path\": \"/etc/hosts\",\n\"state\": \"absent\"\n}\n}\n}\n}\n}\n]\n

In YAML

method:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"]\nbecome: True\nnum_target: \"2\"\nansible:\nmodule: file\nargs: path: /etc/hosts\nstate: absent\n

"},{"location":"drivers/ansible/#run-100-cpu-load-on-3-server-out-of-5","title":"Run 100% cpu load on 3 server out of 5","text":"

In JSON

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"delete-etc-hosts-file\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\",\n\"arguments\": {\n\"host_list\": [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"],\n\"num_target\": \"3\",\n\"ansible\": {\n\"module\": \"shell\",\n\"args\": {\n\"cmd\": \"stress-ng --cpu 0 --cpu-method matrixprod -t 60s\",\n}\n}\n}\n}\n}\n]\n

In YAML

method:\n- type: action\nname: delete-etc-hosts-file\nprovider:\ntype: python\nmodule: chaosansible.actions\nfunc: chaosansible_run\narguments:\nhost_list: [\"server1\",\"server2\",\"server3\",\"server4\",\"server5\"]\nbecome: True\nnum_target: \"3\"\nansible:\nmodule: shell\nargs: cmd: stress-ng --cpu 0 --cpu-method matrixprod -t 60s\n

"},{"location":"drivers/ansible/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/ansible/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/ansible/#test","title":"Test","text":"

To run the tests for the project execute the following:

pytest\n
"},{"location":"drivers/ansible/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/ansible/#actions_1","title":"actions","text":""},{"location":"drivers/ansible/#chaosansible_run","title":"chaosansible_run","text":"Type action Module chaosansible.actions Name chaosansible_run Return None

Run a task through ansible and eventually gather facts from host

Signature:

def chaosansible_run(host_list: list = 'localhost',\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     facts: bool = False,\n                     become: bool = False,\n                     run_once: bool = False,\n                     ansible: dict = {},\n                     num_target: str = 'all',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required host_list list \u201clocalhost\u201d No facts boolean false No become boolean false No run_once boolean false No ansible mapping {} No num_target string \u201call\u201d No

Usage:

{\n\"name\": \"chaosansible-run\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.actions\",\n\"func\": \"chaosansible_run\"\n}\n}\n
name: chaosansible-run\nprovider:\nfunc: chaosansible_run\nmodule: chaosansible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/ansible/#probes_1","title":"probes","text":""},{"location":"drivers/ansible/#chaosansible_probe","title":"chaosansible_probe","text":"Type probe Module chaosansible.probes Name chaosansible_probe Return None

Run a task through ansible and eventually gather facts from host

Signature:

def chaosansible_probe(host_list: list = 'localhost',\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       facts: bool = False,\n                       become: bool = False,\n                       run_once: bool = False,\n                       ansible: dict = {},\n                       num_target: str = 'all',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required host_list list \u201clocalhost\u201d No facts boolean false No become boolean false No run_once boolean false No ansible mapping {} No num_target string \u201call\u201d No

Usage:

{\n\"name\": \"chaosansible-probe\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosansible.probes\",\n\"func\": \"chaosansible_probe\"\n}\n}\n
name: chaosansible-probe\nprovider:\nfunc: chaosansible_probe\nmodule: chaosansible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/","title":"Extension chaosaws","text":"Version 0.23.4 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-aws

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/aws/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-aws\n
"},{"location":"drivers/aws/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"name\": \"stop-an-ec2-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"arguments\": {\n\"instance_id\": \"i-123456\"\n}\n}\n},\n{\n\"name\": \"create-a-new-policy\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"create_policy\",\n\"arguments\": {\n\"name\": \"mypolicy\",\n\"path\": \"user/Jane\",\n\"policy\": {\n\"Version\": \"2012-10-17\",\n\"Statement\": [\n{\n\"Effect\": \"Allow\",\n\"Action\": [\n\"s3:ListAllMyBuckets\",\n\"s3:GetBucketLocation\"\n],\n\"Resource\": \"arn:aws:s3:::*\"\n}\n]\n}\n}\n}\n}\n

Or select one at random from an AZ:

{\n\"name\": \"stop-an-ec2-instance-in-az-at-random\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"arguments\": {\n\"az\": \"us-west-1\"\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/aws/#configuration","title":"Configuration","text":""},{"location":"drivers/aws/#credentials","title":"Credentials","text":"

This extension uses the boto3 library under the hood. This library expects that you have properly configured your environment to connect and authenticate with the AWS services.

"},{"location":"drivers/aws/#use-default-profile-from-awscredentials-or-awsconfig","title":"Use default profile from ~/.aws/credentials or ~/.aws/config","text":"

This is the most basic case, assuming your default profile is properly configured in ~/.aws/credentials (or ~/.aws/config), then you do not need to pass any specific credentials to the experiment.

"},{"location":"drivers/aws/#use-a-non-default-profile-from-awscredentials-or-awsconfig","title":"Use a non-default profile from ~/.aws/credentials or ~/.aws/config","text":"

Assuming you have configure a profile in your ~/.aws/credentials (or ~/.aws/config) file, you may declare it in your experiment as follows:

{\n\"configuration\": {\n\"aws_profile_name\": \"dev\"\n}\n}\n

Your ~/.aws/credentials should look like this:

[dev]\naws_access_key_id = XYZ\naws_secret_access_key = UIOPIY\n

Or, your ~/.aws/config should look like this:

[profile dev]\noutput = json\naws_access_key_id = XYZ\naws_secret_access_key = UIOPIY\n
"},{"location":"drivers/aws/#assume-an-arn-role-from-a-non-default-profile","title":"Assume an ARN role from a non-default profile","text":"

Assuming you have configure a profile in your ~/.aws/config file with a specific ARN role you want to assume during the run:

{\n\"configuration\": {\n\"aws_profile_name\": \"dev\"\n}\n}\n

Your ~/.aws/config should look like this:

[default]\noutput = json\n\n[profile dev]\nrole_arn = arn:aws:iam::XXXXXXX:role/role-name\nsource_profile = default\n
"},{"location":"drivers/aws/#assume-an-arn-role-from-within-the-experiment","title":"Assume an ARN role from within the experiment","text":"

You mays also assume a role by declaring the role ARN in the experiment directly. In that case, the profile has no impact if you also set it.

    \"configuration\": {\n\"aws_assume_role_arn\": \"arn:aws:iam::XXXXXXX:role/role-name\",\n\"aws_assume_role_session_name\": \"my-chaos\"\n}\n

The aws_assume_role_session_name key is optional and will be set to \"ChaosToolkit\" when not provided.

When this approach is used, the extension performs a assume role call against the AWS STS service to fetch credentials dynamically.

"},{"location":"drivers/aws/#pass-credentials-explicitely","title":"Pass credentials explicitely","text":"

You can pass the credentials as a secret to the experiment definition as follows:

{\n\"secrets\": {\n\"aws\": {\n\"aws_access_key_id\": \"your key\",\n\"aws_secret_access_key\": \"access key\",\n\"aws_session_token\": \"token\",\n}\n}\n}\n
Note that the token is optional.

Then, use it as follows:

{\n\"name\": \"stop-an-ec2-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\",\n\"secrets\": [\"aws\"],\n\"arguments\": {\n\"instance_id\": \"i-123456\"\n}\n}\n}\n
"},{"location":"drivers/aws/#setting-the-region","title":"Setting the region","text":"

In additon to the authentication credentials, you must configure the region against which you want to use.

You can either declare it at the top level of the experiment, add:

{\n\"configuration\": {\n\"aws_region\": \"us-east-1\"\n}\n}\n

or

{\n\"configuration\": {\n\"aws_region\": {\n\"type\": \"env\",\n\"key\": \"AWS_REGION\"\n}\n}\n}\n

But you can also simply set either AWS_REGION or AWS_DEFAULT_REGION in your terminal session without declaring anything in the experiment.

If none of these are set, your experiment will likely fail.

"},{"location":"drivers/aws/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/aws/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/aws/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/aws/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/aws/#add-new-aws-api-support","title":"Add new AWS API Support","text":"

Once you have setup your environment, you can start adding new AWS API support by adding new actions, probes and entire sub-packages for those.

"},{"location":"drivers/aws/#services-supported-by-boto","title":"Services supported by boto","text":"

This package relies on boto3 to wrap the API calls into a fluent Python API. Some newer AWS services are not yet available in boto3, in that case, you should read the next section.

Let\u2019s say you want to support a new action in the EC2 sub-package.

Start by creating a new function in ec2/actions.py:

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import aws_client\nfrom chaosaws.types import AWSResponse\n\ndef reboot_instance(instance_id: str, dry_run: bool=False,\n                    configuration: Configuration=None,\n                    secrets: Secrets=None) -> AWSResponse:\n\"\"\"\n    Reboot a given EC2 instance.\n    \"\"\"\n    client = aws_client('ec2', configuration, secrets)\n    return client.reboot_instances(InstanceIds=[instance_id], DryRun=dry_run)\n

As you can see, the actual code is straightforward. You first create a EC2 client and simply call the appropriate method on that client with the expected arguments. We return the action as-is so that it can be logged by the chaostoolkit, or even be used as part of a steady-state hypothesis probe (if this was a probe, not action that is).

You could decide to make more than one AWS API call but, it is better to keep it simple so that composition is easier from the experiment. Nonetheless, you may also compose those directly into a single action as well for specific use-cases.

Please refer to the Chaos Toolkit documentation to learn more about the configuration and secrets objects.

Once you have implemented that action, you must create at least one unit test for it in the tests/ec2/test_ec2_actions.py test module. For example:

from chaosaws.ec2.actions import reboot_instancex\n\n@patch('chaosaws.ec2.actions.aws_client', autospec=True)\ndef test_reboot_instance(aws_client):\n    client = MagicMock()\n    aws_client.return_value = client\n    inst_id = \"i-1234567890abcdef0\"\n    response = reboot_instance(inst_id)\n    client.reboot_instances.assert_called_with(\n        InstanceIds=[inst_id], DryRun=False)\n

By using the built-in Python module to mock objects, we can mock the EC2 client and assert that we do indeed call the appropriate method with the right arguments. You are encouraged to write more than a single test for various conditions.

Finally, should you choose to add support for a new AWS API resource altogether, you should create the according sub-package.

"},{"location":"drivers/aws/#services-not-supported-by-boto-new-aws-features","title":"Services not supported by boto (new AWS features)","text":"

If the support you want to provide is for a new AWS service that boto does not support yet, this requires direct call to the API endpoint via the requests package. Say we have a new service, not yet supported by boto3

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import signed_api_call\nfrom chaosaws.types import AWSResponse\n\ndef terminate_worker_node(worker_node_id: str,\n                          configuration: Configuration=None,\n                          secrets: Secrets=None) -> AWSResponse:\n\"\"\"\n    Terminate a worker node.\n    \"\"\"\n    params = {\n        \"DryRun\": True,\n        \"WorkerNodeId.1\": worker_node_id\n    }\n    response = signed_api_call(\n        'some-new-service-name', path='/2018-01-01/worker/terminate',\n        method='POST', params=params,\n        configuration=configuration, secrets=secrets)\n    return response.json()\n

Here is an example on existing API call (as a more concrete snippet):

from chaoslib.types import Configuration, Secrets\n\nfrom chaosaws import signed_api_call\n\ndef stop_instance(instance_id: str, configuration: Configuration=None,\n                  secrets: Secrets=None) -> str:\n    response = signed_api_call(\n        'ec2',\n        configuration=configuration,\n        secrets=secrets,\n        params={\n            \"Action\": \"StopInstances\",\n            \"InstanceId.1\": instance_id,\n            \"Version\": \"2013-06-15\"\n        }\n    )\n\n    # this API returns XML, not JSON\n    return response.text\n

When using the signed_api_call, you are responsible for the right way of passing the parameters. Basically, look at the AWS documentation for each API call.

WARNING: It should be noted that, whenever boto3 implements an API, this package should be updated accordingly, as boto3 is much more versatile and solid.

"},{"location":"drivers/aws/#make-your-new-sub-package-discoverable","title":"Make your new sub-package discoverable","text":"

Finally, if you have created a new sub-package entirely, you need to make its capability discoverable by the chaos toolkit. Simply amend the discover function in the chaosaws/__init__.py. For example, assuming a new eks sub-package, with actions and probes:

    activities.extend(discover_actions(\"chaosaws.eks.actions\"))\n    activities.extend(discover_probes(\"chaosaws.eks.probes\"))\n
"},{"location":"drivers/aws/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/aws/#upload","title":"upload","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosaws\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.controls.upload\"\n}\n}\n]\n}\n
controls:\n- name: chaosaws\nprovider:\nmodule: chaosaws.s3.controls.upload\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/aws/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/aws/#asg","title":"asg","text":""},{"location":"drivers/aws/#attach_volume","title":"attach_volume","text":"Type action Module chaosaws.asg.actions Name attach_volume Return list

Attaches ebs volumes that have been previously detached by CTK

: One of: asg_names: list: one or more asg names tags: list: key/value pairs to identify asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def attach_volume(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"attach-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"attach_volume\"\n}\n}\n
name: attach-volume\nprovider:\nfunc: attach_volume\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#change_subnets","title":"change_subnets","text":"Type action Module chaosaws.asg.actions Name change_subnets Return None

Adds/removes subnets on autoscaling groups

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

subnets: a list of subnet IDs to associate to the ASG\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def change_subnets(subnets: List[str],\n                   asg_names: List[str] = None,\n                   tags: List[dict] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required subnets list Yes asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"change-subnets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"change_subnets\",\n\"arguments\": {\n\"subnets\": []\n}\n}\n}\n
name: change-subnets\nprovider:\narguments:\nsubnets: []\nfunc: change_subnets\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_auto_scaling_groups","title":"describe_auto_scaling_groups","text":"Type probe Module chaosaws.asg.probes Name describe_auto_scaling_groups Return mapping

Returns AWS descriptions for provided ASG(s)

Params: OneOf: - asg_names: a list of asg names to describe - tags: a list of key/value pairs to collect ASG(s)

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def describe_auto_scaling_groups(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"describe-auto-scaling-groups\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"describe_auto_scaling_groups\"\n}\n}\n
name: describe-auto-scaling-groups\nprovider:\nfunc: describe_auto_scaling_groups\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#desired_equals_healthy","title":"desired_equals_healthy","text":"Type probe Module chaosaws.asg.probes Name desired_equals_healthy Return boolean

If desired number matches the number of healthy instances for each of the auto-scaling groups

Returns: bool

Signature:

def desired_equals_healthy(asg_names: List[str],\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required asg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"desired-equals-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"desired_equals_healthy\",\n\"arguments\": {\n\"asg_names\": []\n}\n}\n}\n
name: desired-equals-healthy\nprovider:\narguments:\nasg_names: []\nfunc: desired_equals_healthy\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#desired_equals_healthy_tags","title":"desired_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name desired_equals_healthy_tags Return boolean

If desired number matches the number of healthy instances

for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: bool

Signature:

def desired_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required tags list Yes

Usage:

JSONYAML
{\n\"name\": \"desired-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"desired_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: desired-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: desired_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#detach_random_instances","title":"detach_random_instances","text":"Type action Module chaosaws.asg.actions Name detach_random_instances Return mapping

Detaches one or more random instances from an autoscaling group

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

One of:\n

instance_count: integer value of number of instances to detach instance_percent: 1-100, percent of instances to detach

decrement_capacity: boolean value to determine if the desired capacity\nof the autoscaling group should be decreased\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def detach_random_instances(\n        asg_names: List[str] = None,\n        tags: List[dict] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        decrement_capacity: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No decrement_capacity boolean false No

Usage:

JSONYAML
{\n\"name\": \"detach-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"detach_random_instances\"\n}\n}\n
name: detach-random-instances\nprovider:\nfunc: detach_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#detach_random_volume","title":"detach_random_volume","text":"Type action Module chaosaws.asg.actions Name detach_random_volume Return list

Detaches a random (non root) ebs volume from ec2 instances associated to an ASG

: One of: asg_names: a list of one or more asg names tags: a list of key/value pair to identify asg(s) by

force: force detach volume (default: true)\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def detach_random_volume(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"detach-random-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"detach_random_volume\"\n}\n}\n
name: detach-random-volume\nprovider:\nfunc: detach_random_volume\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#has_subnets","title":"has_subnets","text":"Type probe Module chaosaws.asg.probes Name has_subnets Return boolean

Determines if the provided autoscaling groups are in the provided subnets

:returns boolean

Signature:

def has_subnets(subnets: List[str],\n                asg_names: List[str] = None,\n                tags: List[Dict[str, str]] = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required subnets list Yes asg_names list null No tags list null No

Usage:

JSONYAML
{\n\"name\": \"has-subnets\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"has_subnets\",\n\"arguments\": {\n\"subnets\": []\n}\n}\n}\n
name: has-subnets\nprovider:\narguments:\nsubnets: []\nfunc: has_subnets\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#instance_count_by_health","title":"instance_count_by_health","text":"Type probe Module chaosaws.asg.probes Name instance_count_by_health Return integer

Reports the number of instances currently in the ASG by their health status

Params: OneOf: - asg_names: a list of asg names to describe - tags: a list of key/value pairs to collect ASG(s)

- count_healthy: boolean: true for healthy instance count,\n

false for unhealthy instance count

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def instance_count_by_health(asg_names: List[str] = None,\n                             tags: List[Dict[str, str]] = None,\n                             count_healthy: bool = True,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No count_healthy boolean true No

Usage:

JSONYAML
{\n\"name\": \"instance-count-by-health\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"instance_count_by_health\"\n}\n}\n
name: instance-count-by-health\nprovider:\nfunc: instance_count_by_health\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#is_scaling_in_progress","title":"is_scaling_in_progress","text":"Type probe Module chaosaws.asg.probes Name is_scaling_in_progress Return boolean

Check if there is any scaling activity in progress for ASG matching tags

Returns: Boolean

Signature:

def is_scaling_in_progress(tags: List[Dict[str, str]],\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required tags list Yes

Usage:

JSONYAML
{\n\"name\": \"is-scaling-in-progress\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"is_scaling_in_progress\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: is-scaling-in-progress\nprovider:\narguments:\ntags: []\nfunc: is_scaling_in_progress\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#process_is_suspended","title":"process_is_suspended","text":"Type probe Module chaosaws.asg.probes Name process_is_suspended Return boolean

Determines if one or more processes on an ASG are suspended.

:returns Boolean

Signature:

def process_is_suspended(asg_names: List[str] = None,\n                         tags: List[Dict[str, str]] = None,\n                         process_names: List[str] = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"process-is-suspended\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"process_is_suspended\"\n}\n}\n
name: process-is-suspended\nprovider:\nfunc: process_is_suspended\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#resume_processes","title":"resume_processes","text":"Type action Module chaosaws.asg.actions Name resume_processes Return mapping

Resumes 1 or more suspended processes on a list of auto scaling groups.

If no process is specified, all suspended auto scaling processes will be resumed.

For a list of valid processes that can be suspended, reference: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html

: One of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def resume_processes(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        process_names: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"resume-processes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"resume_processes\"\n}\n}\n
name: resume-processes\nprovider:\nfunc: resume_processes\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_random_instances","title":"stop_random_instances","text":"Type action Module chaosaws.asg.actions Name stop_random_instances Return list

Terminates one or more random healthy instances associated to an ALB

A healthy instance is considered one with a status of \u2018InService\u2019

: - force: force stop the instances (default: False)

One Of:\n

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def stop_random_instances(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        az: str = None,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No az string null No force boolean false No

Usage:

JSONYAML
{\n\"name\": \"stop-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"stop_random_instances\"\n}\n}\n
name: stop-random-instances\nprovider:\nfunc: stop_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#suspend_processes","title":"suspend_processes","text":"Type action Module chaosaws.asg.actions Name suspend_processes Return mapping

Suspends 1 or more processes on a list of auto scaling groups.

If no process is specified, all running auto scaling processes will be suspended.

For a list of valid processes that can be suspended, reference: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html

: One of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def suspend_processes(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        process_names: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No process_names list null No

Usage:

JSONYAML
{\n\"name\": \"suspend-processes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"suspend_processes\"\n}\n}\n
name: suspend-processes\nprovider:\nfunc: suspend_processes\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_random_instances","title":"terminate_random_instances","text":"Type action Module chaosaws.asg.actions Name terminate_random_instances Return list

Terminates one or more random healthy instances associated to an ALB

A healthy instance is considered one with a status of \u2018InService\u2019

: One Of: - asg_names: a list of one or more asg names to target - tags: a list of key/value pairs to identify the asgs by

One Of: - instance_count: the number of instances to terminate - instance_percent: the percentage of instances to terminate - az: the availability zone to terminate instances

tags are expected as a list of dictionary objects: [ {\u2018Key\u2019: \u2018TagKey1\u2019, \u2018Value\u2019: \u2018TagValue1\u2019}, {\u2018Key\u2019: \u2018TagKey2\u2019, \u2018Value\u2019: \u2018TagValue2\u2019}, \u2026 ]

Signature:

def terminate_random_instances(\n        asg_names: List[str] = None,\n        tags: List[Dict[str, str]] = None,\n        instance_count: int = None,\n        instance_percent: int = None,\n        az: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required asg_names list null No tags list null No instance_count integer null No instance_percent integer null No az string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-random-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.actions\",\n\"func\": \"terminate_random_instances\"\n}\n}\n
name: terminate-random-instances\nprovider:\nfunc: terminate_random_instances\nmodule: chaosaws.asg.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#wait_desired_equals_healthy","title":"wait_desired_equals_healthy","text":"Type probe Module chaosaws.asg.probes Name wait_desired_equals_healthy Return integer

Wait until desired number matches the number of healthy instances for each of the auto-scaling groups

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_equals_healthy(\n        asg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        timeout: Union[int, float] = 300,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required asg_names list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-equals-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_equals_healthy\",\n\"arguments\": {\n\"asg_names\": []\n}\n}\n}\n
name: wait-desired-equals-healthy\nprovider:\narguments:\nasg_names: []\nfunc: wait_desired_equals_healthy\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#wait_desired_equals_healthy_tags","title":"wait_desired_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name wait_desired_equals_healthy_tags Return integer

Wait until desired number matches the number of healthy instances for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        timeout: Union[int, float] = 300,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required tags list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: wait-desired-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: wait_desired_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#wait_desired_not_equals_healthy_tags","title":"wait_desired_not_equals_healthy_tags","text":"Type probe Module chaosaws.asg.probes Name wait_desired_not_equals_healthy_tags Return integer

Wait until desired number doesn\u2019t match the number of healthy instances for each of the auto-scaling groups matching tags provided

tags are expected as: [{ \u2018Key\u2019: \u2018KeyName\u2019, \u2018Value\u2019: \u2018KeyValue\u2019 }, \u2026 ]

Returns: Integer (number of seconds it took to wait) or sys.maxsize in case of timeout

Signature:

def wait_desired_not_equals_healthy_tags(\n        tags: List[Dict[str, str]],\n        timeout: Union[int, float] = 300,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required tags list Yes timeout object 300 No

Usage:

JSONYAML
{\n\"name\": \"wait-desired-not-equals-healthy-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.asg.probes\",\n\"func\": \"wait_desired_not_equals_healthy_tags\",\n\"arguments\": {\n\"tags\": []\n}\n}\n}\n
name: wait-desired-not-equals-healthy-tags\nprovider:\narguments:\ntags: []\nfunc: wait_desired_not_equals_healthy_tags\nmodule: chaosaws.asg.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#awslambda","title":"awslambda","text":""},{"location":"drivers/aws/#delete_event_source_mapping","title":"delete_event_source_mapping","text":"Type action Module chaosaws.awslambda.actions Name delete_event_source_mapping Return mapping

Delete an event source mapping

:param event_uuid: The identifier of the event source mapping :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def delete_event_source_mapping(\n        event_uuid: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required event_uuid string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-event-source-mapping\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"delete_event_source_mapping\",\n\"arguments\": {\n\"event_uuid\": \"\"\n}\n}\n}\n
name: delete-event-source-mapping\nprovider:\narguments:\nevent_uuid: ''\nfunc: delete_event_source_mapping\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_function_concurrency","title":"delete_function_concurrency","text":"Type action Module chaosaws.awslambda.actions Name delete_function_concurrency Return mapping

Removes concurrency limit applied to the specified Lambda

Signature:

def delete_function_concurrency(\n        function_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-function-concurrency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"delete_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: delete-function-concurrency\nprovider:\narguments:\nfunction_name: ''\nfunc: delete_function_concurrency\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_function_concurrency","title":"get_function_concurrency","text":"Type probe Module chaosaws.awslambda.probes Name get_function_concurrency Return boolean

Get configuration information of lambda by its function name

Signature:

def get_function_concurrency(\n        function_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-function-concurrency\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-concurrency\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_concurrency\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_function_memory_size","title":"get_function_memory_size","text":"Type probe Module chaosaws.awslambda.probes Name get_function_memory_size Return integer

Get the configured memory size of a lambda function.

The returned memory size is specified in megabytes.

Signature:

def get_function_memory_size(function_name: str,\n                             qualifier: str = None,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"get-function-memory-size\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_memory_size\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-memory-size\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_memory_size\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_function_timeout","title":"get_function_timeout","text":"Type probe Module chaosaws.awslambda.probes Name get_function_timeout Return integer

Get the configured timeout of a lambda function.

The returned timeout is specified in number of seconds.

Signature:

def get_function_timeout(function_name: str,\n                         qualifier: str = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"get-function-timeout\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"get_function_timeout\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: get-function-timeout\nprovider:\narguments:\nfunction_name: ''\nfunc: get_function_timeout\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#invoke_function","title":"invoke_function","text":"Type action Module chaosaws.awslambda.actions Name invoke_function Return mapping

Invokes Lambda.

More information about request arguments are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.invoke

Signature:

def invoke_function(\n        function_name: str,\n        function_arguments: Dict[str, Any] = None,\n        invocation_type: str = 'RequestResponse',\n        client_context: Dict[str, Any] = None,\n        qualifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes function_arguments mapping null No invocation_type string \u201cRequestResponse\u201d No client_context mapping null No qualifier string null No

Usage:

JSONYAML
{\n\"name\": \"invoke-function\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"invoke_function\",\n\"arguments\": {\n\"function_name\": \"\"\n}\n}\n}\n
name: invoke-function\nprovider:\narguments:\nfunction_name: ''\nfunc: invoke_function\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#list_event_source_mapping","title":"list_event_source_mapping","text":"Type probe Module chaosaws.awslambda.probes Name list_event_source_mapping Return mapping

List event source mappings for the provided lambda function or ARN of the event source

:param source_arn: The ARN of the event source :param function_name: The name of the lambda function :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def list_event_source_mapping(\n        source_arn: str = None,\n        function_name: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required source_arn string null No function_name string null No

Usage:

JSONYAML
{\n\"name\": \"list-event-source-mapping\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.probes\",\n\"func\": \"list_event_source_mapping\"\n}\n}\n
name: list-event-source-mapping\nprovider:\nfunc: list_event_source_mapping\nmodule: chaosaws.awslambda.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#put_function_concurrency","title":"put_function_concurrency","text":"Type action Module chaosaws.awslambda.actions Name put_function_concurrency Return mapping

Throttles Lambda by setting reserved concurrency amount.

Signature:

def put_function_concurrency(\n        function_name: str,\n        concurrent_executions: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes concurrent_executions integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-concurrency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_concurrency\",\n\"arguments\": {\n\"function_name\": \"\",\n\"concurrent_executions\": 0\n}\n}\n}\n
name: put-function-concurrency\nprovider:\narguments:\nconcurrent_executions: 0\nfunction_name: ''\nfunc: put_function_concurrency\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_function_memory_size","title":"put_function_memory_size","text":"Type action Module chaosaws.awslambda.actions Name put_function_memory_size Return mapping

Sets the function memory size.

Input memory_size argument is specified in megabytes.

Signature:

def put_function_memory_size(\n        function_name: str,\n        memory_size: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes memory_size integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-memory-size\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_memory_size\",\n\"arguments\": {\n\"function_name\": \"\",\n\"memory_size\": 0\n}\n}\n}\n
name: put-function-memory-size\nprovider:\narguments:\nfunction_name: ''\nmemory_size: 0\nfunc: put_function_memory_size\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_function_timeout","title":"put_function_timeout","text":"Type action Module chaosaws.awslambda.actions Name put_function_timeout Return mapping

Sets the function timeout.

Input timeout argument is specified in seconds.

Signature:

def put_function_timeout(\n        function_name: str,\n        timeout: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required function_name string Yes timeout integer Yes

Usage:

JSONYAML
{\n\"name\": \"put-function-timeout\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"put_function_timeout\",\n\"arguments\": {\n\"function_name\": \"\",\n\"timeout\": 0\n}\n}\n}\n
name: put-function-timeout\nprovider:\narguments:\nfunction_name: ''\ntimeout: 0\nfunc: put_function_timeout\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#toggle_event_source_mapping_state","title":"toggle_event_source_mapping_state","text":"Type action Module chaosaws.awslambda.actions Name toggle_event_source_mapping_state Return mapping

Toggle an event source mapping to be disabled or enabled

:param event_uuid: The identifier of the event source mapping :param enabled: Boolean value: true to enable, false to disable :param configuration: AWS configuration data :param secrets: AWS secrets :return: AWSResponse

Signature:

def toggle_event_source_mapping_state(\n        event_uuid: str,\n        enabled: bool,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required event_uuid string Yes enabled boolean Yes

Usage:

JSONYAML
{\n\"name\": \"toggle-event-source-mapping-state\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.awslambda.actions\",\n\"func\": \"toggle_event_source_mapping_state\",\n\"arguments\": {\n\"event_uuid\": \"\",\n\"enabled\": true\n}\n}\n}\n
name: toggle-event-source-mapping-state\nprovider:\narguments:\nenabled: true\nevent_uuid: ''\nfunc: toggle_event_source_mapping_state\nmodule: chaosaws.awslambda.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#cloudwatch","title":"cloudwatch","text":""},{"location":"drivers/aws/#delete_rule","title":"delete_rule","text":"Type action Module chaosaws.cloudwatch.actions Name delete_rule Return mapping

Deletes a CloudWatch rule.

All rule targets must be removed before deleting the rule. Set input argument force to True to force all rule targets to be deleted.

Signature:

def delete_rule(rule_name: str,\n                force: bool = False,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes force boolean false No

Usage:

JSONYAML
{\n\"name\": \"delete-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"delete_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: delete-rule\nprovider:\narguments:\nrule_name: ''\nfunc: delete_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#disable_rule","title":"disable_rule","text":"Type action Module chaosaws.cloudwatch.actions Name disable_rule Return mapping

Disables a CloudWatch rule.

Signature:

def disable_rule(rule_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes

Usage:

JSONYAML
{\n\"name\": \"disable-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"disable_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: disable-rule\nprovider:\narguments:\nrule_name: ''\nfunc: disable_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#enable_rule","title":"enable_rule","text":"Type action Module chaosaws.cloudwatch.actions Name enable_rule Return mapping

Enables a CloudWatch rule.

Signature:

def enable_rule(rule_name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes

Usage:

JSONYAML
{\n\"name\": \"enable-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"enable_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: enable-rule\nprovider:\narguments:\nrule_name: ''\nfunc: enable_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_alarm_state_value","title":"get_alarm_state_value","text":"Type probe Module chaosaws.cloudwatch.probes Name get_alarm_state_value Return string

Return the state value of an alarm.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.describe_alarms

Signature:

def get_alarm_state_value(alarm_name: str,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required alarm_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-alarm-state-value\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_alarm_state_value\",\n\"arguments\": {\n\"alarm_name\": \"\"\n}\n}\n}\n
name: get-alarm-state-value\nprovider:\narguments:\nalarm_name: ''\nfunc: get_alarm_state_value\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_metric_data","title":"get_metric_data","text":"Type probe Module chaosaws.cloudwatch.probes Name get_metric_data Return number

Gets metric data for a given metric in a given time period. This method allows for more data to be retrieved than get_metric_statistics

:params namespace: The AWS metric namespace metric_name: The name of the metric to pull data for One of: dimension_name, dimension_value: Required to search for ONE dimension dimensions: Required to search for dimensions combinations Are expected as a list of dictionary objects: [{\u2018Name\u2019: \u2018Dim1\u2019, \u2018Value\u2019: \u2018Val1\u2019}, {\u2018Name\u2019: \u2018Dim2\u2019, \u2018Value\u2019: \u2018Val2\u2019}, \u2026] unit: The type of unit desired to be collected statistic: The type of data to return. One of: Average, Sum, Minimum, Maximum, SampleCount period: The window in which to pull datapoints for offset: The time (seconds) to offset the endtime (from now) duration: The time (seconds) to set the start time (from now)

Signature:

def get_metric_data(namespace: str,\n                    metric_name: str,\n                    dimension_name: str = None,\n                    dimension_value: str = None,\n                    dimensions: List[Dict[str, str]] = None,\n                    statistic: str = None,\n                    duration: int = 300,\n                    period: int = 60,\n                    offset: int = 0,\n                    unit: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_name string Yes dimension_name string null No dimension_value string null No dimensions list null No statistic string null No duration integer 300 No period integer 60 No offset integer 0 No unit string null No

Usage:

JSONYAML
{\n\"name\": \"get-metric-data\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_metric_data\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_name\": \"\"\n}\n}\n}\n
name: get-metric-data\nprovider:\narguments:\nmetric_name: ''\nnamespace: ''\nfunc: get_metric_data\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_metric_statistics","title":"get_metric_statistics","text":"Type probe Module chaosaws.cloudwatch.probes Name get_metric_statistics Return None

Get the value of a statistical calculation for a given metric.

The period for which the calculation will be performed is specified by a duration and an offset from the current time. Both are specified in seconds.

Example: A duration of 60 seconds and an offset of 30 seconds will yield a statistical value based on the time interval between 30 and 90 seconds in the past.

Is required one of: dimension_name, dimension_value: Required to search for ONE dimension dimensions: Required to search for dimensions combinations Are expected as a list of dictionary objects: [{\u2018Name\u2019: \u2018Dim1\u2019, \u2018Value\u2019: \u2018Val1\u2019}, {\u2018Name\u2019: \u2018Dim2\u2019, \u2018Value\u2019: \u2018Val2\u2019}, \u2026]

More information about input parameters are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.get_metric_statistics

Signature:

def get_metric_statistics(namespace: str,\n                          metric_name: str,\n                          dimension_name: str = None,\n                          dimension_value: str = None,\n                          dimensions: List[Dict[str, str]] = None,\n                          duration: int = 60,\n                          offset: int = 0,\n                          statistic: str = None,\n                          extended_statistic: str = None,\n                          unit: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_name string Yes dimension_name string null No dimension_value string null No dimensions list null No duration integer 60 No offset integer 0 No statistic string null No extended_statistic string null No unit string null No

Usage:

JSONYAML
{\n\"name\": \"get-metric-statistics\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.probes\",\n\"func\": \"get_metric_statistics\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_name\": \"\"\n}\n}\n}\n
name: get-metric-statistics\nprovider:\narguments:\nmetric_name: ''\nnamespace: ''\nfunc: get_metric_statistics\nmodule: chaosaws.cloudwatch.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#put_metric_data","title":"put_metric_data","text":"Type action Module chaosaws.cloudwatch.actions Name put_metric_data Return None

Publish metric data points to CloudWatch

:param namespace: The metric namespace :param metric_data: A list of metric data to submit :param configuration: AWS authentication configuration :param secrets: Additional authentication secrets :return: None

example: namespace=\u2019MyCustomTestMetric\u2019, metric_data=[ { \u2018MetricName\u2019: \u2018MemoryUsagePercent\u2019, \u2018Dimensions\u2019: [ {\u2018Name\u2019: \u2018InstanceId\u2019, \u2018Value\u2019: \u2018i-000000000000\u2019}, {\u2018Name\u2019: \u2018Instance Name\u2019, \u2018Value\u2019: \u2018Test Instance\u2019} ], \u2018Timestamp\u2019: datetime(yyyy, mm, dd, HH, MM, SS), \u2018Value\u2019: 55.55, \u2018Unit\u2019: \u2018Percent\u2019, \u2018StorageResolution\u2019: 60 } ]

For additional information, consult: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.put_metric_data

Signature:

def put_metric_data(namespace: str,\n                    metric_data: List[Dict[str, Any]],\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required namespace string Yes metric_data list Yes

Usage:

JSONYAML
{\n\"name\": \"put-metric-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_metric_data\",\n\"arguments\": {\n\"namespace\": \"\",\n\"metric_data\": []\n}\n}\n}\n
name: put-metric-data\nprovider:\narguments:\nmetric_data: []\nnamespace: ''\nfunc: put_metric_data\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_rule","title":"put_rule","text":"Type action Module chaosaws.cloudwatch.actions Name put_rule Return mapping

Creates or updates a CloudWatch event rule.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_rule for details on input arguments.

Signature:

def put_rule(rule_name: str,\n             schedule_expression: str = None,\n             event_pattern: str = None,\n             state: str = None,\n             description: str = None,\n             role_arn: str = None,\n             configuration: Dict[str, Dict[str, str]] = None,\n             secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes schedule_expression string null No event_pattern string null No state string null No description string null No role_arn string null No

Usage:

JSONYAML
{\n\"name\": \"put-rule\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_rule\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: put-rule\nprovider:\narguments:\nrule_name: ''\nfunc: put_rule\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_rule_targets","title":"put_rule_targets","text":"Type action Module chaosaws.cloudwatch.actions Name put_rule_targets Return mapping

Creates or update CloudWatch event rule targets.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_targets for details on input arguments.

Signature:

def put_rule_targets(\n        rule_name: str,\n        targets: List[Dict[str, Any]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes targets list Yes

Usage:

JSONYAML
{\n\"name\": \"put-rule-targets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"put_rule_targets\",\n\"arguments\": {\n\"rule_name\": \"\",\n\"targets\": []\n}\n}\n}\n
name: put-rule-targets\nprovider:\narguments:\nrule_name: ''\ntargets: []\nfunc: put_rule_targets\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#remove_rule_targets","title":"remove_rule_targets","text":"Type action Module chaosaws.cloudwatch.actions Name remove_rule_targets Return mapping

Removes CloudWatch rule targets. If no target ids are provided all targets will be removed.

Signature:

def remove_rule_targets(\n        rule_name: str,\n        target_ids: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required rule_name string Yes target_ids list null No

Usage:

JSONYAML
{\n\"name\": \"remove-rule-targets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.cloudwatch.actions\",\n\"func\": \"remove_rule_targets\",\n\"arguments\": {\n\"rule_name\": \"\"\n}\n}\n}\n
name: remove-rule-targets\nprovider:\narguments:\nrule_name: ''\nfunc: remove_rule_targets\nmodule: chaosaws.cloudwatch.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#ec2","title":"ec2","text":""},{"location":"drivers/aws/#attach_volume_1","title":"attach_volume","text":"Type action Module chaosaws.ec2.actions Name attach_volume Return list

Attaches a previously detached EBS volume to its associated EC2 instance.

If neither \u2018instance_ids\u2019 or \u2018filters\u2019 are provided, all detached volumes will be reattached to their respective instances

: One of: instance_ids: list: instance ids filters: list: key/value pairs to pull ec2 instances

Signature:

def attach_volume(\n        instance_ids: List[str] = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"attach-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"attach_volume\"\n}\n}\n
name: attach-volume\nprovider:\nfunc: attach_volume\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#count_instances","title":"count_instances","text":"Type probe Module chaosaws.ec2.probes Name count_instances Return integer

Return count of instances matching the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def count_instances(filters: List[Dict[str, Any]],\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filters list Yes

Usage:

JSONYAML
{\n\"name\": \"count-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"count_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: count-instances\nprovider:\narguments:\nfilters: []\nfunc: count_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#count_min_instances","title":"count_min_instances","text":"Type probe Module chaosaws.ec2.probes Name count_min_instances Return boolean

Returns whether minimum number of instances available matching the specified filters.

Signature:

def count_min_instances(filters: List[Dict[str, Any]],\n                        min_count: int = 0,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required filters list Yes min_count integer 0 No

Usage:

JSONYAML
{\n\"name\": \"count-min-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"count_min_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: count-min-instances\nprovider:\narguments:\nfilters: []\nfunc: count_min_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instances","title":"describe_instances","text":"Type probe Module chaosaws.ec2.probes Name describe_instances Return mapping

Describe instances following the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def describe_instances(\n        filters: List[Dict[str, Any]],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required filters list Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"describe_instances\",\n\"arguments\": {\n\"filters\": []\n}\n}\n}\n
name: describe-instances\nprovider:\narguments:\nfilters: []\nfunc: describe_instances\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#detach_random_volume_1","title":"detach_random_volume","text":"Type action Module chaosaws.ec2.actions Name detach_random_volume Return list

Detaches a random ebs volume (non root) from one or more EC2 instances

: One of: instance_ids: a list of one or more ec2 instance ids filters: a list of key/value pairs to pull ec2 instances

force: force detach volume (default: true)\n

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def detach_random_volume(\n        instance_ids: List[str] = None,\n        filters: List[Dict[str, Any]] = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No filters list null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"detach-random-volume\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"detach_random_volume\"\n}\n}\n
name: detach-random-volume\nprovider:\nfunc: detach_random_volume\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#instance_state","title":"instance_state","text":"Type probe Module chaosaws.ec2.probes Name instance_state Return boolean

Determines if EC2 instances match desired state

For additional filter options, please refer to the documentation found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def instance_state(state: str,\n                   instance_ids: List[str] = None,\n                   filters: List[Dict[str, Any]] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required state string Yes instance_ids list null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"instance-state\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"\"\n}\n}\n}\n
name: instance-state\nprovider:\narguments:\nstate: ''\nfunc: instance_state\nmodule: chaosaws.ec2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#restart_instances","title":"restart_instances","text":"Type action Module chaosaws.ec2.actions Name restart_instances Return list

Restarts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be restarted.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def restart_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"restart-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"restart_instances\"\n}\n}\n
name: restart-instances\nprovider:\nfunc: restart_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#start_instances","title":"start_instances","text":"Type action Module chaosaws.ec2.actions Name start_instances Return list

Starts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be started.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def start_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"start-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"start_instances\"\n}\n}\n
name: start-instances\nprovider:\nfunc: start_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_instance","title":"stop_instance","text":"Type action Module chaosaws.ec2.actions Name stop_instance Return list

Stop a single EC2 instance.

You may provide an instance id explicitly or, if you only specify the AZ, a random instance will be selected. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instance(\n        instance_id: str = None,\n        az: str = None,\n        force: bool = False,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No az string null No force boolean false No filters list null No

Usage:

JSONYAML
{\n\"name\": \"stop-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instance\"\n}\n}\n
name: stop-instance\nprovider:\nfunc: stop_instance\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_instances","title":"stop_instances","text":"Type action Module chaosaws.ec2.actions Name stop_instances Return list

Stop the given EC2 instances or, if none is provided, all instances of the given availability zone. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No force boolean false No

Usage:

JSONYAML
{\n\"name\": \"stop-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"stop_instances\"\n}\n}\n
name: stop-instances\nprovider:\nfunc: stop_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_instance","title":"terminate_instance","text":"Type action Module chaosaws.ec2.actions Name terminate_instance Return list

Terminates a single EC2 instance.

An instance may be targeted by specifying it by instance-id. If only the availability-zone is provided, a random instances in that AZ will be selected and terminated. For more control, please reference the available filters found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instance(\n        instance_id: str = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"terminate-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"terminate_instance\"\n}\n}\n
name: terminate-instance\nprovider:\nfunc: terminate_instance\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#terminate_instances","title":"terminate_instances","text":"Type action Module chaosaws.ec2.actions Name terminate_instances Return list

Terminates multiple EC2 instances

A set of instances may be targeted by providing them as the instance-ids.

WARNING: If only an Availability Zone is specified, all instances in that AZ will be terminated.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instances(\n        instance_ids: List[str] = None,\n        az: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required instance_ids list null No az string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"terminate-instances\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.actions\",\n\"func\": \"terminate_instances\"\n}\n}\n
name: terminate-instances\nprovider:\nfunc: terminate_instances\nmodule: chaosaws.ec2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#ecs","title":"ecs","text":""},{"location":"drivers/aws/#are_all_desired_tasks_running","title":"are_all_desired_tasks_running","text":"Type probe Module chaosaws.ecs.probes Name are_all_desired_tasks_running Return boolean

Checks to make sure desired and running tasks counts are equal

Signature:

def are_all_desired_tasks_running(\n        cluster: str,\n        service: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"are-all-desired-tasks-running\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"are_all_desired_tasks_running\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: are-all-desired-tasks-running\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: are_all_desired_tasks_running\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_cluster","title":"delete_cluster","text":"Type action Module chaosaws.ecs.actions Name delete_cluster Return mapping

Delete an ECS cluster

:param cluster: The ECS cluster name or ARN :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def delete_cluster(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"delete_cluster\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: delete-cluster\nprovider:\narguments:\ncluster: ''\nfunc: delete_cluster\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_service","title":"delete_service","text":"Type action Module chaosaws.ecs.actions Name delete_service Return mapping

Update a given ECS service by updating it to set the desired count of tasks to 0 then delete it. If not provided, a random one will be picked up regarding service_pattern, if provided, so that only service names matching the pattern would be be used. This should be a valid regex.

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def delete_service(\n        service: str = None,\n        cluster: str = None,\n        service_pattern: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required service string null No cluster string null No service_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"delete_service\"\n}\n}\n
name: delete-service\nprovider:\nfunc: delete_service\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#deregister_container_instance","title":"deregister_container_instance","text":"Type action Module chaosaws.ecs.actions Name deregister_container_instance Return mapping

Deregister an ECS container

Warning: If using \u201cforce\u201d, Any tasks not deleted before deregistration will remain orphaned

:param cluster: The ECS cluster name or ARN or ARN :param instance_id: The container instance id or ARN :param force: Force deregistraion of container instance :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def deregister_container_instance(\n        cluster: str,\n        instance_id: str,\n        force: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes instance_id string Yes force boolean false No

Usage:

JSONYAML
{\n\"name\": \"deregister-container-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"deregister_container_instance\",\n\"arguments\": {\n\"cluster\": \"\",\n\"instance_id\": \"\"\n}\n}\n}\n
name: deregister-container-instance\nprovider:\narguments:\ncluster: ''\ninstance_id: ''\nfunc: deregister_container_instance\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cluster","title":"describe_cluster","text":"Type probe Module chaosaws.ecs.probes Name describe_cluster Return mapping

Returns AWS response describing the specified cluster

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster has 3 running tasks\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cCluster running task count\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.clusters[0].runningTasksCount, \u201cexpect\u201d: 3 }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_cluster\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d } } } }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_clusters

Signature:

def describe_cluster(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\ncluster: ''\nfunc: describe_cluster\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_service","title":"describe_service","text":"Type probe Module chaosaws.ecs.probes Name describe_service Return mapping

Returns AWS response describing the specified cluster service

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyService pending count is 1\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cService pending count\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.services[0].pendingCount, \u201cexpect\u201d: 1 }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_service\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d, \u201cservice\u201d: \u201cMyService\u201d } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_services

Signature:

def describe_service(\n        cluster: str,\n        service: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_service\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: describe-service\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: describe_service\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_tasks","title":"describe_tasks","text":"Type probe Module chaosaws.ecs.probes Name describe_tasks Return mapping

Returns AWS response describing the tasks for a provided cluster

Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster tasks are healthy\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cfirst task is healthy\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.tasks[0].healthStatus, \u201cexpect\u201d: \u201cHEALTHY\u201d }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.probes\u201d, \u201cfunc\u201d: \u201cdescribe_tasks\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cMyCluster\u201d } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_tasks

Signature:

def describe_tasks(\n        cluster: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-tasks\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"describe_tasks\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: describe-tasks\nprovider:\narguments:\ncluster: ''\nfunc: describe_tasks\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#service_is_deploying","title":"service_is_deploying","text":"Type probe Module chaosaws.ecs.probes Name service_is_deploying Return boolean

Checks to make sure there is not an in progress deployment

Signature:

def service_is_deploying(cluster: str,\n                         service: str,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes

Usage:

JSONYAML
{\n\"name\": \"service-is-deploying\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.probes\",\n\"func\": \"service_is_deploying\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: service-is-deploying\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: service_is_deploying\nmodule: chaosaws.ecs.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#set_service_deployment_configuration","title":"set_service_deployment_configuration","text":"Type action Module chaosaws.ecs.actions Name set_service_deployment_configuration Return mapping

Sets the maximum healthy count and minimum healthy percentage values for a services deployment configuration

:param cluster: The ECS cluster name or ARN :param service: The ECS service name :param maximum_percent: The upper limit on the number of tasks a service is allowed to have in RUNNING or PENDING during deployment :param minimum_healthy_percent: The lower limit on the number of tasks a service must keep in RUNNING to be considered healthy during deployment :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def set_service_deployment_configuration(\n        cluster: str,\n        service: str,\n        maximum_percent: int = 200,\n        minimum_healthy_percent: int = 100,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes maximum_percent integer 200 No minimum_healthy_percent integer 100 No

Usage:

JSONYAML
{\n\"name\": \"set-service-deployment-configuration\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"set_service_deployment_configuration\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\"\n}\n}\n}\n
name: set-service-deployment-configuration\nprovider:\narguments:\ncluster: ''\nservice: ''\nfunc: set_service_deployment_configuration\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#set_service_placement_strategy","title":"set_service_placement_strategy","text":"Type action Module chaosaws.ecs.actions Name set_service_placement_strategy Return mapping

Sets the service\u2019s instance placement strategy

:param cluster: The ECS cluster name or ARN :param service: The ECS service name :param placement_type: The type of placement strategy to employ (random, spread, or binpack) :param placement_field: The field to apply the strategy against (eg: \u201cattribute:ecs.availability-zone\u201d) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def set_service_placement_strategy(\n        cluster: str,\n        service: str,\n        placement_type: str,\n        placement_field: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes placement_type string Yes placement_field string null No

Usage:

JSONYAML
{\n\"name\": \"set-service-placement-strategy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"set_service_placement_strategy\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\",\n\"placement_type\": \"\"\n}\n}\n}\n
name: set-service-placement-strategy\nprovider:\narguments:\ncluster: ''\nplacement_type: ''\nservice: ''\nfunc: set_service_placement_strategy\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_random_tasks","title":"stop_random_tasks","text":"Type action Module chaosaws.ecs.actions Name stop_random_tasks Return list

Stop a random number of tasks based on given task_count or task_percent

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

:param cluster: The ECS cluster Name :param task_count: The number of tasks to stop :param task_percent: The percentage of total tasks to stop :param service: The ECS service name :param reason: An explanation of why the service was stopped :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: List[Dict[str, Any]]

Signature:

def stop_random_tasks(\n        cluster: str,\n        task_count: int = None,\n        task_percent: int = None,\n        service: str = None,\n        reason: str = 'Chaos Testing',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes task_count integer null No task_percent integer null No service string null No reason string \u201cChaos Testing\u201d No

Usage:

JSONYAML
{\n\"name\": \"stop-random-tasks\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"stop_random_tasks\",\n\"arguments\": {\n\"cluster\": \"\"\n}\n}\n}\n
name: stop-random-tasks\nprovider:\narguments:\ncluster: ''\nfunc: stop_random_tasks\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_task","title":"stop_task","text":"Type action Module chaosaws.ecs.actions Name stop_task Return mapping

Stop a given ECS task instance. If no task_id provided, a random task of the given service is stopped. You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def stop_task(cluster: str = None,\n              task_id: str = None,\n              service: str = None,\n              reason: str = 'Chaos Testing',\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string null No task_id string null No service string null No reason string \u201cChaos Testing\u201d No

Usage:

JSONYAML
{\n\"name\": \"stop-task\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"stop_task\"\n}\n}\n
name: stop-task\nprovider:\nfunc: stop_task\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#tag_resource","title":"tag_resource","text":"Type action Module chaosaws.ecs.actions Name tag_resource Return None

Tags the provided resource(s) with provided tags

** For ECS resources, the long form ARN must be used https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-arn-timeline

Example: { \u201ctags\u201d: [ {\u201ckey\u201d: \u201cMyTagKey\u201d, \u201cvalue\u201d: \u201cMyTagValue\u201d}, {\u201ckey\u201d: \u201cMyOtherTagKey\u201d, \u201cvalue\u201d: \u201cMyOtherTagValue\u201d} ], \u201cresource_arn\u201d: \u201carn:aws:ecs:us-east-1:123456789012:cluster/name\u201d }

:param tags: A list of key/value pairs :param resource_arn: The ARN of the resource to tag. Valid resources: capacity providers, tasks, services, task definitions, clusters, and container instances :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def tag_resource(tags: List[Dict[str, str]],\n                 resource_arn: str,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required tags list Yes resource_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"tag-resource\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"tag_resource\",\n\"arguments\": {\n\"tags\": [],\n\"resource_arn\": \"\"\n}\n}\n}\n
name: tag-resource\nprovider:\narguments:\nresource_arn: ''\ntags: []\nfunc: tag_resource\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#untag_resource","title":"untag_resource","text":"Type action Module chaosaws.ecs.actions Name untag_resource Return None

Removes the given tags from the provided resource

** For ECS resources, the long form ARN must be used https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-arn-timeline

Example: { \u201ctag_keys\u201d: [\u201cMyTagKey\u201d, \u201cMyOtherTagKey\u201d], \u201cresource_arn\u201d: \u201carn:aws:ecs:\u2026:service/cluster-name/service-name\u201d }

:param tag_keys: A list of tag keys to remove :param resource_arn: The ARN of the resource to tag. Valid resources: capacity providers, tasks, services, task definitions, clusters, and container instances :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def untag_resource(tag_keys: List[str],\n                   resource_arn: str,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required tag_keys list Yes resource_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"untag-resource\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"untag_resource\",\n\"arguments\": {\n\"tag_keys\": [],\n\"resource_arn\": \"\"\n}\n}\n}\n
name: untag-resource\nprovider:\narguments:\nresource_arn: ''\ntag_keys: []\nfunc: untag_resource\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#update_container_instances_state","title":"update_container_instances_state","text":"Type action Module chaosaws.ecs.actions Name update_container_instances_state Return mapping

Modify the status of an ACTIVE ECS container instance

:param cluster: The ECS cluster name or ARN :param container_instances: A list of container instance ids for ARNs :param status: The desired instance state (Valid States: ACTIVE, DRAINING) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def update_container_instances_state(\n        cluster: str,\n        container_instances: List[str],\n        status: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes container_instances list Yes status string Yes

Usage:

JSONYAML
{\n\"name\": \"update-container-instances-state\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"update_container_instances_state\",\n\"arguments\": {\n\"cluster\": \"\",\n\"container_instances\": [],\n\"status\": \"\"\n}\n}\n}\n
name: update-container-instances-state\nprovider:\narguments:\ncluster: ''\ncontainer_instances: []\nstatus: ''\nfunc: update_container_instances_state\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#update_desired_count","title":"update_desired_count","text":"Type action Module chaosaws.ecs.actions Name update_desired_count Return mapping

Set the number of desired tasks for an ECS service

:param cluster: The ECS cluster name or ARN or ARN :param service: The ECS service name :param desired_count: The number of instantiation of the tasks to run :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Example: \u201cmethod\u201d: { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cupdate service\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ecs.actions\u201d, \u201cfunc\u201d: \u201cupdate_desired_count\u201d, \u201carguments\u201d: { \u201ccluster\u201d: \u201cmy_cluster_name\u201d, \u201cservice\u201d: \u201cmy_service_name\u201d, \u201cdesired_count\u201d: 6 } } }

Signature:

def update_desired_count(\n        cluster: str,\n        service: str,\n        desired_count: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster string Yes service string Yes desired_count integer Yes

Usage:

JSONYAML
{\n\"name\": \"update-desired-count\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ecs.actions\",\n\"func\": \"update_desired_count\",\n\"arguments\": {\n\"cluster\": \"\",\n\"service\": \"\",\n\"desired_count\": 0\n}\n}\n}\n
name: update-desired-count\nprovider:\narguments:\ncluster: ''\ndesired_count: 0\nservice: ''\nfunc: update_desired_count\nmodule: chaosaws.ecs.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#eks","title":"eks","text":""},{"location":"drivers/aws/#create_cluster","title":"create_cluster","text":"Type action Module chaosaws.eks.actions Name create_cluster Return mapping

Create a new EKS cluster.

Signature:

def create_cluster(\n        name: str,\n        role_arn: str,\n        vpc_config: Dict[str, Any],\n        version: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes role_arn string Yes vpc_config mapping Yes version string null No

Usage:

JSONYAML
{\n\"name\": \"create-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.actions\",\n\"func\": \"create_cluster\",\n\"arguments\": {\n\"name\": \"\",\n\"role_arn\": \"\",\n\"vpc_config\": {}\n}\n}\n}\n
name: create-cluster\nprovider:\narguments:\nname: ''\nrole_arn: ''\nvpc_config: {}\nfunc: create_cluster\nmodule: chaosaws.eks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_cluster_1","title":"delete_cluster","text":"Type action Module chaosaws.eks.actions Name delete_cluster Return mapping

Delete the given EKS cluster.

Signature:

def delete_cluster(\n        name: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string null No

Usage:

JSONYAML
{\n\"name\": \"delete-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.actions\",\n\"func\": \"delete_cluster\"\n}\n}\n
name: delete-cluster\nprovider:\nfunc: delete_cluster\nmodule: chaosaws.eks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cluster_1","title":"describe_cluster","text":"Type probe Module chaosaws.eks.probes Name describe_cluster Return mapping

Describe an EKS cluster.

Signature:

def describe_cluster(\n        name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\nname: ''\nfunc: describe_cluster\nmodule: chaosaws.eks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_clusters","title":"list_clusters","text":"Type probe Module chaosaws.eks.probes Name list_clusters Return mapping

List EKS clusters available to the authenticated account.

Signature:

def list_clusters(configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.eks.probes\",\n\"func\": \"list_clusters\"\n}\n}\n
name: list-clusters\nprovider:\nfunc: list_clusters\nmodule: chaosaws.eks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#elasticache","title":"elasticache","text":""},{"location":"drivers/aws/#count_cache_clusters_from_replication_group","title":"count_cache_clusters_from_replication_group","text":"Type probe Module chaosaws.elasticache.probes Name count_cache_clusters_from_replication_group Return integer

Returns the number of cache clusters that are part of the given ReplicationGroupId :param replication_group_id: The identifier for the replication group to be described :param configuration: Configuration :param secrets: Secrets Probe example: \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cMyCluster has 3 nodes\u201d, \u201cprobes\u201d: [{ \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cCluster running node count\u201d, \u201ctolerance\u201d: 3, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cmodules.elasticache\u201d, \u201cfunc\u201d: \u201ccount_cache_clusters_from_replication_group\u201d, \u201carguments\u201d: { \u201creplication_group_id\u201d: \u201cMyCluster\u201d } } } }

Signature:

def count_cache_clusters_from_replication_group(\n        replication_group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required replication_group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"count-cache-clusters-from-replication-group\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"count_cache_clusters_from_replication_group\",\n\"arguments\": {\n\"replication_group_id\": \"\"\n}\n}\n}\n
name: count-cache-clusters-from-replication-group\nprovider:\narguments:\nreplication_group_id: ''\nfunc: count_cache_clusters_from_replication_group\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_cache_clusters","title":"delete_cache_clusters","text":"Type action Module chaosaws.elasticache.actions Name delete_cache_clusters Return list

Deletes one or more cache clusters and creates a final snapshot

: cluster_ids: list: a list of one or more cache cluster ids final_snapshot_id: str: an identifier to give the final snapshot

Signature:

def delete_cache_clusters(\n        cluster_ids: List[str],\n        final_snapshot_id: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster_ids list Yes final_snapshot_id string null No

Usage:

JSONYAML
{\n\"name\": \"delete-cache-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"delete_cache_clusters\",\n\"arguments\": {\n\"cluster_ids\": []\n}\n}\n}\n
name: delete-cache-clusters\nprovider:\narguments:\ncluster_ids: []\nfunc: delete_cache_clusters\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_replication_groups","title":"delete_replication_groups","text":"Type action Module chaosaws.elasticache.actions Name delete_replication_groups Return list

Deletes one or more replication groups and creates a final snapshot

: group_ids: list: a list of one or more replication group ids final_snapshot_id: str: an identifier to give the final snapshot retain_primary_cluster: bool (default: True): delete only the read replicas associated to the replication group, not the primary

Signature:

def delete_replication_groups(\n        group_ids: List[str],\n        final_snapshot_id: str = None,\n        retain_primary_cluster: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group_ids list Yes final_snapshot_id string null No retain_primary_cluster boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-replication-groups\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"delete_replication_groups\",\n\"arguments\": {\n\"group_ids\": []\n}\n}\n}\n
name: delete-replication-groups\nprovider:\narguments:\ngroup_ids: []\nfunc: delete_replication_groups\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#describe_cache_cluster","title":"describe_cache_cluster","text":"Type probe Module chaosaws.elasticache.probes Name describe_cache_cluster Return mapping

Returns cache cluster data for given cluster

:param cluster_id: str: the name of the cache cluster :param show_node_info: bool: show associated nodes (default: False) :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache cluster engine\u201d, \u201ctolerance\u201d: { \u201ctype\u201d: \u201cjsonpath\u201d, \u201cpath\u201d: $.CacheClusters[0].Engine, \u201cexpect\u201d: \u201cmemcached\u201d }, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cdescribe_cache_cluster\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elasticache.html#ElastiCache.Client.describe_cache_clusters

Signature:

def describe_cache_cluster(\n        cluster_id: str,\n        show_node_info: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes show_node_info boolean false No

Usage:

JSONYAML
{\n\"name\": \"describe-cache-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"describe_cache_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: describe-cache-cluster\nprovider:\narguments:\ncluster_id: ''\nfunc: describe_cache_cluster\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_cache_node_count","title":"get_cache_node_count","text":"Type probe Module chaosaws.elasticache.probes Name get_cache_node_count Return integer

Returns the number of cache nodes associated to the cluster

:param cluster_id: str: the name of the cache cluster :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache node count\u201d, \u201ctolerance\u201d: 3, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cget_cache_node_count\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Signature:

def get_cache_node_count(cluster_id: str,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cache-node-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"get_cache_node_count\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: get-cache-node-count\nprovider:\narguments:\ncluster_id: ''\nfunc: get_cache_node_count\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_cache_node_status","title":"get_cache_node_status","text":"Type probe Module chaosaws.elasticache.probes Name get_cache_node_status Return string

Returns the status of the given cache cluster

:param cluster_id: str: the name of the cache cluster :param configuration: Configuration :param secrets: Secrets

:example: { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cvalidate cache node status\u201d, \u201ctolerance\u201d: \u201cavailable\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.elasticache.probes\u201d, \u201cfunc\u201d: \u201cget_cache_node_status\u201d, \u201carguments\u201d: { \u201ccluster_id\u201d: \u201cMyTestCluster\u201d } } }

Signature:

def get_cache_node_status(cluster_id: str,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cache-node-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.probes\",\n\"func\": \"get_cache_node_status\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: get-cache-node-status\nprovider:\narguments:\ncluster_id: ''\nfunc: get_cache_node_status\nmodule: chaosaws.elasticache.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#reboot_cache_clusters","title":"reboot_cache_clusters","text":"Type action Module chaosaws.elasticache.actions Name reboot_cache_clusters Return list

Reboots one or more nodes in a cache cluster. If no node ids are supplied, all nodes in the cluster will be rebooted

: cluster_ids: list: a list of one or more cache cluster ids node_ids: list: a list of one or more node ids in to the cluster

Signature:

def reboot_cache_clusters(\n        cluster_ids: List[str],\n        node_ids: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cluster_ids list Yes node_ids list null No

Usage:

JSONYAML
{\n\"name\": \"reboot-cache-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"reboot_cache_clusters\",\n\"arguments\": {\n\"cluster_ids\": []\n}\n}\n}\n
name: reboot-cache-clusters\nprovider:\narguments:\ncluster_ids: []\nfunc: reboot_cache_clusters\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#test_failover","title":"test_failover","text":"Type action Module chaosaws.elasticache.actions Name test_failover Return list

Tests automatic failover on a single shard (also known as node groups). You can only invoke test_failover for no more than 5 shards in any rolling 24-hour period.

: replication_group_id: str: the name of the replication group (also known as cluster) whose automatic failover is being tested by this operation. node_group_id: str: the name of the node group (also known as shard) in this replication group on which automatic failover is to be tested.

Signature:

def test_failover(\n        replication_group_id: str,\n        node_group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required replication_group_id string Yes node_group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"test-failover\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elasticache.actions\",\n\"func\": \"test_failover\",\n\"arguments\": {\n\"replication_group_id\": \"\",\n\"node_group_id\": \"\"\n}\n}\n}\n
name: test-failover\nprovider:\narguments:\nnode_group_id: ''\nreplication_group_id: ''\nfunc: test_failover\nmodule: chaosaws.elasticache.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#elbv2","title":"elbv2","text":""},{"location":"drivers/aws/#all_targets_healthy","title":"all_targets_healthy","text":"Type probe Module chaosaws.elbv2.probes Name all_targets_healthy Return mapping

Return true/false based on if all targets for listed target groups are healthy

Signature:

def all_targets_healthy(\n        tg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"all-targets-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"all_targets_healthy\",\n\"arguments\": {\n\"tg_names\": []\n}\n}\n}\n
name: all-targets-healthy\nprovider:\narguments:\ntg_names: []\nfunc: all_targets_healthy\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_load_balancer","title":"delete_load_balancer","text":"Type action Module chaosaws.elbv2.actions Name delete_load_balancer Return None

Deletes the provided load balancer(s).

: - load_balancer_names: a list of load balancer names

Signature:

def delete_load_balancer(load_balancer_names: List[str],\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes

Usage:

JSONYAML
{\n\"name\": \"delete-load-balancer\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"delete_load_balancer\",\n\"arguments\": {\n\"load_balancer_names\": []\n}\n}\n}\n
name: delete-load-balancer\nprovider:\narguments:\nload_balancer_names: []\nfunc: delete_load_balancer\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#deregister_target","title":"deregister_target","text":"Type action Module chaosaws.elbv2.actions Name deregister_target Return mapping

Deregisters one random target from target group

Signature:

def deregister_target(\n        tg_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_name string Yes

Usage:

JSONYAML
{\n\"name\": \"deregister-target\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"deregister_target\",\n\"arguments\": {\n\"tg_name\": \"\"\n}\n}\n}\n
name: deregister-target\nprovider:\narguments:\ntg_name: ''\nfunc: deregister_target\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#enable_access_log","title":"enable_access_log","text":"Type action Module chaosaws.elbv2.actions Name enable_access_log Return boolean

Enable or Disable Access logs of ELB

Signature:

def enable_access_log(load_balancer_arn: str,\n                      enable: bool = False,\n                      bucket_name: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required load_balancer_arn string Yes enable boolean false No bucket_name string null No

Usage:

JSONYAML
{\n\"name\": \"enable-access-log\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"enable_access_log\",\n\"arguments\": {\n\"load_balancer_arn\": \"\"\n}\n}\n}\n
name: enable-access-log\nprovider:\narguments:\nload_balancer_arn: ''\nfunc: enable_access_log\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#is_access_log_enabled","title":"is_access_log_enabled","text":"Type probe Module chaosaws.elbv2.probes Name is_access_log_enabled Return mapping

Verify access logging enabled on load balancer

Signature:

def is_access_log_enabled(\n        load_balancer_arn: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_arn string Yes

Usage:

JSONYAML
{\n\"name\": \"is-access-log-enabled\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"is_access_log_enabled\",\n\"arguments\": {\n\"load_balancer_arn\": \"\"\n}\n}\n}\n
name: is-access-log-enabled\nprovider:\narguments:\nload_balancer_arn: ''\nfunc: is_access_log_enabled\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#set_security_groups","title":"set_security_groups","text":"Type action Module chaosaws.elbv2.actions Name set_security_groups Return list

Changes the security groups for the specified load balancer(s). This action will replace the existing security groups on an application load balancer with the specified security groups.

: - load_balancer_names: a list of load balancer names - security_group_ids: a list of security group ids

returns: [ { \u2018LoadBalancerArn\u2019: \u2018string\u2019, \u2018SecurityGroupIds\u2019: [\u2018sg-0000000\u2019, \u2018sg-0000001\u2019] }, \u2026 ]

Signature:

def set_security_groups(\n        load_balancer_names: List[str],\n        security_group_ids: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes security_group_ids list Yes

Usage:

JSONYAML
{\n\"name\": \"set-security-groups\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"set_security_groups\",\n\"arguments\": {\n\"load_balancer_names\": [],\n\"security_group_ids\": []\n}\n}\n}\n
name: set-security-groups\nprovider:\narguments:\nload_balancer_names: []\nsecurity_group_ids: []\nfunc: set_security_groups\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#set_subnets","title":"set_subnets","text":"Type action Module chaosaws.elbv2.actions Name set_subnets Return list

Changes the subnets for the specified application load balancer(s) This action will replace the existing security groups on an application load balancer with the specified security groups.

: - load_balancer_names: a list of load balancer names - subnet_ids: a list of subnet ids

returns: [ { \u2018LoadBalancerArn\u2019: \u2018string\u2019, \u2018AvailabilityZones\u2019: { \u2018ZoneName\u2019: \u2018string\u2019, \u2018SubnetId\u2019: \u2018string\u2019, \u2018LoadBalancerAddresses\u2019: [ { \u2018IpAddress\u2019: \u2018string\u2019, \u2018AllocationId\u2019: \u2018string\u2019 } ] } }, \u2026 ]

Signature:

def set_subnets(\n        load_balancer_names: List[str],\n        subnet_ids: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required load_balancer_names list Yes subnet_ids list Yes

Usage:

JSONYAML
{\n\"name\": \"set-subnets\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.actions\",\n\"func\": \"set_subnets\",\n\"arguments\": {\n\"load_balancer_names\": [],\n\"subnet_ids\": []\n}\n}\n}\n
name: set-subnets\nprovider:\narguments:\nload_balancer_names: []\nsubnet_ids: []\nfunc: set_subnets\nmodule: chaosaws.elbv2.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#targets_health_count","title":"targets_health_count","text":"Type probe Module chaosaws.elbv2.probes Name targets_health_count Return mapping

Count of healthy/unhealthy targets per targetgroup

Signature:

def targets_health_count(\n        tg_names: List[str],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required tg_names list Yes

Usage:

JSONYAML
{\n\"name\": \"targets-health-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.elbv2.probes\",\n\"func\": \"targets_health_count\",\n\"arguments\": {\n\"tg_names\": []\n}\n}\n}\n
name: targets-health-count\nprovider:\narguments:\ntg_names: []\nfunc: targets_health_count\nmodule: chaosaws.elbv2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#emr","title":"emr","text":""},{"location":"drivers/aws/#describe_cluster_2","title":"describe_cluster","text":"Type probe Module chaosaws.emr.probes Name describe_cluster Return mapping

Describe a single EMR cluster

:param cluster_id: The cluster id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_cluster(\n        cluster_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-cluster\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: describe-cluster\nprovider:\narguments:\ncluster_id: ''\nfunc: describe_cluster\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instance_fleet","title":"describe_instance_fleet","text":"Type probe Module chaosaws.emr.probes Name describe_instance_fleet Return mapping

Describe a single EMR instance fleet

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_instance_fleet(\n        cluster_id: str,\n        fleet_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance-fleet\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_instance_fleet\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: describe-instance-fleet\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: describe_instance_fleet\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#describe_instance_group","title":"describe_instance_group","text":"Type probe Module chaosaws.emr.probes Name describe_instance_group Return mapping

Describe a single EMR instance group

:param cluster_id: The cluster id :param group_id: The instance group id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def describe_instance_group(\n        cluster_id: str,\n        group_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance-group\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"describe_instance_group\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: describe-instance-group\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: describe_instance_group\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_cluster_fleet_instances","title":"list_cluster_fleet_instances","text":"Type probe Module chaosaws.emr.probes Name list_cluster_fleet_instances Return mapping

Get a list of instance fleet instances associated to the EMR cluster

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param fleet_type: The instance fleet type :param instance_states: A list of instance states to include :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def list_cluster_fleet_instances(\n        cluster_id: str,\n        fleet_id: str,\n        fleet_type: str = None,\n        instance_states: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes fleet_type string null No instance_states list null No

Usage:

JSONYAML
{\n\"name\": \"list-cluster-fleet-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"list_cluster_fleet_instances\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: list-cluster-fleet-instances\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: list_cluster_fleet_instances\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#list_cluster_group_instances","title":"list_cluster_group_instances","text":"Type probe Module chaosaws.emr.probes Name list_cluster_group_instances Return mapping

Get a list of instance group instances associated to the EMR cluster

:param cluster_id: The cluster id :param group_id: The instance group id :param group_type: The instance group type :param instance_states: A list of instance states to include :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def list_cluster_group_instances(\n        cluster_id: str,\n        group_id: str,\n        group_type: str = None,\n        instance_states: List[str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes group_type string null No instance_states list null No

Usage:

JSONYAML
{\n\"name\": \"list-cluster-group-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.probes\",\n\"func\": \"list_cluster_group_instances\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: list-cluster-group-instances\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: list_cluster_group_instances\nmodule: chaosaws.emr.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#modify_cluster","title":"modify_cluster","text":"Type action Module chaosaws.emr.actions Name modify_cluster Return mapping

Set the step concurrency level on the provided cluster

:param cluster_id: The cluster id :param concurrency: The number of steps to execute concurrently (1 - 256) :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_cluster(\n        cluster_id: str,\n        concurrency: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes concurrency integer Yes

Usage:

JSONYAML
{\n\"name\": \"modify-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_cluster\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"concurrency\": 0\n}\n}\n}\n
name: modify-cluster\nprovider:\narguments:\ncluster_id: ''\nconcurrency: 0\nfunc: modify_cluster\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_fleet","title":"modify_instance_fleet","text":"Type action Module chaosaws.emr.actions Name modify_instance_fleet Return mapping

Modify the on-demand and spot capacities for an instance fleet

:param cluster_id: The cluster id :param fleet_id: The instance fleet id :param on_demand_capacity: Target capacity of on-demand units :param spot_capacity: Target capacity of spot units :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_fleet(\n        cluster_id: str,\n        fleet_id: str,\n        on_demand_capacity: int = None,\n        spot_capacity: int = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes fleet_id string Yes on_demand_capacity integer null No spot_capacity integer null No

Usage:

JSONYAML
{\n\"name\": \"modify-instance-fleet\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_fleet\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"fleet_id\": \"\"\n}\n}\n}\n
name: modify-instance-fleet\nprovider:\narguments:\ncluster_id: ''\nfleet_id: ''\nfunc: modify_instance_fleet\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_groups_instance_count","title":"modify_instance_groups_instance_count","text":"Type action Module chaosaws.emr.actions Name modify_instance_groups_instance_count Return mapping

Modify the number of instances in an instance group

:param cluster_id: The cluster id :param group_id: The instance group id :param instance_count: The target size for the instance group :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_groups_instance_count(\n        cluster_id: str,\n        group_id: str,\n        instance_count: int,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes instance_count integer Yes

Usage:

JSONYAML
{\n\"name\": \"modify-instance-groups-instance-count\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_groups_instance_count\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\",\n\"instance_count\": 0\n}\n}\n}\n
name: modify-instance-groups-instance-count\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\ninstance_count: 0\nfunc: modify_instance_groups_instance_count\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#modify_instance_groups_shrink_policy","title":"modify_instance_groups_shrink_policy","text":"Type action Module chaosaws.emr.actions Name modify_instance_groups_shrink_policy Return mapping

Modify an instance groups shrink operations

:param cluster_id: The cluster id :param group_id: The instance group id :param decommission_timeout: Timeout for decommissioning an instance :param terminate_instances: Instance id list to terminate when shrinking :param protect_instances: Instance id list to protect when shrinking :param termination_timeout: Override for list of instances to terminate :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: Dict[str, Any]

Signature:

def modify_instance_groups_shrink_policy(\n        cluster_id: str,\n        group_id: str,\n        decommission_timeout: int = None,\n        terminate_instances: List[str] = None,\n        protect_instances: List[str] = None,\n        termination_timeout: int = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes group_id string Yes decommission_timeout integer null No terminate_instances list null No protect_instances list null No termination_timeout integer null No

Usage:

JSONYAML
{\n\"name\": \"modify-instance-groups-shrink-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.emr.actions\",\n\"func\": \"modify_instance_groups_shrink_policy\",\n\"arguments\": {\n\"cluster_id\": \"\",\n\"group_id\": \"\"\n}\n}\n}\n
name: modify-instance-groups-shrink-policy\nprovider:\narguments:\ncluster_id: ''\ngroup_id: ''\nfunc: modify_instance_groups_shrink_policy\nmodule: chaosaws.emr.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#fis","title":"fis","text":""},{"location":"drivers/aws/#get_experiment","title":"get_experiment","text":"Type probe Module chaosaws.fis.probes Name get_experiment Return mapping

Gets information about the specified experiment.

:param experiment_id: str representing the id of the experiment to fetch information of :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon retrieving the experiment information

get_experiment( \u2026 experiment_id=\u201dEXPTUCK2dxepXgkR38\u201d \u2026 ) {\u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u20180665fe39-2213-400b-b7ff-5f1ab9b7a5ea\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Fri, 20 Aug 2021 11:08:27 GMT\u2019, \u2026 \u2018experiment\u2019: {\u2018id\u2019: \u2018EXPTUCK2dxepXgkR38\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

Signature:

def get_experiment(\n        experiment_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-experiment\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.probes\",\n\"func\": \"get_experiment\",\n\"arguments\": {\n\"experiment_id\": \"\"\n}\n}\n}\n
name: get-experiment\nprovider:\narguments:\nexperiment_id: ''\nfunc: get_experiment\nmodule: chaosaws.fis.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#start_experiment","title":"start_experiment","text":"Type action Module chaosaws.fis.actions Name start_experiment Return mapping

Starts running an experiment from the specified experiment template.

:param experiment_template_id: str representing the id of the experiment template to run :param client_token: str representing the unique identifier for this experiment run. If a value is not provided, boto3 generates one for you :param tags: Dict[str, str] representing tags to apply to the experiment that is started :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon starting the experiment

start_experiment( \u2026experiment_template_id=\u201dEXT6oWVA1WrLNy4XS\u201d \u2026 ) { \u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u20181ceaedae-5897-4b64-9ade-9e94449f1262\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Thu, 12 Aug 2021 14:21:19 GMT\u2019, \u2026 \u2018experiment\u2019: {\u2018id\u2019: \u2018EXPXDPecuQBFiZs1Jz\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

start_experiment( \u2026experiment_template_id=\u201dEXT6oWVA1WrLNy4XS\u201d, \u2026client_token=\u201dmy-unique-token\u201d, \u2026tags={\u201ca-key\u201d: \u201ca-value\u201d} \u2026 )

Signature:

def start_experiment(\n        experiment_template_id: str,\n        client_token: str = None,\n        tags: Dict[str, str] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_template_id string Yes client_token string null No tags mapping null No

Usage:

JSONYAML
{\n\"name\": \"start-experiment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.actions\",\n\"func\": \"start_experiment\",\n\"arguments\": {\n\"experiment_template_id\": \"\"\n}\n}\n}\n
name: start-experiment\nprovider:\narguments:\nexperiment_template_id: ''\nfunc: start_experiment\nmodule: chaosaws.fis.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_experiment","title":"stop_experiment","text":"Type action Module chaosaws.fis.actions Name stop_experiment Return mapping

Stops the specified experiment.

:param experiment_id: str representing the running experiment to stop :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: AWSResponse representing the response from FIS upon stopping the experiment

stop_experiment(experiment_id=\u201dEXPTUCK2dxepXgkR38\u201d) {\u2018ResponseMetadata\u2019: {\u2018RequestId\u2019: \u2018e5e9f9a9-f4d0-4d72-8704-1f26cc8b6ad6\u2019, \u2018HTTPStatusCode\u2019: 200, \u2018HTTPHeaders\u2019: {\u2018date\u2019: \u2018Fri, 13 Aug 2021 09:12:17 GMT\u2019, \u2026\u2019experiment\u2019: {\u2018id\u2019: \u2018EXPTUCK2dxepXgkR38\u2019, \u2018experimentTemplateId\u2019: \u2018EXT6oWVA1WrLNy4XS\u2019, \u2026 }

Signature:

def stop_experiment(\n        experiment_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required experiment_id string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-experiment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.fis.actions\",\n\"func\": \"stop_experiment\",\n\"arguments\": {\n\"experiment_id\": \"\"\n}\n}\n}\n
name: stop-experiment\nprovider:\narguments:\nexperiment_id: ''\nfunc: stop_experiment\nmodule: chaosaws.fis.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#iam","title":"iam","text":""},{"location":"drivers/aws/#attach_role_policy","title":"attach_role_policy","text":"Type action Module chaosaws.iam.actions Name attach_role_policy Return mapping

Attach a role to a policy.

Signature:

def attach_role_policy(\n        arn: str,\n        role_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required arn string Yes role_name string Yes

Usage:

JSONYAML
{\n\"name\": \"attach-role-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"attach_role_policy\",\n\"arguments\": {\n\"arn\": \"\",\n\"role_name\": \"\"\n}\n}\n}\n
name: attach-role-policy\nprovider:\narguments:\narn: ''\nrole_name: ''\nfunc: attach_role_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#create_policy","title":"create_policy","text":"Type action Module chaosaws.iam.actions Name create_policy Return mapping

Create a new IAM policy

Signature:

def create_policy(name: str,\n                  policy: Dict[str, Any],\n                  path: str = '/',\n                  description: str = '',\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes policy mapping Yes path string \u201d/\u201d No description string \u201d\u201c No

Usage:

JSONYAML
{\n\"name\": \"create-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"create_policy\",\n\"arguments\": {\n\"name\": \"\",\n\"policy\": {}\n}\n}\n}\n
name: create-policy\nprovider:\narguments:\nname: ''\npolicy: {}\nfunc: create_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#detach_role_policy","title":"detach_role_policy","text":"Type action Module chaosaws.iam.actions Name detach_role_policy Return mapping

Detach a role from a policy.

Signature:

def detach_role_policy(\n        arn: str,\n        role_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required arn string Yes role_name string Yes

Usage:

JSONYAML
{\n\"name\": \"detach-role-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.actions\",\n\"func\": \"detach_role_policy\",\n\"arguments\": {\n\"arn\": \"\",\n\"role_name\": \"\"\n}\n}\n}\n
name: detach-role-policy\nprovider:\narguments:\narn: ''\nrole_name: ''\nfunc: detach_role_policy\nmodule: chaosaws.iam.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_policy","title":"get_policy","text":"Type probe Module chaosaws.iam.probes Name get_policy Return boolean

Get a policy by its ARN

Signature:

def get_policy(arn: str,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required arn string Yes

Usage:

JSONYAML
{\n\"name\": \"get-policy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.iam.probes\",\n\"func\": \"get_policy\",\n\"arguments\": {\n\"arn\": \"\"\n}\n}\n}\n
name: get-policy\nprovider:\narguments:\narn: ''\nfunc: get_policy\nmodule: chaosaws.iam.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#rds","title":"rds","text":""},{"location":"drivers/aws/#cluster_membership_count","title":"cluster_membership_count","text":"Type probe Module chaosaws.rds.probes Name cluster_membership_count Return integer

Signature:

def cluster_membership_count(cluster_id: str,\n                             configuration: Dict[str, Dict[str, str]] = None,\n                             secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required cluster_id string Yes

Usage:

JSONYAML
{\n\"name\": \"cluster-membership-count\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"cluster_membership_count\",\n\"arguments\": {\n\"cluster_id\": \"\"\n}\n}\n}\n
name: cluster-membership-count\nprovider:\narguments:\ncluster_id: ''\nfunc: cluster_membership_count\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#cluster_status","title":"cluster_status","text":"Type probe Module chaosaws.rds.probes Name cluster_status Return Union[str, List[str]]

Signature:

def cluster_status(\n        cluster_id: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Union[str, List[str]]:\n    pass\n

Arguments:

Name Type Default Required cluster_id string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"cluster-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"cluster_status\"\n}\n}\n
name: cluster-status\nprovider:\nfunc: cluster_status\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_db_cluster","title":"delete_db_cluster","text":"Type action Module chaosaws.rds.actions Name delete_db_cluster Return mapping

Deletes an Aurora DB cluster

Signature:

def delete_db_cluster(\n        db_cluster_identifier: str,\n        skip_final_snapshot: bool = True,\n        db_snapshot_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes skip_final_snapshot boolean true No db_snapshot_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"delete-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: delete-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: delete_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_db_cluster_endpoint","title":"delete_db_cluster_endpoint","text":"Type action Module chaosaws.rds.actions Name delete_db_cluster_endpoint Return mapping

Deletes the custom endpoint of an Aurora cluster

Signature:

def delete_db_cluster_endpoint(\n        db_cluster_identifier: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-db-cluster-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_cluster_endpoint\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: delete-db-cluster-endpoint\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: delete_db_cluster_endpoint\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_db_instance","title":"delete_db_instance","text":"Type action Module chaosaws.rds.actions Name delete_db_instance Return mapping

Deletes a RDS instance

Signature:

def delete_db_instance(\n        db_instance_identifier: str,\n        skip_final_snapshot: bool = True,\n        db_snapshot_identifier: str = None,\n        delete_automated_backups: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes skip_final_snapshot boolean true No db_snapshot_identifier string null No delete_automated_backups boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"delete_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: delete-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: delete_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#failover_db_cluster","title":"failover_db_cluster","text":"Type action Module chaosaws.rds.actions Name failover_db_cluster Return mapping

Forces a failover for a DB cluster.

Signature:

def failover_db_cluster(\n        db_cluster_identifier: str,\n        target_db_instance_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes target_db_instance_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"failover-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"failover_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: failover-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: failover_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#instance_status","title":"instance_status","text":"Type probe Module chaosaws.rds.probes Name instance_status Return Union[str, List[str]]

Signature:

def instance_status(\n        instance_id: str = None,\n        filters: List[Dict[str, Any]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Union[str, List[str]]:\n    pass\n

Arguments:

Name Type Default Required instance_id string null No filters list null No

Usage:

JSONYAML
{\n\"name\": \"instance-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.probes\",\n\"func\": \"instance_status\"\n}\n}\n
name: instance-status\nprovider:\nfunc: instance_status\nmodule: chaosaws.rds.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#reboot_db_instance","title":"reboot_db_instance","text":"Type action Module chaosaws.rds.actions Name reboot_db_instance Return mapping

Forces a reboot of your DB instance.

Signature:

def reboot_db_instance(\n        db_instance_identifier: str,\n        force_failover: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes force_failover boolean false No

Usage:

JSONYAML
{\n\"name\": \"reboot-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"reboot_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: reboot-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: reboot_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_db_cluster","title":"stop_db_cluster","text":"Type action Module chaosaws.rds.actions Name stop_db_cluster Return mapping

Stop a RDS Cluster

Signature:

def stop_db_cluster(\n        db_cluster_identifier: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_cluster_identifier string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-db-cluster\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"stop_db_cluster\",\n\"arguments\": {\n\"db_cluster_identifier\": \"\"\n}\n}\n}\n
name: stop-db-cluster\nprovider:\narguments:\ndb_cluster_identifier: ''\nfunc: stop_db_cluster\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#stop_db_instance","title":"stop_db_instance","text":"Type action Module chaosaws.rds.actions Name stop_db_instance Return mapping

Stops a RDS DB instance

Signature:

def stop_db_instance(\n        db_instance_identifier: str,\n        db_snapshot_identifier: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required db_instance_identifier string Yes db_snapshot_identifier string null No

Usage:

JSONYAML
{\n\"name\": \"stop-db-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.rds.actions\",\n\"func\": \"stop_db_instance\",\n\"arguments\": {\n\"db_instance_identifier\": \"\"\n}\n}\n}\n
name: stop-db-instance\nprovider:\narguments:\ndb_instance_identifier: ''\nfunc: stop_db_instance\nmodule: chaosaws.rds.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#route53","title":"route53","text":""},{"location":"drivers/aws/#associate_vpc_with_zone","title":"associate_vpc_with_zone","text":"Type action Module chaosaws.route53.actions Name associate_vpc_with_zone Return mapping

Associate a VPC with a private hosted zone

:param zone_id: The hosted zone id :param vpc_id: The id of the vpc :param vpc_region: The region of the vpc :param configuration: access values used by actions/probes :param comment: a comment regarding the request :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def associate_vpc_with_zone(\n        zone_id: str,\n        vpc_id: str,\n        vpc_region: str,\n        comment: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes vpc_id string Yes vpc_region string Yes comment string null No

Usage:

JSONYAML
{\n\"name\": \"associate-vpc-with-zone\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.actions\",\n\"func\": \"associate_vpc_with_zone\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"vpc_id\": \"\",\n\"vpc_region\": \"\"\n}\n}\n}\n
name: associate-vpc-with-zone\nprovider:\narguments:\nvpc_id: ''\nvpc_region: ''\nzone_id: ''\nfunc: associate_vpc_with_zone\nmodule: chaosaws.route53.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#disassociate_vpc_from_zone","title":"disassociate_vpc_from_zone","text":"Type action Module chaosaws.route53.actions Name disassociate_vpc_from_zone Return mapping

Remove an association between a VPC and a private hosted zone

:param zone_id: The hosted zone id :param vpc_id: The id of the vpc :param vpc_region: The region of the vpc :param comment: A note regarding the disassociation request :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def disassociate_vpc_from_zone(\n        zone_id: str,\n        vpc_id: str,\n        vpc_region: str,\n        comment: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes vpc_id string Yes vpc_region string Yes comment string null No

Usage:

JSONYAML
{\n\"name\": \"disassociate-vpc-from-zone\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.actions\",\n\"func\": \"disassociate_vpc_from_zone\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"vpc_id\": \"\",\n\"vpc_region\": \"\"\n}\n}\n}\n
name: disassociate-vpc-from-zone\nprovider:\narguments:\nvpc_id: ''\nvpc_region: ''\nzone_id: ''\nfunc: disassociate_vpc_from_zone\nmodule: chaosaws.route53.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#get_dns_answer","title":"get_dns_answer","text":"Type probe Module chaosaws.route53.probes Name get_dns_answer Return mapping

Get the DNS response for the specified record name & type

:param zone_id: The route53 zone id :param record_name: The name of the record to get a response for :param record_type: The type of the record set :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_dns_answer(\n        zone_id: str,\n        record_name: str,\n        record_type: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes record_name string Yes record_type string Yes

Usage:

JSONYAML
{\n\"name\": \"get-dns-answer\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_dns_answer\",\n\"arguments\": {\n\"zone_id\": \"\",\n\"record_name\": \"\",\n\"record_type\": \"\"\n}\n}\n}\n
name: get-dns-answer\nprovider:\narguments:\nrecord_name: ''\nrecord_type: ''\nzone_id: ''\nfunc: get_dns_answer\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_health_check_status","title":"get_health_check_status","text":"Type probe Module chaosaws.route53.probes Name get_health_check_status Return mapping

Get the status of the specified health check

:param check_id: The health check id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_health_check_status(\n        check_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required check_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-health-check-status\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_health_check_status\",\n\"arguments\": {\n\"check_id\": \"\"\n}\n}\n}\n
name: get-health-check-status\nprovider:\narguments:\ncheck_id: ''\nfunc: get_health_check_status\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_hosted_zone","title":"get_hosted_zone","text":"Type probe Module chaosaws.route53.probes Name get_hosted_zone Return mapping

Pull information regarding a specific zone id

:param zone_id: The route53 zone id :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :returns: Dict[str, Any]

Signature:

def get_hosted_zone(\n        zone_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required zone_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-hosted-zone\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.route53.probes\",\n\"func\": \"get_hosted_zone\",\n\"arguments\": {\n\"zone_id\": \"\"\n}\n}\n}\n
name: get-hosted-zone\nprovider:\narguments:\nzone_id: ''\nfunc: get_hosted_zone\nmodule: chaosaws.route53.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#s3","title":"s3","text":""},{"location":"drivers/aws/#bucket_exists","title":"bucket_exists","text":"Type probe Module chaosaws.s3.probes Name bucket_exists Return boolean

Validate that a bucket exists

:param bucket_name: The name of the S3 bucket :param configuration: access values used by actions/probes :param secrets: values that need to be passed on to actions/probes :return: boolean

Signature:

def bucket_exists(bucket_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes

Usage:

JSONYAML
{\n\"name\": \"bucket-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.probes\",\n\"func\": \"bucket_exists\",\n\"arguments\": {\n\"bucket_name\": \"\"\n}\n}\n}\n
name: bucket-exists\nprovider:\narguments:\nbucket_name: ''\nfunc: bucket_exists\nmodule: chaosaws.s3.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#delete_object","title":"delete_object","text":"Type action Module chaosaws.s3.actions Name delete_object Return None

Delete an object in a S3 bucket

:param bucket_name: the S3 bucket name :param object_key: the path to the object :param version_id: the version id of the object (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: None

Signature:

def delete_object(bucket_name: str,\n                  object_key: str,\n                  version_id: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_key string Yes version_id string null No

Usage:

JSONYAML
{\n\"name\": \"delete-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.actions\",\n\"func\": \"delete_object\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_key\": \"\"\n}\n}\n}\n
name: delete-object\nprovider:\narguments:\nbucket_name: ''\nobject_key: ''\nfunc: delete_object\nmodule: chaosaws.s3.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#object_exists","title":"object_exists","text":"Type probe Module chaosaws.s3.probes Name object_exists Return boolean

Validate that an object exists in a S3 bucket

:param bucket_name: the name of the S3 bucket :param object_key: the path to the object :param version_id: the version id of the object (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: boolean

Signature:

def object_exists(bucket_name: str,\n                  object_key: str,\n                  version_id: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_key string Yes version_id string null No

Usage:

JSONYAML
{\n\"name\": \"object-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.probes\",\n\"func\": \"object_exists\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_key\": \"\"\n}\n}\n}\n
name: object-exists\nprovider:\narguments:\nbucket_name: ''\nobject_key: ''\nfunc: object_exists\nmodule: chaosaws.s3.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#toggle_versioning","title":"toggle_versioning","text":"Type action Module chaosaws.s3.actions Name toggle_versioning Return null

Toggles versioning on a S3 bucket

If the \u201cstatus\u201d parameter is not provided, the bucket will be scanned to determine if versioning is enabled. If it is enabled, it will be suspended. If it is suspended it will be enabled using basic values unless MFA is provided.

:param bucket_name: The S3 bucket name :param status: \u201cEnabled\u201d to turn on versioning, \u201cSuspended\u201d to disable :param mfa: The authentication device serial number, a space, and the value from the device (optional) :param mfa_delete: Specifies if MFA delete is enabled in the bucket versioning (optional) :param owner: The account ID of the expected bucket owner (optional) :param configuration: access values used by actions/probes (optional) :param secrets: values that need to be passed on to actions/probes (optional) :return: None

Signature:

def toggle_versioning(bucket_name: str,\n                      mfa_delete: str = None,\n                      status: str = None,\n                      mfa: str = None,\n                      owner: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> None:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes mfa_delete string null No status string null No mfa string null No owner string null No

Usage:

JSONYAML
{\n\"name\": \"toggle-versioning\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.s3.actions\",\n\"func\": \"toggle_versioning\",\n\"arguments\": {\n\"bucket_name\": \"\"\n}\n}\n}\n
name: toggle-versioning\nprovider:\narguments:\nbucket_name: ''\nfunc: toggle_versioning\nmodule: chaosaws.s3.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#controls","title":"controls","text":""},{"location":"drivers/aws/#ssm","title":"ssm","text":""},{"location":"drivers/aws/#create_document","title":"create_document","text":"Type action Module chaosaws.ssm.actions Name create_document Return mapping

creates a Systems Manager (SSM) document. An SSM document defines the actions that SSM performs on your managed. For more information about SSM documents: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.create_document

Signature:

def create_document(\n        path_content: str,\n        name: str,\n        version_name: str = None,\n        document_type: str = None,\n        document_format: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required path_content string Yes name string Yes version_name string null No document_type string null No document_format string null No

Usage:

JSONYAML
{\n\"name\": \"create-document\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"create_document\",\n\"arguments\": {\n\"path_content\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: create-document\nprovider:\narguments:\nname: ''\npath_content: ''\nfunc: create_document\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#delete_document","title":"delete_document","text":"Type action Module chaosaws.ssm.actions Name delete_document Return mapping

creates a Systems Manager (SSM) document.

An SSM document defines the actions that SSM performs on your managed. For more information about SSM documents: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.create_document

Signature:

def delete_document(\n        name: str,\n        version_name: str = None,\n        force: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes version_name string null No force boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-document\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"delete_document\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: delete-document\nprovider:\narguments:\nname: ''\nfunc: delete_document\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#put_parameter","title":"put_parameter","text":"Type action Module chaosaws.ssm.actions Name put_parameter Return mapping

Add or update a parameter in the Systems Manager Parameter Store.

:param name: str name of the parameter :param value: str value of the parameter :param description: str information about the parameter :param type: str type of the paramater value, such as \u2018String\u2019 :param key_id: str KMS key id to use while encrypting the parameter value :param overwrite: bool allow the parameter value to be overwritten :param allowed_pattern: str regex to validate parameter value :param tags: List[Dict[str, str]] metadata about the parameter :param tier: str storage classes such as \u2018Advanced\u2019 to allow larger parameter values :param policies: str storage policies such as expiration in JSON format :param data_type: str data type for String. Allows the validation of AMI IDs :param configuration: Configuration object representing the CTK Configuration :param secrets: Secret object representing the CTK Secrets :returns: dict representing the Version and Tier of the parameter

Configuration within experiment { \u201cname\u201d: \u201cActivate Chaos\u201d, \u201ctype\u201d: \u201caction\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cchaosaws.ssm.actions\u201d, \u201cfunc\u201d: \u201cput_parameter\u201d, \u201carguments\u201d: { \u201cname\u201d: \u201cchaos_trigger\u201d, \u201cvalue\u201d: true, \u201coverwrite\u201d: true, \u201ctype\u201d: \u201cSecureString\u201d, } }, }

Signature:

def put_parameter(name: str,\n                  value: str,\n                  description: str = None,\n                  type: str = None,\n                  key_id: str = None,\n                  overwrite: bool = False,\n                  allowed_pattern: str = None,\n                  tags: List[Dict[str, str]] = None,\n                  tier: str = None,\n                  policies: str = None,\n                  data_type: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes value string Yes description string null No type string null No key_id string null No overwrite boolean false No allowed_pattern string null No tags list null No tier string null No policies string null No data_type string null No

Usage:

JSONYAML
{\n\"name\": \"put-parameter\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"put_parameter\",\n\"arguments\": {\n\"name\": \"\",\n\"value\": \"\"\n}\n}\n}\n
name: put-parameter\nprovider:\narguments:\nname: ''\nvalue: ''\nfunc: put_parameter\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#send_command","title":"send_command","text":"Type action Module chaosaws.ssm.actions Name send_command Return mapping

Runs commands on one or more managed instances.

An SSM document defines the actions that SSM performs on your managed. For more information about SSM SendCommand: https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_SendCommand.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.send_command

Signature:

def send_command(document_name: str,\n                 targets: List[Dict[str, Any]] = None,\n                 document_version: str = None,\n                 parameters: Dict[str, Any] = None,\n                 timeout_seconds: int = None,\n                 max_concurrency: str = None,\n                 max_errors: str = None,\n                 region: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required document_name string Yes targets list null No document_version string null No parameters mapping null No timeout_seconds integer null No max_concurrency string null No max_errors string null No region string null No

Usage:

JSONYAML
{\n\"name\": \"send-command\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ssm.actions\",\n\"func\": \"send_command\",\n\"arguments\": {\n\"document_name\": \"\"\n}\n}\n}\n
name: send-command\nprovider:\narguments:\ndocument_name: ''\nfunc: send_command\nmodule: chaosaws.ssm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/aws/#xray","title":"xray","text":""},{"location":"drivers/aws/#get_most_recent_trace","title":"get_most_recent_trace","text":"Type probe Module chaosaws.xray.probes Name get_most_recent_trace Return Union[Dict[str, Any], List[Dict[str, Any]]]

Return a list of recent XRay traces within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

Be careful about what you ask for, this can lead to a huge amount of traces being returned. Try to filter using filter_expression.

The response is the AWS response as-is. The content of each segments of the trace are encoded as a json string. By setting raw_segments you ask for the list of segment documents decoded. Useful in an hypothesis scenario with a tolerance set to a jsonpath for instance.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/batch_get_traces.html

Signature:

def get_most_recent_trace(\n    start_time: Union[str, float] = '3 minutes',\n    end_time: Union[str, float] = 'now',\n    time_range_type: str = 'TraceId',\n    filter_expression: str = 'groupname = \"Default\"',\n    sampling: bool = False,\n    sampling_strategy: Optional[Dict[str, float]] = None,\n    raw_segments: bool = False,\n    configuration: Dict[str, Dict[str, str]] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Union[Dict[str, Any], List[Dict[str, Any]]]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No raw_segments boolean false No

Usage:

JSONYAML
{\n\"name\": \"get-most-recent-trace\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_most_recent_trace\"\n}\n}\n
name: get-most-recent-trace\nprovider:\nfunc: get_most_recent_trace\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_service_graph","title":"get_service_graph","text":"Type probe Module chaosaws.xray.probes Name get_service_graph Return Union[Dict[str, Any], List[Dict[str, Any]]]

Return a service graph for a given group at a given moment.

See more information: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/get_service_graph.html

Signature:

def get_service_graph(\n    start_time: Union[str, float] = '3 minutes',\n    end_time: Union[str, float] = 'now',\n    group_name: Optional[str] = 'Default',\n    group_arn: Optional[str] = None,\n    configuration: Dict[str, Dict[str, str]] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Union[Dict[str, Any], List[Dict[str, Any]]]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No group_name object \u201cDefault\u201d No group_arn object null No

Usage:

JSONYAML
{\n\"name\": \"get-service-graph\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_service_graph\"\n}\n}\n
name: get-service-graph\nprovider:\nfunc: get_service_graph\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_traces","title":"get_traces","text":"Type probe Module chaosaws.xray.probes Name get_traces Return mapping

Return a list of recent XRay traces within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

This will never return more than 5 traces as per the limits set by the AWS API. It will always pick the 5 newest.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/batch_get_traces.html

Signature:

def get_traces(start_time: Union[str, float] = '3 minutes',\n               end_time: Union[str, float] = 'now',\n               time_range_type: str = 'TraceId',\n               filter_expression: str = 'groupname = \"Default\"',\n               sampling: bool = False,\n               sampling_strategy: Optional[Dict[str, float]] = None,\n               quantity: int = 5,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No quantity integer 5 No

Usage:

JSONYAML
{\n\"name\": \"get-traces\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_traces\"\n}\n}\n
name: get-traces\nprovider:\nfunc: get_traces\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/aws/#get_traces_summaries","title":"get_traces_summaries","text":"Type probe Module chaosaws.xray.probes Name get_traces_summaries Return mapping

Return a list of recent XRay trace summaries within the given time range.

Time can be given as a float, which is an absolute Unix timestamp (UTC) or as a string representing a relative period such as \u201c1 minute\u201d.

Supported units are: seconds, minutes, hours and days. Plural and singular.

Be careful about what you ask for, this can lead to a huge amount of traces being returned. Try to filter using filter_expression and/or sampling.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/xray/client/get_trace_summaries.html

Signature:

def get_traces_summaries(\n        start_time: Union[str, float] = '3 minutes',\n        end_time: Union[str, float] = 'now',\n        time_range_type: str = 'TraceId',\n        filter_expression: str = 'groupname = \"Default\"',\n        sampling: bool = False,\n        sampling_strategy: Optional[Dict[str, float]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required start_time object \u201c3 minutes\u201d No end_time object \u201cnow\u201d No time_range_type string \u201cTraceId\u201d No filter_expression string \u201cgroupname = \u201cDefault\u201d\u201c No sampling boolean false No sampling_strategy object null No

Usage:

JSONYAML
{\n\"name\": \"get-traces-summaries\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.xray.probes\",\n\"func\": \"get_traces_summaries\"\n}\n}\n
name: get-traces-summaries\nprovider:\nfunc: get_traces_summaries\nmodule: chaosaws.xray.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/","title":"Extension chaosazure","text":"Version 0.16.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-azure

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Azure platform.

"},{"location":"drivers/azure/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-azure\n
"},{"location":"drivers/azure/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vm.actions\",\n\"func\": \"stop_machines\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/azure/#configuration","title":"Configuration","text":"

This extension uses the Azure SDK libraries under the hood. The Azure SDK library expects that you have a tenant and client identifier, as well as a client secret and subscription, that allows you to authenticate with the Azure resource management API.

Configuration values for the Chaos Toolkit Extension for Azure can come from several sources:

The extension will first try to load the configuration from the experiment file. If configuration is not provided in the experiment file, it will try to load it from the Azure credential file.

"},{"location":"drivers/azure/#credentials","title":"Credentials","text":""},{"location":"drivers/azure/#environment-variables","title":"Environment Variables","text":"

You can pass credentials via the following environment variables:

Or:

"},{"location":"drivers/azure/#experiment-secrets","title":"Experiment Secrets","text":"

You may also pass them via the secrets block of the experiment:

{\n\"secrets\": {\n\"azure\": {\n\"client_id\": \"your-super-secret-client-id\",\n\"client_secret\": \"your-even-more-super-secret-client-secret\",\n\"tenant_id\": \"your-tenant-id\"\n}\n}\n}\n

You can retrieve secretes as well from environment or HashiCorp vault.

If you are not working with Public Global Azure, e.g. China Cloud You can set the cloud environment.

{\n\"client_id\": \"your-super-secret-client-id\",\n\"client_secret\": \"your-even-more-super-secret-client-secret\",\n\"tenant_id\": \"your-tenant-id\",\n\"cloud\": \"AZURE_CHINA_CLOUD\"\n}\n

Available cloud names:

Either of these values can be passed via AZURE_CLOUD as well.

"},{"location":"drivers/azure/#azure-credential-file","title":"Azure Credential File","text":"

You may also pass them via the Azure credential file:

You can retrieve a credentials file with your subscription ID already in place by signing in to Azure using the az login command followed by the az ad sp create-for-rbac command

az login\naz ad sp create-for-rbac --sdk-auth > credentials.json\n

credentials.json:

{\n\"subscriptionId\": \"<azure_aubscription_id>\",\n\"tenantId\": \"<tenant_id>\",\n\"clientId\": \"<application_id>\",\n\"clientSecret\": \"<application_secret>\",\n\"activeDirectoryEndpointUrl\": \"https://login.microsoftonline.com\",\n\"resourceManagerEndpointUrl\": \"https://management.azure.com/\",\n\"activeDirectoryGraphResourceId\": \"https://graph.windows.net/\",\n\"sqlManagementEndpointUrl\": \"https://management.core.windows.net:8443/\",\n\"galleryEndpointUrl\": \"https://gallery.azure.com/\",\n\"managementEndpointUrl\": \"https://management.core.windows.net/\"\n}\n

Store the path to the file in an environment variable called AZURE_AUTH_LOCATION and make sure that your experiment does NOT contain secrets section.

"},{"location":"drivers/azure/#subscription","title":"Subscription","text":"

Additionally you need to provide the Azure subscription id.

{\n\"configuration\": {\n\"azure_subscription_id\": \"your-azure-subscription-id\"\n}\n}\n

Configuration may be as well retrieved from an environment.

An old, but deprecated way of doing it was as follows, this still works but should not be favoured over the previous approaches as it\u2019s not the Chaos Toolkit way to pass structured configurations.

{\n\"configuration\": {\n\"azure\": {\n\"subscription_id\": \"your-azure-subscription-id\"\n}\n}\n}\n

Credential file described in the previous \u201cCredential\u201d section contains as well subscription id. If AZURE_AUTH_LOCATION is set and subscription id is NOT set in the experiment definition, extension will try to load it from the credential file.

"},{"location":"drivers/azure/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example for an experiment containing secrets and configuration:

{\n\"version\": \"1.0.0\",\n\"title\": \"...\",\n\"description\": \"...\",\n\"tags\": [\"azure\", \"kubernetes\", \"aks\", \"node\"],\n\"configuration\": {\n\"azure_subscription_id\": \"xxx\"\n},\n\"secrets\": {\n\"azure\": {\n\"client_id\": \"xxx\",\n\"client_secret\": \"xxx\",\n\"tenant_id\": \"xxx\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Services are all available and healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"consumer-service-must-still-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://some-url/\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"restart-node-at-random\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"restart_machines\",\n\"secrets\": [\"azure\"],\n\"config\": [\"azure_subscription_id\"]\n}\n}\n],\n\"rollbacks\": []\n}\n
"},{"location":"drivers/azure/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/azure/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/azure/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/azure/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/azure/#aks","title":"aks","text":""},{"location":"drivers/azure/#count_managed_clusters","title":"count_managed_clusters","text":"Type probe Module chaosazure.aks.probes Name count_managed_clusters Return integer

Return count of Azure managed cluster.

\u2013 filter : str Filter the managed cluster. If the filter is omitted all managed_clusters in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_managed_clusters(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-managed-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.probes\",\n\"func\": \"count_managed_clusters\"\n}\n}\n
name: count-managed-clusters\nprovider:\nfunc: count_managed_clusters\nmodule: chaosazure.aks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_managed_clusters","title":"delete_managed_clusters","text":"Type action Module chaosazure.aks.actions Name delete_managed_clusters Return None

Delete a managed cluster at random from a managed Azure Kubernetes Service.

Be aware: Deleting a managed cluster is an invasive action. You will not be able to recover the managed cluster once you deleted it.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def delete_managed_clusters(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"delete_managed_clusters\"\n}\n}\n
name: delete-managed-clusters\nprovider:\nfunc: delete_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_node","title":"delete_node","text":"Type action Module chaosazure.aks.actions Name delete_node Return None

Delete a node at random from a managed Azure Kubernetes Service.

Be aware: Deleting a node is an invasive action. You will not be able to recover the node once you deleted it.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def delete_node(filter: str = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"delete_node\"\n}\n}\n
name: delete-node\nprovider:\nfunc: delete_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_managed_clusters","title":"describe_managed_clusters","text":"Type probe Module chaosazure.aks.probes Name describe_managed_clusters Return None

Describe Azure managed cluster.

\u2013 filter : str Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_managed_clusters(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-managed-clusters\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.probes\",\n\"func\": \"describe_managed_clusters\"\n}\n}\n
name: describe-managed-clusters\nprovider:\nfunc: describe_managed_clusters\nmodule: chaosazure.aks.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_node","title":"restart_node","text":"Type action Module chaosazure.aks.actions Name restart_node Return None

Restart a node at random from a managed Azure Kubernetes Service.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def restart_node(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"restart_node\"\n}\n}\n
name: restart-node\nprovider:\nfunc: restart_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_managed_clusters","title":"start_managed_clusters","text":"Type action Module chaosazure.aks.actions Name start_managed_clusters Return None

Start managed cluster at random.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

start_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def start_managed_clusters(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"start_managed_clusters\"\n}\n}\n
name: start-managed-clusters\nprovider:\nfunc: start_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_managed_clusters","title":"stop_managed_clusters","text":"Type action Module chaosazure.aks.actions Name stop_managed_clusters Return None

Stop managed cluster at random.

\u2013 filter : str, optional Filter the managed cluster. If the filter is omitted all managed cluster in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all managed clusters from the group \u2018rg\u2019

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the managed cluster from the group \u2018rg\u2019 having the name \u2018name\u2019

stop_managed_cluster(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two managed clusters at random from the group \u2018rg\u2019

Signature:

def stop_managed_clusters(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-managed-clusters\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"stop_managed_clusters\"\n}\n}\n
name: stop-managed-clusters\nprovider:\nfunc: stop_managed_clusters\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_node","title":"stop_node","text":"Type action Module chaosazure.aks.actions Name stop_node Return None

Stop a node at random from a managed Azure Kubernetes Service.

\u2013 filter : str Filter the managed AKS. If the filter is omitted all AKS in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def stop_node(filter: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.aks.actions\",\n\"func\": \"stop_node\"\n}\n}\n
name: stop-node\nprovider:\nfunc: stop_node\nmodule: chaosazure.aks.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#application_gateway","title":"application_gateway","text":""},{"location":"drivers/azure/#count_application_gateways","title":"count_application_gateways","text":"Type probe Module chaosazure.application_gateway.probes Name count_application_gateways Return integer

Return count of Azure application gateways.

\u2013 filter : str Filter the application gateways. If the filter is omitted all application_gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_application_gateways(\n        filter: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-application-gateways\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"count_application_gateways\"\n}\n}\n
name: count-application-gateways\nprovider:\nfunc: count_application_gateways\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_application_gateways","title":"delete_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name delete_application_gateways Return None

Delete application gateways at random.

Be aware: Deleting an application gateway is an invasive action. You will not be able to recover the application gateway once you deleted it.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all application_gateways from the group \u2018rg\u2019

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two application_gateways at random from the group \u2018rg\u2019

Signature:

def delete_application_gateways(filter: str = None,\n                                configuration: Dict[str, Dict[str,\n                                                              str]] = None,\n                                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"delete_application_gateways\"\n}\n}\n
name: delete-application-gateways\nprovider:\nfunc: delete_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_routes","title":"delete_routes","text":"Type action Module chaosazure.application_gateway.actions Name delete_routes Return None

Delete routes at random. Be aware: Deleting a route is an invasive action. You will not be able to recover the route once you deleted it.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all routes of all application gateways in the subscription will be selected as potential chaos candidates. name_pattern : str, optional Filter the routes. If the filter is omitted all routes except the first in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_routes(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all route named \u2018chaos-\u2019 in all application gateways from the group \u2018rg\u2019 delete_routes(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all route named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

If all routes are deleted the first will be kept

Signature:

def delete_routes(filter: str = None,\n                  name_pattern: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-routes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"delete_routes\"\n}\n}\n
name: delete-routes\nprovider:\nfunc: delete_routes\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_application_gateways","title":"describe_application_gateways","text":"Type probe Module chaosazure.application_gateway.probes Name describe_application_gateways Return None

Describe Azure application gateways.

\u2013 filter : str Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_application_gateways(filter: str = None,\n                                  configuration: Dict[str, Dict[str,\n                                                                str]] = None,\n                                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-application-gateways\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"describe_application_gateways\"\n}\n}\n
name: describe-application-gateways\nprovider:\nfunc: describe_application_gateways\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_routes","title":"describe_routes","text":"Type probe Module chaosazure.application_gateway.probes Name describe_routes Return None

Describe Azure application gateways routes.

\u2013 filter : str Filter the application_gateways. If the filter is omitted all application gateways in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the routes. If the filter is omitted all routes in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_routes(filter: str = None,\n                    name_pattern: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-routes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.probes\",\n\"func\": \"describe_routes\"\n}\n}\n
name: describe-routes\nprovider:\nfunc: describe_routes\nmodule: chaosazure.application_gateway.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#start_application_gateways","title":"start_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name start_application_gateways Return None

Start application gateway at random.

\u2013 filter : str, optional Filter the application gateway. If the filter is omitted all application gateway in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all application gateways from the group \u2018rg\u2019

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

start_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two application gateways at random from the group \u2018rg\u2019

Signature:

def start_application_gateways(filter: str = None,\n                               configuration: Dict[str, Dict[str, str]] = None,\n                               secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"start_application_gateways\"\n}\n}\n
name: start-application-gateways\nprovider:\nfunc: start_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_application_gateways","title":"stop_application_gateways","text":"Type action Module chaosazure.application_gateway.actions Name stop_application_gateways Return None

Stop application gateways at random.

\u2013 filter : str, optional Filter the application gateways. If the filter is omitted all application gateways in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all application gateways from the group \u2018rg\u2019

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Stop the application gateway from the group \u2018rg\u2019 having the name \u2018name\u2019

stop_application_gateways(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Stop two application gateways at random from the group \u2018rg\u2019

Signature:

def stop_application_gateways(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-application-gateways\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.application_gateway.actions\",\n\"func\": \"stop_application_gateways\"\n}\n}\n
name: stop-application-gateways\nprovider:\nfunc: stop_application_gateways\nmodule: chaosazure.application_gateway.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#machine","title":"machine","text":""},{"location":"drivers/azure/#burn_io","title":"burn_io","text":"Type action Module chaosazure.machine.actions Name burn_io Return None

Increases the Disk I/O operations per second of the virtual machine.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional How long the burn lasts. Defaults to 60 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Increase the I/O operations per second of all machines from the group \u2018rg\u2019

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Increase the I/O operations per second of the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

burn_io(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Increase the I/O operations per second of two machines at random from the group \u2018rg\u2019

Signature:

def burn_io(filter: str = None,\n            duration: int = 60,\n            timeout: int = 60,\n            configuration: Dict[str, Dict[str, str]] = None,\n            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 60 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"burn-io\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"burn_io\"\n}\n}\n
name: burn-io\nprovider:\nfunc: burn_io\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#count_machines","title":"count_machines","text":"Type probe Module chaosazure.machine.probes Name count_machines Return integer

Return count of Azure virtual machines.

\u2013 filter : str Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_machines(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-machines\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.probes\",\n\"func\": \"count_machines\"\n}\n}\n
name: count-machines\nprovider:\nfunc: count_machines\nmodule: chaosazure.machine.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_machines","title":"delete_machines","text":"Type action Module chaosazure.machine.actions Name delete_machines Return None

Delete virtual machines at random.

Be aware: Deleting a machine is an invasive action. You will not be able to recover the machine once you deleted it.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all machines from the group \u2018rg\u2019

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two machines at random from the group \u2018rg\u2019

Signature:

def delete_machines(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"delete_machines\"\n}\n}\n
name: delete-machines\nprovider:\nfunc: delete_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_machines","title":"describe_machines","text":"Type probe Module chaosazure.machine.probes Name describe_machines Return None

Describe Azure virtual machines.

\u2013 filter : str Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_machines(filter: str = None,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-machines\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.probes\",\n\"func\": \"describe_machines\"\n}\n}\n
name: describe-machines\nprovider:\nfunc: describe_machines\nmodule: chaosazure.machine.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#fill_disk","title":"fill_disk","text":"Type action Module chaosazure.machine.actions Name fill_disk Return None

Fill the disk with random data.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional Lifetime of the file created. Defaults to 120 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed. Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds. size : int Size of the file created on the disk. Defaults to 1GB. path : str, optional The absolute path to write the fill file into. Defaults: C:/burn for Windows clients, /root/burn for Linux clients.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Fill all machines from the group \u2018rg\u2019

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Fill the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

fill_disk(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Fill two machines at random from the group \u2018rg\u2019

Signature:

def fill_disk(filter: str = None,\n              duration: int = 120,\n              timeout: int = 60,\n              size: int = 1000,\n              path: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No size integer 1000 No path string null No

Usage:

JSONYAML
{\n\"name\": \"fill-disk\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"fill_disk\"\n}\n}\n
name: fill-disk\nprovider:\nfunc: fill_disk\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#network_latency","title":"network_latency","text":"Type action Module chaosazure.machine.actions Name network_latency Return None

Increases the response time of the virtual machine.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional How long the latency lasts. Defaults to 60 seconds. timeout : int Additional wait time (in seconds) for filling operation to be completed Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds. delay : int Added delay in ms. Defaults to 200. jitter : int Variance of the delay in ms. Defaults to 50.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Increase the latency of all machines from the group \u2018rg\u2019

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Increase the latecy of the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

network_latency(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Increase the latency of two machines at random from the group \u2018rg\u2019

Signature:

def network_latency(filter: str = None,\n                    duration: int = 60,\n                    delay: int = 200,\n                    jitter: int = 50,\n                    timeout: int = 60,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 60 No delay integer 200 No jitter integer 50 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"network-latency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"network_latency\"\n}\n}\n
name: network-latency\nprovider:\nfunc: network_latency\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_machines","title":"restart_machines","text":"Type action Module chaosazure.machine.actions Name restart_machines Return None

Restart virtual machines at random.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all machines from the group \u2018rg\u2019

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two machines at random from the group \u2018rg\u2019

Signature:

def restart_machines(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"restart_machines\"\n}\n}\n
name: restart-machines\nprovider:\nfunc: restart_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_machines","title":"start_machines","text":"Type action Module chaosazure.machine.actions Name start_machines Return None

Start virtual machines at random. Thought as a rollback action.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all stopped machines from the group \u2018rg\u2019

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the stopped machine from the group \u2018rg\u2019 having the name \u2018name\u2019

start_machines(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two stopped machines at random from the group \u2018rg\u2019

Signature:

def start_machines(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"start_machines\"\n}\n}\n
name: start-machines\nprovider:\nfunc: start_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_machines","title":"stop_machines","text":"Type action Module chaosazure.machine.actions Name stop_machines Return None

Stop virtual machines at random.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_machines(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all machines from the group \u2018rg\u2019

stop_machines(\u201cwhere resourceGroup==\u2019mygroup\u2019 and name=\u2019myname\u2019\u201c, c, s) Stop the machine from the group \u2018mygroup\u2019 having the name \u2018myname\u2019

stop_machines(\u201cwhere resourceGroup==\u2019mygroup\u2019 | sample 2\u201d, c, s) Stop two machines at random from the group \u2018mygroup\u2019

Signature:

def stop_machines(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-machines\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"stop_machines\"\n}\n}\n
name: stop-machines\nprovider:\nfunc: stop_machines\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stress_cpu","title":"stress_cpu","text":"Type action Module chaosazure.machine.actions Name stress_cpu Return None

Stress CPU up to 100% at virtual machines.

\u2013 filter : str, optional Filter the virtual machines. If the filter is omitted all machines in the subscription will be selected as potential chaos candidates. duration : int, optional Duration of the stress test (in seconds) that generates high CPU usage. Defaults to 120 seconds. timeout : int Additional wait time (in seconds) for stress operation to be completed. Getting and sending data from/to Azure may take some time so it\u2019s not recommended to set this value to less than 30s. Defaults to 60 seconds.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, configuration=c, secrets=s) Stress all machines from the group \u2018rg\u2019

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, configuration=c, secrets=s) Stress the machine from the group \u2018rg\u2019 having the name \u2018name\u2019

stress_cpu(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, configuration=c, secrets=s) Stress two machines at random from the group \u2018rg\u2019

Signature:

def stress_cpu(filter: str = None,\n               duration: int = 120,\n               timeout: int = 60,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"stress-cpu\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.machine.actions\",\n\"func\": \"stress_cpu\"\n}\n}\n
name: stress-cpu\nprovider:\nfunc: stress_cpu\nmodule: chaosazure.machine.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#netapp","title":"netapp","text":""},{"location":"drivers/azure/#count_netapp_volumes","title":"count_netapp_volumes","text":"Type probe Module chaosazure.netapp.probes Name count_netapp_volumes Return integer

Return count of Azure netapp volumes.

\u2013 filter : str Filter the netapp volumes. If the filter is omitted all netapp_volumes in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_netapp_volumes(filter: str = None,\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-netapp-volumes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.probes\",\n\"func\": \"count_netapp_volumes\"\n}\n}\n
name: count-netapp-volumes\nprovider:\nfunc: count_netapp_volumes\nmodule: chaosazure.netapp.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_netapp_volumes","title":"delete_netapp_volumes","text":"Type action Module chaosazure.netapp.actions Name delete_netapp_volumes Return None

Delete netapp volumes at random.

Be aware: Deleting a netapp volume is a invasive action. You will not be able to recover the netapp volume once you deleted it.

\u2013 filter : str, optional Filter the netapp volumes. If the filter is omitted all netapp volumes in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all netapp volumes from the group \u2018rg\u2019

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the netapp volumes from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_netapp_volumes(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two netapp volumes at random from the group \u2018rg\u2019

Signature:

def delete_netapp_volumes(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-netapp-volumes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.actions\",\n\"func\": \"delete_netapp_volumes\"\n}\n}\n
name: delete-netapp-volumes\nprovider:\nfunc: delete_netapp_volumes\nmodule: chaosazure.netapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_netapp_volumes","title":"describe_netapp_volumes","text":"Type probe Module chaosazure.netapp.probes Name describe_netapp_volumes Return None

Describe Azure netapp volumes.

\u2013 filter : str Filter the netapp volumes. If the filter is omitted all netapp volumes in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_netapp_volumes(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-netapp-volumes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.netapp.probes\",\n\"func\": \"describe_netapp_volumes\"\n}\n}\n
name: describe-netapp-volumes\nprovider:\nfunc: describe_netapp_volumes\nmodule: chaosazure.netapp.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#postgresql","title":"postgresql","text":""},{"location":"drivers/azure/#count_servers","title":"count_servers","text":"Type probe Module chaosazure.postgresql.probes Name count_servers Return integer

Return count of Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"count_servers\"\n}\n}\n
name: count-servers\nprovider:\nfunc: count_servers\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#create_databases","title":"create_databases","text":"Type action Module chaosazure.postgresql.actions Name create_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name : str, required The name of the database to create.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 in all servers from the group \u2018rg\u2019

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def create_databases(filter: str = None,\n                     name: str = None,\n                     charset: str = None,\n                     collation: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name string null No charset string null No collation string null No

Usage:

JSONYAML
{\n\"name\": \"create-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"create_databases\"\n}\n}\n
name: create-databases\nprovider:\nfunc: create_databases\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_databases","title":"delete_databases","text":"Type action Module chaosazure.postgresql.actions Name delete_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name_pattern : str, optional Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all database named \u2018chaos-\u2019 in all servers from the group \u2018rg\u2019

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all database named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def delete_databases(filter: str = None,\n                     name_pattern: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"delete_databases\"\n}\n}\n
name: delete-databases\nprovider:\nfunc: delete_databases\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_servers","title":"delete_servers","text":"Type action Module chaosazure.postgresql.actions Name delete_servers Return None

Delete servers at random.

Be aware: Deleting a server is an invasive action. You will not be able to recover the server once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all servers from the group \u2018rg\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the server from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two servers at random from the group \u2018rg\u2019

Signature:

def delete_servers(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"delete_servers\"\n}\n}\n
name: delete-servers\nprovider:\nfunc: delete_servers\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_databases","title":"describe_databases","text":"Type probe Module chaosazure.postgresql.probes Name describe_databases Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_databases(filter: str = None,\n                       name_pattern: str = None,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-databases\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"describe_databases\"\n}\n}\n
name: describe-databases\nprovider:\nfunc: describe_databases\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_servers","title":"describe_servers","text":"Type probe Module chaosazure.postgresql.probes Name describe_servers Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_servers(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.probes\",\n\"func\": \"describe_servers\"\n}\n}\n
name: describe-servers\nprovider:\nfunc: describe_servers\nmodule: chaosazure.postgresql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_servers","title":"restart_servers","text":"Type action Module chaosazure.postgresql.actions Name restart_servers Return None

Restart servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all servers from the group \u2018rg\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the server from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two servers at random from the group \u2018rg\u2019

Signature:

def restart_servers(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql.actions\",\n\"func\": \"restart_servers\"\n}\n}\n
name: restart-servers\nprovider:\nfunc: restart_servers\nmodule: chaosazure.postgresql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#postgresql_flexible","title":"postgresql_flexible","text":""},{"location":"drivers/azure/#count_servers_1","title":"count_servers","text":"Type probe Module chaosazure.postgresql_flexible.probes Name count_servers Return integer

Return count of Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"count_servers\"\n}\n}\n
name: count-servers\nprovider:\nfunc: count_servers\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#create_databases_1","title":"create_databases","text":"Type action Module chaosazure.postgresql_flexible.actions Name create_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name : str, required The name of the database to create.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 in all servers from the group \u2018rg\u2019

create_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Creating database named \u2018chaos-test\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def create_databases(filter: str = None,\n                     name: str = None,\n                     charset: str = None,\n                     collation: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name string null No charset string null No collation string null No

Usage:

JSONYAML
{\n\"name\": \"create-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"create_databases\"\n}\n}\n
name: create-databases\nprovider:\nfunc: create_databases\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_databases_1","title":"delete_databases","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_databases Return None

Delete databases at random.

Be aware: Deleting a database is an invasive action. You will not be able to recover the database once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all databases of all servers in the subscription will be selected as potential chaos candidates.

name_pattern : str, optional Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u2018chaos-\u2019, c, s) Delete all database named \u2018chaos-\u2019 in all servers from the group \u2018rg\u2019

delete_databases(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, \u2018chaos-test\u2019, c, s) Delete all database named \u2018chaos-*\u2019 the server from the group \u2018rg\u2019 having the name \u2018name\u2019

Signature:

def delete_databases(filter: str = None,\n                     name_pattern: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"delete-databases\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_databases\"\n}\n}\n
name: delete-databases\nprovider:\nfunc: delete_databases\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_servers_1","title":"delete_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_servers Return None

Delete servers at random.

Be aware: Deleting a server is an invasive action. You will not be able to recover the server once you deleted it.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all servers from the group \u2018rg\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the server from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two servers at random from the group \u2018rg\u2019

Signature:

def delete_servers(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_servers\"\n}\n}\n
name: delete-servers\nprovider:\nfunc: delete_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_tables","title":"delete_tables","text":"Type action Module chaosazure.postgresql_flexible.actions Name delete_tables Return None

Delete a table randomly from all databases in servers matching the filter. Could be used to introduce random failures for resilience testing.

\u2013 filter : str, optional Filter the servers. If the filter is omitted, all servers in the subscription will be considered for potential table deletion. table_name : str, optional Specific table name to delete. If this is omitted, a table will be selected randomly for deletion. database_name : str, optional Specific database name to delete the table from. If this is omitted, a database will be selected randomly from the server for table deletion. configuration : Configuration, optional Azure configuration information. secrets : Secrets, optional Azure secret information for authentication. key_vault_url : str, optional The URL to the Azure Key Vault where the secrets are stored.

Here are some examples of calling delete_tables.

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cusers\u201d, \u201cmydatabase\u201d, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes the table \u2018users\u2019 from the database \u2018mydatabase\u2019 in all servers in the resource group \u2018rg\u2019

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, None, None, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes a random table from a random database in the server named \u2018name\u2019 in the resource group \u2018rg\u2019

delete_tables(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, \u201corders\u201d, \u201cmydatabase\u201d, c, s, \u201chttps://myvault.vault.azure.net/\u201d) Deletes the table \u2018orders\u2019 from the database \u2018mydatabase\u2019 in two random servers in the resource group \u2018rg\u2019

Signature:

def delete_tables(filter: str = None,\n                  table_name: str = None,\n                  database_name: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None,\n                  key_vault_url: str = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No table_name string null No database_name string null No key_vault_url string null No

Usage:

JSONYAML
{\n\"name\": \"delete-tables\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"delete_tables\"\n}\n}\n
name: delete-tables\nprovider:\nfunc: delete_tables\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_databases_1","title":"describe_databases","text":"Type probe Module chaosazure.postgresql_flexible.probes Name describe_databases Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 name_pattern : str Filter the databases. If the filter is omitted all databases in the server will be selected for the probe. Pattern example: \u2018app[0-9]{3}\u2019

Signature:

def describe_databases(filter: str = None,\n                       name_pattern: str = None,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No

Usage:

JSONYAML
{\n\"name\": \"describe-databases\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"describe_databases\"\n}\n}\n
name: describe-databases\nprovider:\nfunc: describe_databases\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#describe_servers_1","title":"describe_servers","text":"Type probe Module chaosazure.postgresql_flexible.probes Name describe_servers Return None

Describe Azure servers.

\u2013 filter : str Filter the servers. If the filter is omitted all servers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_servers(filter: str = None,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-servers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.probes\",\n\"func\": \"describe_servers\"\n}\n}\n
name: describe-servers\nprovider:\nfunc: describe_servers\nmodule: chaosazure.postgresql_flexible.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#restart_servers_1","title":"restart_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name restart_servers Return None

Restart servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Restart all servers from the group \u2018rg\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Restart the server from the group \u2018rg\u2019 having the name \u2018name\u2019

restart_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Restart two servers at random from the group \u2018rg\u2019

Signature:

def restart_servers(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"restart_servers\"\n}\n}\n
name: restart-servers\nprovider:\nfunc: restart_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_servers","title":"start_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name start_servers Return None

Start servers at random. Thought as a rollback action.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Start all stopped servers from the group \u2018rg\u2019

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Start the stopped server from the group \u2018rg\u2019 having the name \u2018name\u2019

start_servers(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Start two stopped servers at random from the group \u2018rg\u2019

Signature:

def start_servers(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"start_servers\"\n}\n}\n
name: start-servers\nprovider:\nfunc: start_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_servers","title":"stop_servers","text":"Type action Module chaosazure.postgresql_flexible.actions Name stop_servers Return None

Stop servers at random.

\u2013 filter : str, optional Filter the servers. If the filter is omitted all servers in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

stop_servers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Stop all servers from the group \u2018rg\u2019

stop_servers(\u201cwhere resourceGroup==\u2019mygroup\u2019 and name=\u2019myname\u2019\u201c, c, s) Stop the server from the group \u2018mygroup\u2019 having the name \u2018myname\u2019

stop_servers(\u201cwhere resourceGroup==\u2019mygroup\u2019 | sample 2\u201d, c, s) Stop two servers at random from the group \u2018mygroup\u2019

Signature:

def stop_servers(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-servers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.postgresql_flexible.actions\",\n\"func\": \"stop_servers\"\n}\n}\n
name: stop-servers\nprovider:\nfunc: stop_servers\nmodule: chaosazure.postgresql_flexible.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#storage","title":"storage","text":""},{"location":"drivers/azure/#count_blob_containers","title":"count_blob_containers","text":"Type probe Module chaosazure.storage.probes Name count_blob_containers Return integer

Return count of Azure Blob Containers in filtered Storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all blob containers in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_blob_containers(filter: str = None,\n                          configuration: Dict[str, Dict[str, str]] = None,\n                          secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-blob-containers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"count_blob_containers\"\n}\n}\n
name: count-blob-containers\nprovider:\nfunc: count_blob_containers\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#count_storage_accounts","title":"count_storage_accounts","text":"Type probe Module chaosazure.storage.probes Name count_storage_accounts Return integer

Return count of Azure storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all storage_accounts in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_storage_accounts(filter: str = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-storage-accounts\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"count_storage_accounts\"\n}\n}\n
name: count-storage-accounts\nprovider:\nfunc: count_storage_accounts\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#delete_blob_containers","title":"delete_blob_containers","text":"Type action Module chaosazure.storage.actions Name delete_blob_containers Return None

Delete blob containers at random.

Be aware: Deleting a blob container is a invasive action. You will not be able to recover the blob container once you deleted it.

\u2013 filter : str, optional Filter the storage account. If the filter is omitted all storage accounts in the subscription will have their blob containers selected as potential chaos candidates. name_pattern : str, optional Filter the blob containers. If the filter is omitted all blob containers will be selected for the probe. Pattern example: \u2018container[0-9]{3}\u2019 number : int, optional Pick the number of blob containers matching the two filters that will be deleted. If the number is omitted all blob containers in the list will be deleted.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all blob containers from the group \u2018rg\u2019

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the blob containers from the group \u2018rg\u2019 under the storage account named \u2018name\u2019

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cchaos-\u201d, c, s) Delete the blob containers from the group \u2018rg\u2019 matching the \u201cchaos-\u201d pattern

delete_blob_containers(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, \u201cchaos-\u201d, 3, c, s) Delete 3 blob containers at random from the group \u2018rg\u2019 matching the \u201cchaos-\u201d pattern

Signature:

def delete_blob_containers(filter: str = None,\n                           name_pattern: str = None,\n                           number: int = None,\n                           configuration: Dict[str, Dict[str, str]] = None,\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No name_pattern string null No number integer null No

Usage:

JSONYAML
{\n\"name\": \"delete-blob-containers\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.actions\",\n\"func\": \"delete_blob_containers\"\n}\n}\n
name: delete-blob-containers\nprovider:\nfunc: delete_blob_containers\nmodule: chaosazure.storage.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_storage_accounts","title":"delete_storage_accounts","text":"Type action Module chaosazure.storage.actions Name delete_storage_accounts Return None

Delete storage accounts at random.

Be aware: Deleting a storage account is a invasive action. You will not be able to recover the storage account once you deleted it.

\u2013 filter : str, optional Filter the storage accounts. If the filter is omitted all storage accounts in the subscription will be selected as potential chaos candidates.

Some calling examples. Deep dive into the filter syntax: https://docs.microsoft.com/en-us/azure/kusto/query/

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019\u201c, c, s) Delete all storage accounts from the group \u2018rg\u2019

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019 and name=\u2019name\u2019\u201c, c, s) Delete the storage accounts from the group \u2018rg\u2019 having the name \u2018name\u2019

delete_storage_accounts(\u201cwhere resourceGroup==\u2019rg\u2019 | sample 2\u201d, c, s) Delete two storage accounts at random from the group \u2018rg\u2019

Signature:

def delete_storage_accounts(filter: str = None,\n                            configuration: Dict[str, Dict[str, str]] = None,\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-storage-accounts\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.actions\",\n\"func\": \"delete_storage_accounts\"\n}\n}\n
name: delete-storage-accounts\nprovider:\nfunc: delete_storage_accounts\nmodule: chaosazure.storage.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#describe_storage_accounts","title":"describe_storage_accounts","text":"Type probe Module chaosazure.storage.probes Name describe_storage_accounts Return None

Describe Azure storage account.

\u2013 filter : str Filter the storage account. If the filter is omitted all storage account in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def describe_storage_accounts(filter: str = None,\n                              configuration: Dict[str, Dict[str, str]] = None,\n                              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"describe-storage-accounts\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.storage.probes\",\n\"func\": \"describe_storage_accounts\"\n}\n}\n
name: describe-storage-accounts\nprovider:\nfunc: describe_storage_accounts\nmodule: chaosazure.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#vmss","title":"vmss","text":""},{"location":"drivers/azure/#burn_io_1","title":"burn_io","text":"Type action Module chaosazure.vmss.actions Name burn_io Return None

Increases the Disk I/O operations per second of the VMSS machine. Similar to the burn_io action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 60 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"burn-io\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"burn_io\"\n}\n}\n
name: burn-io\nprovider:\nfunc: burn_io\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#count_instances","title":"count_instances","text":"Type probe Module chaosazure.vmss.probes Name count_instances Return integer

Return count of VMSS instances.

\u2013 filter : str Filter the VMSS instance. If the filter is omitted all machines in the subscription will be selected for the probe. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def count_instances(filter: str = None,\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"count-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.probes\",\n\"func\": \"count_instances\"\n}\n}\n
name: count-instances\nprovider:\nfunc: count_instances\nmodule: chaosazure.vmss.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/azure/#deallocate_vmss","title":"deallocate_vmss","text":"Type action Module chaosazure.vmss.actions Name deallocate_vmss Return None

Deallocate a virtual machine scale set instance at random.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"deallocate-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"deallocate_vmss\"\n}\n}\n
name: deallocate-vmss\nprovider:\nfunc: deallocate_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#delete_vmss","title":"delete_vmss","text":"Type action Module chaosazure.vmss.actions Name delete_vmss Return None

Delete a virtual machine scale set instance at random.

Be aware: Deleting a VMSS instance is an invasive action. You will not be able to recover the VMSS instance once you deleted it.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"delete-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"delete_vmss\"\n}\n}\n
name: delete-vmss\nprovider:\nfunc: delete_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#fill_disk_1","title":"fill_disk","text":"Type action Module chaosazure.vmss.actions Name fill_disk Return None

Fill the VMSS machine disk with random data. Similar to the fill_disk action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No size integer 1000 No path string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"fill-disk\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"fill_disk\"\n}\n}\n
name: fill-disk\nprovider:\nfunc: fill_disk\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#network_latency_1","title":"network_latency","text":"Type action Module chaosazure.vmss.actions Name network_latency Return None

Increases the response time of the virtual machine. Similar to the network_latency action of the machine.actions module.

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 60 No delay integer 200 No jitter integer 50 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"network-latency\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"network_latency\"\n}\n}\n
name: network-latency\nprovider:\nfunc: network_latency\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_vmss","title":"restart_vmss","text":"Type action Module chaosazure.vmss.actions Name restart_vmss Return None

Restart a virtual machine scale set instance at random.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"restart-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"restart_vmss\"\n}\n}\n
name: restart-vmss\nprovider:\nfunc: restart_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_vmss","title":"stop_vmss","text":"Type action Module chaosazure.vmss.actions Name stop_vmss Return None

Stops instances from the filtered scale set either at random or by a defined instance criteria.

\u2013 filter : str Filter the virtual machine scale set. If the filter is omitted all virtual machine scale sets in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019 instance_criteria : Iterable[Mapping[str, any]] Allows specification of criteria for selection of a given virtual machine scale set instance. If the instance_criteria is omitted, an instance will be chosen at random. All of the criteria within each item of the Iterable must match, i.e. AND logic is applied. The first item with all matching criterion will be used to select the instance. Criteria example: [ {\u201cname\u201d: \u201cmyVMSSInstance1\u201d}, { \u201cname\u201d: \u201cmyVMSSInstance2\u201d, \u201cinstanceId\u201d: \u201c2\u201d } {\u201cinstanceId\u201d: \u201c3\u201d}, ] If the instances include two items. One with name = myVMSSInstance4 and instanceId = 2. The other with name = myVMSSInstance2 and instanceId = 3. The criteria {\u201cinstanceId\u201d: \u201c3\u201d} will be the first match since both the name and the instanceId did not match on the first criteria.

Signature:

Arguments:

Name Type Default Required filter string null No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"stop-vmss\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"stop_vmss\"\n}\n}\n
name: stop-vmss\nprovider:\nfunc: stop_vmss\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stress_vmss_instance_cpu","title":"stress_vmss_instance_cpu","text":"Type action Module chaosazure.vmss.actions Name stress_vmss_instance_cpu Return None

Signature:

Arguments:

Name Type Default Required filter string null No duration integer 120 No timeout integer 60 No instance_criteria object null No

Usage:

JSONYAML
{\n\"name\": \"stress-vmss-instance-cpu\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.vmss.actions\",\n\"func\": \"stress_vmss_instance_cpu\"\n}\n}\n
name: stress-vmss-instance-cpu\nprovider:\nfunc: stress_vmss_instance_cpu\nmodule: chaosazure.vmss.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#webapp","title":"webapp","text":""},{"location":"drivers/azure/#delete_webapp","title":"delete_webapp","text":"Type action Module chaosazure.webapp.actions Name delete_webapp Return None

Delete a web app at random.

***Be aware**: Deleting a web app is an invasive action. You will not be able to recover the web app once you deleted it.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def delete_webapp(filter: str = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"delete-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"delete_webapp\"\n}\n}\n
name: delete-webapp\nprovider:\nfunc: delete_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#restart_webapp","title":"restart_webapp","text":"Type action Module chaosazure.webapp.actions Name restart_webapp Return None

Restart a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def restart_webapp(filter: str = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"restart-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"restart_webapp\"\n}\n}\n
name: restart-webapp\nprovider:\nfunc: restart_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#start_webapp","title":"start_webapp","text":"Type action Module chaosazure.webapp.actions Name start_webapp Return None

Start a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def start_webapp(filter: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"start-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"start_webapp\"\n}\n}\n
name: start-webapp\nprovider:\nfunc: start_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/azure/#stop_webapp","title":"stop_webapp","text":"Type action Module chaosazure.webapp.actions Name stop_webapp Return None

Stop a web app at random.

\u2013 filter : str Filter the web apps. If the filter is omitted all web apps in the subscription will be selected as potential chaos candidates. Filtering example: \u2018where resourceGroup==\u201dmyresourcegroup\u201d and name=\u201dmyresourcename\u201d\u2019

Signature:

def stop_webapp(filter: str = None,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required filter string null No

Usage:

JSONYAML
{\n\"name\": \"stop-webapp\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosazure.webapp.actions\",\n\"func\": \"stop_webapp\"\n}\n}\n
name: stop-webapp\nprovider:\nfunc: stop_webapp\nmodule: chaosazure.webapp.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/","title":"Extension chaoscf","text":"Version 0.7.3 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-cloud-foundry

This extension package provides probes and actions for Chaos Engineering experiments against a Cloud Foundry instance using the Chaos Toolkit.

"},{"location":"drivers/cloudfoundry/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-cloud-foundry\n
"},{"location":"drivers/cloudfoundry/#usage","title":"Usage","text":"

To use the probes and actions from this package, add a similar payload to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"terminate-random-instance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"terminate_some_random_instance\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-app-statistics\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/cloudfoundry/#discovery","title":"Discovery","text":"

You may use the Chaos Toolkit to discover the capabilities of this extension:

$ chaos discover chaostoolkit-cloud-foundry --no-install\n

If you have logged in against a Cloud Foundry environment, this will discover information about it along the way.

"},{"location":"drivers/cloudfoundry/#configuration","title":"Configuration","text":"

This extension to the Chaos Toolkit need credentials to a Cloud Foundry account with appropriate scopes. Please add the following sections to your experiment file:

{\n\"configuration\": {\n\"cf_api_url\": \"https://api.local.pcfdev.io\",\n\"cf_verify_ssl\": false\n},\n\"secrets\": {\n\"cloudfoundry\": {\n\"cf_username\": \"user\",\n\"cf_password\": \"pass\"\n}\n}\n}\n

You may leave \"cf_verifiy_ssl\" out of the configuration when you want to verify TLS certificates. Usually, local environments are self-signed so it may be useful to disable that check in that case.

You may also specify the \"cf_client_id\" and \"cf_client_secret\" secrets when you need. Their default values are \"cf\" and \"\" respectively. These work well against a local PCF dev install.

Then in your probe or action:

{\n\"type\": \"probe\",\n\"name\": \"fetch-app-statistics\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"cloudfoundry\"],\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"name\": \"my-app\",\n\"org_name\": \"my-org\",\n\"space_name\": \"my-space\"\n}\n}\n}\n
"},{"location":"drivers/cloudfoundry/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pip install -r requirements-dev.txt\n$ pytest\n
"},{"location":"drivers/cloudfoundry/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit project requires all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/cloudfoundry/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/cloudfoundry/#test_1","title":"Test","text":"

To run the tests for the project execute the following:

$ python setup.py test\n
"},{"location":"drivers/cloudfoundry/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/cloudfoundry/#actions","title":"actions","text":""},{"location":"drivers/cloudfoundry/#delete_app","title":"delete_app","text":"Type action Module chaoscf.actions Name delete_app Return None

Delete application.

See https://apidocs.cloudfoundry.org/280/apps/delete_a_particular_app.html

Signature:

def delete_app(app_name: str,\n               configuration: Dict[str, Dict[str, str]],\n               secrets: Dict[str, Dict[str, str]],\n               org_name: str = None,\n               space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"delete-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"delete_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: delete-app\nprovider:\narguments:\napp_name: ''\nfunc: delete_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#map_route_to_app","title":"map_route_to_app","text":"Type action Module chaoscf.actions Name map_route_to_app Return list

Map a specific route to a given application.

As Domains are deprecated in the Cloud Foundry API, they are not specified here. See https://apidocs.cloudfoundry.org/280/#domains--deprecated- See https://www.cloudfoundry.org/blog/coming-changes-app-manifest-simplification/

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def map_route_to_app(app_name: str,\n                     host_name: str,\n                     configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]],\n                     org_name: str = None,\n                     space_name: str = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes host_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"map-route-to-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"map_route_to_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"host_name\": \"\"\n}\n}\n}\n
name: map-route-to-app\nprovider:\narguments:\napp_name: ''\nhost_name: ''\nfunc: map_route_to_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#remove_routes_from_app","title":"remove_routes_from_app","text":"Type action Module chaoscf.actions Name remove_routes_from_app Return None

Remove routes from a given application.

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def remove_routes_from_app(app_name: str,\n                           route_host: str,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           org_name: str = None,\n                           space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes route_host string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"remove-routes-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"remove_routes_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"route_host\": \"\"\n}\n}\n}\n
name: remove-routes-from-app\nprovider:\narguments:\napp_name: ''\nroute_host: ''\nfunc: remove_routes_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#start_all_apps","title":"start_all_apps","text":"Type action Module chaoscf.actions Name start_all_apps Return None

Start all applications for the specified org name

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def start_all_apps(org_name: str, configuration: Dict[str, Dict[str, str]],\n                   secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"start-all-apps\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"start_all_apps\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: start-all-apps\nprovider:\narguments:\norg_name: ''\nfunc: start_all_apps\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#start_app","title":"start_app","text":"Type action Module chaoscf.actions Name start_app Return None

Start application

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def start_app(app_name: str,\n              configuration: Dict[str, Dict[str, str]],\n              secrets: Dict[str, Dict[str, str]],\n              org_name: str = None,\n              space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"start-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"start_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: start-app\nprovider:\narguments:\napp_name: ''\nfunc: start_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#stop_all_apps","title":"stop_all_apps","text":"Type action Module chaoscf.actions Name stop_all_apps Return None

Stop all application for the specified org name

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def stop_all_apps(org_name: str, configuration: Dict[str, Dict[str, str]],\n                  secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"stop-all-apps\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"stop_all_apps\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: stop-all-apps\nprovider:\narguments:\norg_name: ''\nfunc: stop_all_apps\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#stop_app","title":"stop_app","text":"Type action Module chaoscf.actions Name stop_app Return None

Stop application

See https://apidocs.cloudfoundry.org/280/apps/updating_an_app.html

Signature:

def stop_app(app_name: str,\n             configuration: Dict[str, Dict[str, str]],\n             secrets: Dict[str, Dict[str, str]],\n             org_name: str = None,\n             space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"stop-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"stop_app\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: stop-app\nprovider:\narguments:\napp_name: ''\nfunc: stop_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#terminate_app_instance","title":"terminate_app_instance","text":"Type action Module chaoscf.actions Name terminate_app_instance Return None

Terminate the application\u2019s instance at the given index.

See https://apidocs.cloudfoundry.org/280/apps/terminate_the_running_app_instance_at_the_given_index.html

Signature:

def terminate_app_instance(app_name: str,\n                           instance_index: int,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           org_name: str = None,\n                           space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes instance_index integer Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-app-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"terminate_app_instance\",\n\"arguments\": {\n\"app_name\": \"\",\n\"instance_index\": 0\n}\n}\n}\n
name: terminate-app-instance\nprovider:\narguments:\napp_name: ''\ninstance_index: 0\nfunc: terminate_app_instance\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#terminate_some_random_instance","title":"terminate_some_random_instance","text":"Type action Module chaoscf.actions Name terminate_some_random_instance Return None

Terminate a random application\u2019s instance.

See https://apidocs.cloudfoundry.org/280/apps/terminate_the_running_app_instance_at_the_given_index.html

Signature:

def terminate_some_random_instance(app_name: str,\n                                   configuration: Dict[str, Dict[str, str]],\n                                   secrets: Dict[str, Dict[str, str]],\n                                   org_name: str = None,\n                                   space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"terminate-some-random-instance\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"terminate_some_random_instance\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: terminate-some-random-instance\nprovider:\narguments:\napp_name: ''\nfunc: terminate_some_random_instance\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#unbind_service_from_app","title":"unbind_service_from_app","text":"Type action Module chaoscf.actions Name unbind_service_from_app Return None

Unbind the service from the given application.

See https://apidocs.cloudfoundry.org/280/service_bindings/delete_a_particular_service_binding.html

Signature:

def unbind_service_from_app(app_name: str,\n                            bind_name: str,\n                            configuration: Dict[str, Dict[str, str]],\n                            secrets: Dict[str, Dict[str, str]],\n                            org_name: str = None,\n                            space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes bind_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"unbind-service-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"unbind_service_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"bind_name\": \"\"\n}\n}\n}\n
name: unbind-service-from-app\nprovider:\narguments:\napp_name: ''\nbind_name: ''\nfunc: unbind_service_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#unmap_route_from_app","title":"unmap_route_from_app","text":"Type action Module chaoscf.actions Name unmap_route_from_app Return None

Unmap a specific route from a given application.

As Domains are deprecated in the Cloud Foundry API, they are not specified here. See https://apidocs.cloudfoundry.org/280/#domains--deprecated- See https://www.cloudfoundry.org/blog/coming-changes-app-manifest-simplification/

See https://apidocs.cloudfoundry.org/280/apps/remove_route_from_the_app.html

Signature:

def unmap_route_from_app(app_name: str,\n                         host_name: str,\n                         configuration: Dict[str, Dict[str, str]],\n                         secrets: Dict[str, Dict[str, str]],\n                         org_name: str = None,\n                         space_name: str = None):\n    pass\n

Arguments:

Name Type Default Required app_name string Yes host_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"unmap-route-from-app\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.actions\",\n\"func\": \"unmap_route_from_app\",\n\"arguments\": {\n\"app_name\": \"\",\n\"host_name\": \"\"\n}\n}\n}\n
name: unmap-route-from-app\nprovider:\narguments:\napp_name: ''\nhost_name: ''\nfunc: unmap_route_from_app\nmodule: chaoscf.actions\ntype: python\ntype: action\n
"},{"location":"drivers/cloudfoundry/#api","title":"api","text":""},{"location":"drivers/cloudfoundry/#call_api","title":"call_api","text":"Type Module chaoscf.api Name call_api Return requests.models.Response

Perform a Cloud Foundry API call and return the full response to the caller.

Signature:

def call_api(path: str,\n             configuration: Dict[str, Dict[str, str]],\n             secrets: Dict[str, Dict[str, str]],\n             query: Dict[str, Any] = None,\n             body: Dict[str, Any] = None,\n             method: str = 'GET',\n             headers: Dict[str, str] = None) -> requests.models.Response:\n    pass\n

Arguments:

Name Type Default Required path string Yes query mapping null No body mapping null No method string \u201cGET\u201d No headers mapping null No

Usage:

JSONYAML
{\n\"name\": \"call-api\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"call_api\",\n\"arguments\": {\n\"path\": \"\"\n}\n}\n}\n
name: call-api\nprovider:\narguments:\npath: ''\nfunc: call_api\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_by_name","title":"get_app_by_name","text":"Type Module chaoscf.api Name get_app_by_name Return mapping

Get the application with the given name.

You may restrict the search by organization and/or space by providing the various according parameters. When passing the names, the function performs a lookup for each of them to fetch their GUID.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html

Signature:

def get_app_by_name(app_name: str,\n                    configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]],\n                    space_name: str = None,\n                    space_guid: str = None,\n                    org_name: str = None,\n                    org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_by_name\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-by-name\nprovider:\narguments:\napp_name: ''\nfunc: get_app_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_instances","title":"get_app_instances","text":"Type Module chaoscf.api Name get_app_instances Return mapping

Get all the instances of a started application.

See https://apidocs.cloudfoundry.org/280/apps/get_the_instance_information_for_a_started_app.html

Signature:

def get_app_instances(app_name: str,\n                      configuration: Dict[str, Dict[str, str]],\n                      secrets: Dict[str, Dict[str, str]],\n                      space_name: str = None,\n                      space_guid: str = None,\n                      org_name: str = None,\n                      org_guid: str = None) -> Dict[str, Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-instances\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_instances\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-instances\nprovider:\narguments:\napp_name: ''\nfunc: get_app_instances\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_app_routes_by_host","title":"get_app_routes_by_host","text":"Type Module chaoscf.api Name get_app_routes_by_host Return list

Get all routes associated with the provided app and the given host.

See https://apidocs.cloudfoundry.org/280/routes/list_all_routes.html

Signature:

def get_app_routes_by_host(app_name: str,\n                           route_host: str,\n                           configuration: Dict[str, Dict[str, str]],\n                           secrets: Dict[str, Dict[str, str]],\n                           space_name: str = None,\n                           space_guid: str = None,\n                           org_name: str = None,\n                           org_guid: str = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes route_host string Yes space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-routes-by-host\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_app_routes_by_host\",\n\"arguments\": {\n\"app_name\": \"\",\n\"route_host\": \"\"\n}\n}\n}\n
name: get-app-routes-by-host\nprovider:\narguments:\napp_name: ''\nroute_host: ''\nfunc: get_app_routes_by_host\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_apps_for_org","title":"get_apps_for_org","text":"Type Module chaoscf.api Name get_apps_for_org Return None

List all applications available in the specified CF org name.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html to understand the content of the response.

Signature:

def get_apps_for_org(org_name: str, configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]]):\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-apps-for-org\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_apps_for_org\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: get-apps-for-org\nprovider:\narguments:\norg_name: ''\nfunc: get_apps_for_org\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_bind_by_name","title":"get_bind_by_name","text":"Type Module chaoscf.api Name get_bind_by_name Return mapping

Get the service bind with the given name.

You may restrict the search by organization and/or space by providing the various according parameters. When passing the names, the function performs a lookup for each of them to fetch their GUID.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html

Signature:

def get_bind_by_name(bind_name: str,\n                     configuration: Dict[str, Dict[str, str]],\n                     secrets: Dict[str, Dict[str, str]],\n                     app_name: str = None,\n                     space_name: str = None,\n                     space_guid: str = None,\n                     org_name: str = None,\n                     org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required bind_name string Yes app_name string null No space_name string null No space_guid string null No org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-bind-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_bind_by_name\",\n\"arguments\": {\n\"bind_name\": \"\"\n}\n}\n}\n
name: get-bind-by-name\nprovider:\narguments:\nbind_name: ''\nfunc: get_bind_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_org_by_name","title":"get_org_by_name","text":"Type Module chaoscf.api Name get_org_by_name Return mapping

Get the organization with the given name.

Signature:

def get_org_by_name(org_name: str, configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]]) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required org_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-org-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_org_by_name\",\n\"arguments\": {\n\"org_name\": \"\"\n}\n}\n}\n
name: get-org-by-name\nprovider:\narguments:\norg_name: ''\nfunc: get_org_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_routes_by_host","title":"get_routes_by_host","text":"Type Module chaoscf.api Name get_routes_by_host Return mapping

Get all routes with given host.

See https://apidocs.cloudfoundry.org/280/routes/list_all_routes.html

Signature:

def get_routes_by_host(route_host: str,\n                       configuration: Dict[str, Dict[str, str]],\n                       secrets: Dict[str, Dict[str, str]],\n                       org_name: str = None,\n                       org_guid: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required route_host string Yes org_name string null No org_guid string null No

Usage:

JSONYAML
{\n\"name\": \"get-routes-by-host\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_routes_by_host\",\n\"arguments\": {\n\"route_host\": \"\"\n}\n}\n}\n
name: get-routes-by-host\nprovider:\narguments:\nroute_host: ''\nfunc: get_routes_by_host\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#get_space_by_name","title":"get_space_by_name","text":"Type Module chaoscf.api Name get_space_by_name Return mapping

Get the space with the given name.

You may restrict the search by organization by providing the various according parameters. When passing the name, the function performs a lookup for the org to fetch its GUID.

Signature:

def get_space_by_name(space_name: str,\n                      configuration: Dict[str, Dict[str, str]],\n                      secrets: Dict[str, Dict[str, str]],\n                      org_name: str = None,\n                      org_guid=None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required space_name string Yes org_name string null No org_guid null No

Usage:

JSONYAML
{\n\"name\": \"get-space-by-name\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.api\",\n\"func\": \"get_space_by_name\",\n\"arguments\": {\n\"space_name\": \"\"\n}\n}\n}\n
name: get-space-by-name\nprovider:\narguments:\nspace_name: ''\nfunc: get_space_by_name\nmodule: chaoscf.api\ntype: python\ntype: ''\n
"},{"location":"drivers/cloudfoundry/#probes","title":"probes","text":""},{"location":"drivers/cloudfoundry/#get_app_stats","title":"get_app_stats","text":"Type probe Module chaoscf.probes Name get_app_stats Return mapping

Fetch the metrics of the given application.

See https://apidocs.cloudfoundry.org/280/apps/get_detailed_stats_for_a_started_app.html for more information.

Signature:

def get_app_stats(app_name: str,\n                  configuration: Dict[str, Dict[str, str]],\n                  secrets: Dict[str, Dict[str, str]],\n                  org_name: str = None,\n                  space_name: str = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required app_name string Yes org_name string null No space_name string null No

Usage:

JSONYAML
{\n\"name\": \"get-app-stats\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"get_app_stats\",\n\"arguments\": {\n\"app_name\": \"\"\n}\n}\n}\n
name: get-app-stats\nprovider:\narguments:\napp_name: ''\nfunc: get_app_stats\nmodule: chaoscf.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/cloudfoundry/#list_apps","title":"list_apps","text":"Type probe Module chaoscf.probes Name list_apps Return mapping

List all applications available to the authorized user.

See https://apidocs.cloudfoundry.org/280/apps/list_all_apps.html to understand the content of the response.

Signature:

def list_apps(configuration: Dict[str, Dict[str, str]],\n              secrets: Dict[str, Dict[str, str]]) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-apps\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoscf.probes\",\n\"func\": \"list_apps\"\n}\n}\n
name: list-apps\nprovider:\nfunc: list_apps\nmodule: chaoscf.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/","title":"Extension chaosdatadog","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-datadog

This project contains Chaos Toolkit activities and tolerances to work with DataDog.

"},{"location":"drivers/datadog/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-datadog\n
"},{"location":"drivers/datadog/#usage","title":"Usage","text":"

A typical experiment using this extension would look like this:

{\n\"version\": \"1.0.0\",\n\"title\": \"Run a, experiment using a DataDog SLO to verify our system\",\n\"description\": \"n/a\",\n\"configuration\": {\n\"datadog_host\": \"https://datadoghq.eu\"\n},\n\"steady-state-hypothesis\": {\n\"title\": \"n/a\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"read-slo\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"check-slo\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.tolerances\",\n\"func\": \"slo_must_be_met\",\n\"arguments\": {\n\"threshold\": \"7d\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo\",\n\"arguments\": {\n\"slo_id\": \"...\"\n}\n}\n}\n]\n},\n\"method\": []\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/datadog/#configuration","title":"Configuration","text":"

In the configuration block you may want to specify the DataDog host you are targetting:

    \"configuration\": {\n\"datadog_host\": \"https://datadoghq.eu\"\n},\n

The authentication can be set using the typical DataDog environment variables, notably:

"},{"location":"drivers/datadog/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/datadog/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/datadog/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/datadog/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/datadog/#metrics","title":"metrics","text":""},{"location":"drivers/datadog/#get_metrics_state","title":"get_metrics_state","text":"Type probe Module chaosdatadog.metrics.probes Name get_metrics_state Return boolean

The next function is to:

you can use a comparison to check if all data points in the query satisfy the steady state condition

Ex. cumsum(sum:istio.mesh.request.count.total{kube_service:test, response_code:500}.as_count())

the above query is a cumulative sum of all requests with response code of 500. if you want your request in a window of time you have a deviant hypothesis if you have more than 30 http_500 errors the comparison should be <. so any value below 30 is a steady state.

the allowed comparison values are [\u201c>\u201d, \u201c<\u201d, \u201c>=\u201d, \u201c<=\u201d, \u201c==\u201d]

Signature:

def get_metrics_state(query: str,\n                      comparison: str,\n                      threshold: float,\n                      minutes_before: int,\n                      configuration: Dict[str, Dict[str, str]] = None,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required query string Yes comparison string Yes threshold number Yes minutes_before integer Yes

Usage:

JSONYAML
{\n\"name\": \"get-metrics-state\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.metrics.probes\",\n\"func\": \"get_metrics_state\",\n\"arguments\": {\n\"query\": \"\",\n\"comparison\": \"\",\n\"threshold\": null,\n\"minutes_before\": 0\n}\n}\n}\n
name: get-metrics-state\nprovider:\narguments:\ncomparison: ''\nminutes_before: 0\nquery: ''\nthreshold: null\nfunc: get_metrics_state\nmodule: chaosdatadog.metrics.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#slo","title":"slo","text":""},{"location":"drivers/datadog/#get_slo","title":"get_slo","text":"Type probe Module chaosdatadog.slo.probes Name get_slo Return mapping

Get a SLO\u2019s history for the given period.

Periods should be given relative to each other. If end_period isn\u2019t provided it will resolve to now (UTC). start_period is always relative to end_period. You can use a format such as: \"X minutes ago\" for both.

Please visit https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-history for more information on the response payload, which is returned as a dictionary.

Signature:

def get_slo(slo_id: str,\n            start_period: str = '2 minutes ago',\n            end_period: str = None,\n            configuration: Dict[str, Dict[str, str]] = None,\n            secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required slo_id string Yes start_period string \u201c2 minutes ago\u201d No end_period string null No

Usage:

JSONYAML
{\n\"name\": \"get-slo\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo\",\n\"arguments\": {\n\"slo_id\": \"\"\n}\n}\n}\n
name: get-slo\nprovider:\narguments:\nslo_id: ''\nfunc: get_slo\nmodule: chaosdatadog.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#get_slo_details","title":"get_slo_details","text":"Type probe Module chaosdatadog.slo.probes Name get_slo_details Return mapping

Get a SLO\u2019s details.

Please visit https://docs.datadoghq.com/api/latest/service-level-objectives/#get-an-slos-details for more information on the response payload, which is returned as a dictionary.

Signature:

def get_slo_details(\n        slo_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required slo_id string Yes

Usage:

JSONYAML
{\n\"name\": \"get-slo-details\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.probes\",\n\"func\": \"get_slo_details\",\n\"arguments\": {\n\"slo_id\": \"\"\n}\n}\n}\n
name: get-slo-details\nprovider:\narguments:\nslo_id: ''\nfunc: get_slo_details\nmodule: chaosdatadog.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/datadog/#slo_must_be_met","title":"slo_must_be_met","text":"Type tolerance Module chaosdatadog.slo.tolerances Name slo_must_be_met Return boolean

Checks that the current SLI value of a SLO is higher than its target for a given threshold period (\"7d\", \"30d\", \"90d\", \"custom\").

Signature:

def slo_must_be_met(threshold: str = '7d',\n                    value: Dict[str, Any] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required threshold string \u201c7d\u201d No value mapping null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"slo-must-be-met\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdatadog.slo.tolerances\",\n\"func\": \"slo_must_be_met\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: slo-must-be-met\nprovider:\nfunc: slo_must_be_met\nmodule: chaosdatadog.slo.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/dynatrace/","title":"Extension chaosdynatrace","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-dynatrace

Dynatrace support for the Chaos Toolkit.

"},{"location":"drivers/dynatrace/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-dynatrace\n
"},{"location":"drivers/dynatrace/#usage","title":"Usage","text":"

To use this package, you must have access to a Dynatrace instance via DynatraceApi and be allowed to connect to it.

the access credentials to the api must be specified in the configuration section

{\n\n\"configuration\": {\n\"dynatrace_base_url\": \"https://{your-environment-id}.live.dynatrace.com\"\n},\n\"secrets\": {\n\"dynatrace\": {\n\"token\": \"...\"\n}\n}\n}\n

Here is an example of how to get the failure rate of a service in Dynatrace. for this example, the api for validate de failure rate is Metric-v1

{\n\"type\": \"probe\",\n\"name\": \"get-failure-rate-services\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.timeseries.v1.probes\",\n\"func\": \"failure_rate\",\n\"secrets\": [\"dynatrace\"],\n\"arguments\": {\n\"entity\": \"SERVICE-665B05BC92550119\",\n\"relative_time\": \"30mins\",\n\"failed_percentage\": 1\n}\n}\n}\n

The probe returns true if the api request failure percentage is less than the failed_percentage value or return false.

The extension also exports a control to send events to Dynatrace. For instance:

{\n\"controls\": [\n{\n\"name\": \"dynatrace\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"dynatrace\"],\n\"module\": \"chaosdynatrace.events.v2.control\"\n}\n}\n]\n}\n

This will send start/stop logs of the experiment events.

You can correlate them to traces using the Open Telemetry extension.

{\n\"configuration\": {\n\"dynatrace_base_url\": \"https://{your-environment-id}.live.dynatrace.com\",\n\"tracing_provider\": \"opentelemetry\",\n\"tracing_opentelemetry_exporter\": \"oltp-http\",\n\"tracing_opentelemetry_collector_endpoint\": \"https://{your-environment-id}.live.dynatrace.com/api/v2/otlp/v1/traces\",\n\"tracing_opentelemetry_collector_headers\": {\n\"Authorization\": \"Api-Token <TOKEN>\"\n}\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n

The logs and traces will be automatically correlated.

"},{"location":"drivers/dynatrace/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/dynatrace/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/dynatrace/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/dynatrace/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/dynatrace/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis True True Method True True Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosdynatrace\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.events.v2.control\"\n}\n}\n]\n}\n
controls:\n- name: chaosdynatrace\nprovider:\nmodule: chaosdynatrace.events.v2.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/dynatrace/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/dynatrace/#v2","title":"v2","text":""},{"location":"drivers/dynatrace/#get_aggregate_logs","title":"get_aggregate_logs","text":"Type probe Module chaosdynatrace.logs.v2.probes Name get_aggregate_logs Return mapping

Query the aggregate logs v2 endpoint matching the criteria.

Returns a list such as:

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs

Signature:

def get_aggregate_logs(\n        from_time: str = 'now',\n        to_time: str = None,\n        query: str = None,\n        time_buckets: int = 1,\n        max_group_values: int = 10,\n        group_by: Union[str, List[str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required from_time string \u201cnow\u201d No to_time string null No query string null No time_buckets integer 1 No max_group_values integer 10 No group_by object null No

Usage:

JSONYAML
{\n\"name\": \"get-aggregate-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.logs.v2.probes\",\n\"func\": \"get_aggregate_logs\"\n}\n}\n
name: get-aggregate-logs\nprovider:\nfunc: get_aggregate_logs\nmodule: chaosdynatrace.logs.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#get_search_logs","title":"get_search_logs","text":"Type probe Module chaosdynatrace.logs.v2.probes Name get_search_logs Return list

Query the search logs v2 endpoint matching the criteria.

Returns a list such as:

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs

Signature:

def get_search_logs(\n        from_time: str = 'now',\n        to_time: str = None,\n        query: str = None,\n        limit: int = 1000,\n        sort: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required from_time string \u201cnow\u201d No to_time string null No query string null No limit integer 1000 No sort string null No

Usage:

JSONYAML
{\n\"name\": \"get-search-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.logs.v2.probes\",\n\"func\": \"get_search_logs\"\n}\n}\n
name: get-search-logs\nprovider:\nfunc: get_search_logs\nmodule: chaosdynatrace.logs.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#query_data_points","title":"query_data_points","text":"Type probe Module chaosdynatrace.metrics.v2.probes Name query_data_points Return list

Query the metrics v2 endpoint for any data point matching the various parameters.

Returns a list such as:

[\n    {\n   'metricId': 'builtin:tech.generic.network.bytesRx:splitBy():avg:auto:sort(value(avg,descending)):limit(10)',\n   'data': [\n  {\n 'dimensions': [],\n 'dimensionMap': {},\n 'timestamps': [\n1647545100000,\n1647545400000,\n1647545700000,\n1647546000000,\n1647546300000,\n1647546600000,\n1647546900000\n ],\n 'values': [\nNone,\n9272.911109076605,\n3565.171102555593,\n3441.491649373372,\n48242.974005126955,\n8055.613537597656,\nNone\n ]\n  }\n   ]\n    }\n]\n

https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/get-data-points

Signature:

def query_data_points(\n        metrics_selector: Union[str, List[str]] = '*',\n        entity_selector: Union[str, List[str]] = None,\n        resolution: str = '5m',\n        from_time: str = 'now',\n        to_time: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required metrics_selector object \u201d*\u201d No entity_selector object null No resolution string \u201c5m\u201d No from_time string \u201cnow\u201d No to_time string null No

Usage:

JSONYAML
{\n\"name\": \"query-data-points\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.metrics.v2.probes\",\n\"func\": \"query_data_points\"\n}\n}\n
name: query-data-points\nprovider:\nfunc: query_data_points\nmodule: chaosdynatrace.metrics.v2.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/dynatrace/#v1","title":"v1","text":""},{"location":"drivers/dynatrace/#failure_rate","title":"failure_rate","text":"Type probe Module chaosdynatrace.timeseries.v1.probes Name failure_rate Return boolean

Validates the failure rate of a specific service. Returns true if the failure rate is less than the expected failure rate For more information check the api documentation. https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v1/

Signature:

def failure_rate(entity: str,\n                 relative_time: str,\n                 failed_percentage: int,\n                 configuration: Dict[str, Dict[str, str]],\n                 secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required entity string Yes relative_time string Yes failed_percentage integer Yes

Usage:

JSONYAML
{\n\"name\": \"failure-rate\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosdynatrace.timeseries.v1.probes\",\n\"func\": \"failure_rate\",\n\"arguments\": {\n\"entity\": \"\",\n\"relative_time\": \"\",\n\"failed_percentage\": 0\n}\n}\n}\n
name: failure-rate\nprovider:\narguments:\nentity: ''\nfailed_percentage: 0\nrelative_time: ''\nfunc: failure_rate\nmodule: chaosdynatrace.timeseries.v1.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gandi/","title":"Extension chaosgandi","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-gandi

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/gandi/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-gandi\n
"},{"location":"drivers/gandi/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"version\": \"1.0.0\",\n\"title\": \"Our domains are not going expiring within a month\",\n\"description\": \"We need time to renew.\",\n\"secrets\": {\n\"gandi\": {\n\"apikey\": {\n\"type\": \"env\",\n\"key\": \"GANDI_API_KEY\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Check domains are all more than 1 month away from expiring\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"list-my-domains\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"validate-domain-expire-date\",\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"gandi\"],\n\"module\": \"chaosgandi.domains.tolerances\",\n\"func\": \"domains_should_not_expire_in\",\n\"arguments\": {\n\"when\": \"1 month\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"secrets\": [\"gandi\"],\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_domains\"\n}\n}\n]\n},\n\"method\": []\n}\n

That\u2019s it!

Set the GANDI_API_KEY environment variable to your Gandi API Key.

Please explore the code to see existing probes and actions.

"},{"location":"drivers/gandi/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/gandi/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/gandi/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/gandi/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/gandi/#domains","title":"domains","text":""},{"location":"drivers/gandi/#domains_should_not_expire_in","title":"domains_should_not_expire_in","text":"Type tolerance Module chaosgandi.domains.tolerances Name domains_should_not_expire_in Return boolean

Go through the list of Gandi domains and fails if any expires before the given date threshold as a relative time to now.

Signature:

def domains_should_not_expire_in(value: List[Dict[str, Any]] = None,\n                                 when: str = '1 month') -> bool:\n    pass\n

Arguments:

Name Type Default Required value list null No when string \u201c1 month\u201d No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"domains-should-not-expire-in\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.tolerances\",\n\"func\": \"domains_should_not_expire_in\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: domains-should-not-expire-in\nprovider:\nfunc: domains_should_not_expire_in\nmodule: chaosgandi.domains.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/gandi/#list_domains","title":"list_domains","text":"Type probe Module chaosgandi.domains.probes Name list_domains Return list

List all domains or those matching the given TLD or FQDN filters and return the list as-is.

See https://api.gandi.net/docs/domains/#v5-domain-domains

Signature:

def list_domains(\n        fqdn_filter: str = None,\n        tld_filter: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required fqdn_filter string null No tld_filter string null No

Usage:

JSONYAML
{\n\"name\": \"list-domains\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_domains\"\n}\n}\n
name: list-domains\nprovider:\nfunc: list_domains\nmodule: chaosgandi.domains.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gandi/#list_nameservers","title":"list_nameservers","text":"Type probe Module chaosgandi.domains.probes Name list_nameservers Return list

List nameservers set for this domain and return them as a list of strings.

See https://api.gandi.net/docs/domains/#v5-domain-domains-domain-nameservers

Signature:

def list_nameservers(domain: str,\n                     configuration: Dict[str, Dict[str, str]] = None,\n                     secrets: Dict[str, Dict[str, str]] = None) -> List[str]:\n    pass\n

Arguments:

Name Type Default Required domain string Yes

Usage:

JSONYAML
{\n\"name\": \"list-nameservers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgandi.domains.probes\",\n\"func\": \"list_nameservers\",\n\"arguments\": {\n\"domain\": \"\"\n}\n}\n}\n
name: list-nameservers\nprovider:\narguments:\ndomain: ''\nfunc: list_nameservers\nmodule: chaosgandi.domains.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/","title":"Extension chaosgcp","text":"Version 0.11.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Google Cloud Platform.

"},{"location":"drivers/gcp/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install --prefer-binary -U chaostoolkit-google-cloud-platform\n
"},{"location":"drivers/gcp/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"version\": \"1.0.0\",\n\"title\": \"create and delete a cloud run service\",\n\"description\": \"n/a\",\n\"secrets\": {\n\"gcp\": {\n\"service_account_file\": \"service_account.json\"\n}\n},\n\"method\": [\n{\n\"name\": \"create-cloud-run-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"create_service\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/...\",\n\"service_id\": \"demo\",\n\"container\": {\n\"name\": \"demo\",\n\"image\": \"gcr.io/google-samples/hello-app:1.0\"\n}\n}\n}\n},\n{\n\"name\": \"delete-cloud-run-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"delete_service\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../services/demo\"\n}\n}\n}\n]\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/gcp/#configuration","title":"Configuration","text":""},{"location":"drivers/gcp/#project-and-cluster-information","title":"Project and Cluster Information","text":"

You can pass the context via the configuration section of your experiment:

{\n\"configuration\": {\n\"gcp_project_id\": \"...\",\n\"gcp_gke_cluster_name\": \"...\",\n\"gcp_region\": \"...\",\n\"gcp_zone\": \"...\"\n}\n}\n

This is only valuable when you want to reuse the same context everywhere. A finer approach is to set the the parent argument on activities that support it. It should be of the form projects/*/locations/* or projects/*/locations/*/clusters/*, where location is either a region or a zone, depending on the context and defined by the GCP API.

When provided, this takes precedence over the context defined in the configuration. In some cases, it also means you do not need to pass the values in the configuration at all as the extension will derive the context from the parent value.

"},{"location":"drivers/gcp/#credentials","title":"Credentials","text":"

This extension expects a service account with enough permissions to perform its operations. Please create such a service account manually (do not use the default one for your cluster if you can, so you\u2019ll be able to delete that service account if need be).

Once you have created your service account, either keep the file on the same machine where you will be running the experiment from. Or, pass its content as part of the secrets section, although this is not recommended because your sensitive data will be quite visible.

Here is the first way:

{\n\"secrets\": {\n\"gcp\": {\n\"service_account_file\": \"/path/to/sa.json\"\n}\n}\n}\n

You can also use the well-known GOOGLE_APPLICATION_CREDENTIALS environment variables. iI that case, you do not need to set any secrets in the experiment.

While the embedded way looks like this:

{\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"...\"\n},\n\"gcp\": {\n\"service_account_info\": {\n\"type\": \"service_account\",\n\"project_id\": \"...\",\n\"private_key_id\": \"...\",\n\"private_key\": \"...\",\n\"client_email\": \"...\",\n\"client_id\": \"...\",\n\"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n\"token_uri\": \"https://accounts.google.com/o/oauth2/token\",\n\"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n\"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/....\"\n}\n}\n}\n}\n

Notice also how we provided here the k8s entry. This is only because, in our example we use the swap_nodepool action which drains the Kubernetes nodes and it requires the Kubernetes cluster credentials to work. These are documented in the Kubernetes extension for Chaos Toolkit. This is the only action that requires such a secret payload, others only speak to the GCP API.

"},{"location":"drivers/gcp/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example which creates a node pool then swap it for a new one.

{\n\"version\": \"1.0.0\",\n\"title\": \"do stuff ye\",\n\"description\": \"n/a\",\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"gke_...\"\n},\n\"gcp\": {\n\"service_account_file\": \"service-account.json\"\n}\n},\n\"method\": [\n{\n\"name\": \"create-our-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"create_new_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/...\",\n\"body\": {\n\"config\": { \"oauth_scopes\": [\n\"gke-version-default\",\n\"https://www.googleapis.com/auth/devstorage.read_only\",\n\"https://www.googleapis.com/auth/logging.write\",\n\"https://www.googleapis.com/auth/monitoring\",\n\"https://www.googleapis.com/auth/service.management.readonly\",\n\"https://www.googleapis.com/auth/servicecontrol\",\n\"https://www.googleapis.com/auth/trace.append\"\n]\n},\n\"initial_node_count\": 1,\n\"name\": \"default-pool\"\n}\n}\n}\n},\n{\n\"name\": \"fetch-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/.../nodePools/default-pool\"\n}\n}\n},\n{\n\"name\": \"swap-our-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"swap_nodepool\",\n\"secrets\": [\"gcp\", \"k8s\"],\n\"arguments\": {\n\"parent\": \"projects/.../locations/.../clusters/...\",\n\"delete_old_node_pool\": true,\n\"old_node_pool_id\": \"default-pool\",\n\"new_nodepool_body\": {\n\"config\": { \"oauth_scopes\": [\n\"gke-version-default\",\n\"https://www.googleapis.com/auth/devstorage.read_only\",\n\"https://www.googleapis.com/auth/logging.write\",\n\"https://www.googleapis.com/auth/monitoring\",\n\"https://www.googleapis.com/auth/service.management.readonly\",\n\"https://www.googleapis.com/auth/servicecontrol\",\n\"https://www.googleapis.com/auth/trace.append\"\n]\n},\n\"initial_node_count\": 1,\n\"name\": \"default-pool-1\"\n}\n}\n}\n}\n]\n}\n
"},{"location":"drivers/gcp/#migrate-from-gce-extension","title":"Migrate from GCE extension","text":"

If you previously used the deprecated GCE extension, here is a quick recap of changes you\u2019ll need to go through to update your experiments.

"},{"location":"drivers/gcp/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

If you wish to add a new function to this extension, that is related to a Google Cloud product that is not available yet in this package, please use the product short name or acronym as a first level subpackage (eg. iam, gke, sql, storage, \u2026). See the list of [GCP products and services][gcp_products].

[gcp_products] https://cloud.google.com/products/

"},{"location":"drivers/gcp/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/gcp/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/gcp/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/gcp/#artifact","title":"artifact","text":""},{"location":"drivers/gcp/#get_container_most_recent_image_vulnerabilities_occurences","title":"get_container_most_recent_image_vulnerabilities_occurences","text":"Type probe Module chaosgcp.artifact.probes Name get_container_most_recent_image_vulnerabilities_occurences Return mapping

List all occurrences for a given container image tag.

Signature:

def get_container_most_recent_image_vulnerabilities_occurences(\n        repository: str,\n        package_name: str,\n        kind: str = 'VULNERABILITY',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes kind string \u201cVULNERABILITY\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-container-most-recent-image-vulnerabilities-occurences\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_container_most_recent_image_vulnerabilities_occurences\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-container-most-recent-image-vulnerabilities-occurences\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_container_most_recent_image_vulnerabilities_occurences\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#get_docker_image_version_from_tag","title":"get_docker_image_version_from_tag","text":"Type probe Module chaosgcp.artifact.probes Name get_docker_image_version_from_tag Return mapping

Get image version (sha256) for most recent tag.

Signature:

def get_docker_image_version_from_tag(\n        repository: str,\n        package_name: str,\n        tag: str = 'latest',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes tag string \u201clatest\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-docker-image-version-from-tag\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_docker_image_version_from_tag\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-docker-image-version-from-tag\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_docker_image_version_from_tag\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#get_most_recent_docker_image","title":"get_most_recent_docker_image","text":"Type probe Module chaosgcp.artifact.probes Name get_most_recent_docker_image Return mapping

Get most recent tag for a package in repository.

Signature:

def get_most_recent_docker_image(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-most-recent-docker-image\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"get_most_recent_docker_image\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: get-most-recent-docker-image\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: get_most_recent_docker_image\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#has_most_recent_image_any_severe_or_critical_vulnerabilities","title":"has_most_recent_image_any_severe_or_critical_vulnerabilities","text":"Type probe Module chaosgcp.artifact.probes Name has_most_recent_image_any_severe_or_critical_vulnerabilities Return boolean

Has the most recent tag any severe or critical vulnerabilities.

Signature:

def has_most_recent_image_any_severe_or_critical_vulnerabilities(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"has-most-recent-image-any-severe-or-critical-vulnerabilities\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"has_most_recent_image_any_severe_or_critical_vulnerabilities\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: has-most-recent-image-any-severe-or-critical-vulnerabilities\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: has_most_recent_image_any_severe_or_critical_vulnerabilities\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_docker_image_tags","title":"list_docker_image_tags","text":"Type probe Module chaosgcp.artifact.probes Name list_docker_image_tags Return list

List docker image tags of a package in the given repository.

Signature:

def list_docker_image_tags(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"list-docker-image-tags\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"list_docker_image_tags\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: list-docker-image-tags\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: list_docker_image_tags\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_severe_or_critical_vulnerabilities_in_most_recent_image","title":"list_severe_or_critical_vulnerabilities_in_most_recent_image","text":"Type probe Module chaosgcp.artifact.probes Name list_severe_or_critical_vulnerabilities_in_most_recent_image Return list

List all severe and critical vulnerabilities for the most recent tag.

Signature:

def list_severe_or_critical_vulnerabilities_in_most_recent_image(\n        repository: str,\n        package_name: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required repository string Yes package_name string Yes

Usage:

JSONYAML
{\n\"name\": \"list-severe-or-critical-vulnerabilities-in-most-recent-image\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.artifact.probes\",\n\"func\": \"list_severe_or_critical_vulnerabilities_in_most_recent_image\",\n\"arguments\": {\n\"repository\": \"\",\n\"package_name\": \"\"\n}\n}\n}\n
name: list-severe-or-critical-vulnerabilities-in-most-recent-image\nprovider:\narguments:\npackage_name: ''\nrepository: ''\nfunc: list_severe_or_critical_vulnerabilities_in_most_recent_image\nmodule: chaosgcp.artifact.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#cloudbuild","title":"cloudbuild","text":""},{"location":"drivers/gcp/#get_trigger","title":"get_trigger","text":"Type probe Module chaosgcp.cloudbuild.probes Name get_trigger Return None

Returns information about a BuildTrigger.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/get

:param name: name of the trigger :param configuration: :param secrets: :return:

Signature:

def get_trigger(name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-trigger\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"get_trigger\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: get-trigger\nprovider:\narguments:\nname: ''\nfunc: get_trigger\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_trigger_names","title":"list_trigger_names","text":"Type probe Module chaosgcp.cloudbuild.probes Name list_trigger_names Return None

List only the trigger names of a project

:param configuration: :param secrets:

:return:

Signature:

def list_trigger_names(configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-trigger-names\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"list_trigger_names\"\n}\n}\n
name: list-trigger-names\nprovider:\nfunc: list_trigger_names\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_triggers","title":"list_triggers","text":"Type probe Module chaosgcp.cloudbuild.probes Name list_triggers Return None

Lists existing BuildTriggers.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/list

:param configuration: :param secrets:

:return:

Signature:

def list_triggers(configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-triggers\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.probes\",\n\"func\": \"list_triggers\"\n}\n}\n
name: list-triggers\nprovider:\nfunc: list_triggers\nmodule: chaosgcp.cloudbuild.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#run_trigger","title":"run_trigger","text":"Type action Module chaosgcp.cloudbuild.actions Name run_trigger Return None

Runs a BuildTrigger at a particular source revision.

NB: The trigger must exist in the targeted project.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/run

:param name: name of the trigger :param source: location of the source in a Google Cloud Source Repository :param configuration: :param secrets:

:return:

Signature:

def run_trigger(name: str,\n                source: Dict[Any, Any],\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes source mapping Yes

Usage:

JSONYAML
{\n\"name\": \"run-trigger\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudbuild.actions\",\n\"func\": \"run_trigger\",\n\"arguments\": {\n\"name\": \"\",\n\"source\": {}\n}\n}\n}\n
name: run-trigger\nprovider:\narguments:\nname: ''\nsource: {}\nfunc: run_trigger\nmodule: chaosgcp.cloudbuild.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#cloudrun","title":"cloudrun","text":""},{"location":"drivers/gcp/#create_service","title":"create_service","text":"Type action Module chaosgcp.cloudrun.actions Name create_service Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the location in the project \u2018projects/PROJECT_ID/locations/LOC :param service_id: unique identifier for the service :param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param description: optional text description of the service :param max_instance_request_concurrency: optional maximum number of requests that each serving instance can receive :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets:

:return:

Signature:

def create_service(parent: str,\n                   service_id: str,\n                   container: Dict[str, Any],\n                   description: str = None,\n                   max_instance_request_concurrency: int = 0,\n                   service_account: str = None,\n                   encryption_key: str = None,\n                   traffic: List[Dict[str, Any]] = None,\n                   labels: Dict[str, str] = None,\n                   annotations: Dict[str, str] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes service_id string Yes container mapping Yes description string null No max_instance_request_concurrency integer 0 No service_account string null No encryption_key string null No traffic list null No labels mapping null No annotations mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"create_service\",\n\"arguments\": {\n\"parent\": \"\",\n\"service_id\": \"\",\n\"container\": {}\n}\n}\n}\n
name: create-service\nprovider:\narguments:\ncontainer: {}\nparent: ''\nservice_id: ''\nfunc: create_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#delete_service","title":"delete_service","text":"Type action Module chaosgcp.cloudrun.actions Name delete_service Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC/services/SVC :param configuration: :param secrets:

:return:

Signature:

def delete_service(parent: str,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"delete_service\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: delete-service\nprovider:\narguments:\nparent: ''\nfunc: delete_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#get_service","title":"get_service","text":"Type probe Module chaosgcp.cloudrun.probes Name get_service Return mapping

Retrieve a single cloud run service

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_get_service

:param name: the path to the service \u2018projects/PROJECT_ID/locations/LOC/services/SVC :param configuration: :param secrets:

:return:

Signature:

def get_service(name: str,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"get_service\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: get-service\nprovider:\narguments:\nname: ''\nfunc: get_service\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_service_revisions","title":"list_service_revisions","text":"Type probe Module chaosgcp.cloudrun.probes Name list_service_revisions Return list

List all Cloud Run service revisions for a specific service.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.revisions.RevisionsClient#google_cloud_run_v2_services_revisions_RevisionsClient_list_revisions

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC/service/SVC :param configuration: :param secrets:

:return:

Signature:

def list_service_revisions(\n        parent: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"list-service-revisions\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"list_service_revisions\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: list-service-revisions\nprovider:\narguments:\nparent: ''\nfunc: list_service_revisions\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_services","title":"list_services","text":"Type probe Module chaosgcp.cloudrun.probes Name list_services Return list

List all Cloud Run services

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_list_services

:param parent: the path to the service \u2018projects/PROJECT_ID/locations/LOC :param configuration: :param secrets:

:return:

Signature:

def list_services(\n        parent: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required parent string Yes

Usage:

JSONYAML
{\n\"name\": \"list-services\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.probes\",\n\"func\": \"list_services\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: list-services\nprovider:\narguments:\nparent: ''\nfunc: list_services\nmodule: chaosgcp.cloudrun.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#update_service","title":"update_service","text":"Type action Module chaosgcp.cloudrun.actions Name update_service Return None

Updates a Cloud Run service.

For example:

{\n\"name\": \"route-traffic-two-latest-and-older-revision\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": chaosgcp.cloudrun.actions\",\n   \"func\": \"update_service\",\n   \"arguments\": {\n  \"parent\": \"projects/${gcp_project_id}/locations/${gcp_location}/services/${service_name}\",\n  \"container\": {\n \"image\": \"eu.gcr.io/${gcp_project_id}/demo\"\n  },\n  \"traffic\": [{\n \"type_\": 1,\n \"percent\": 50\n  }, {\n \"type_\": 2,\n \"revision\": \"whatever-w788x\",\n \"percent\": 50\n  }],\n   }\n    }\n}\n

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets: :param vpc_access_config: optional value for vpc_connect

:return:

Signature:

def update_service(parent: str,\n                   container: Dict[str, Any] = None,\n                   max_instance_request_concurrency: int = 100,\n                   service_account: str = None,\n                   encryption_key: str = None,\n                   traffic: List[Dict[str, Any]] = None,\n                   labels: Dict[str, str] = None,\n                   annotations: Dict[str, str] = None,\n                   vpc_access_config: Dict[str, str] = None,\n                   configuration: Dict[str, Dict[str, str]] = None,\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required parent string Yes container mapping null No max_instance_request_concurrency integer 100 No service_account string null No encryption_key string null No traffic list null No labels mapping null No annotations mapping null No vpc_access_config mapping null No

Usage:

JSONYAML
{\n\"name\": \"update-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.cloudrun.actions\",\n\"func\": \"update_service\",\n\"arguments\": {\n\"parent\": \"\"\n}\n}\n}\n
name: update-service\nprovider:\narguments:\nparent: ''\nfunc: update_service\nmodule: chaosgcp.cloudrun.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#nodepool","title":"nodepool","text":""},{"location":"drivers/gcp/#create_new_nodepool","title":"create_new_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name create_new_nodepool Return mapping

Create a new node pool in the given cluster/zone of the provided project.

The node pool config must be passed a mapping to the body parameter and respect the REST API.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def create_new_nodepool(\n        body: Dict[str, Any],\n        parent: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required body mapping Yes parent string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"create-new-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"create_new_nodepool\",\n\"arguments\": {\n\"body\": {}\n}\n}\n}\n
name: create-new-nodepool\nprovider:\narguments:\nbody: {}\nfunc: create_new_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#delete_nodepool","title":"delete_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name delete_nodepool Return mapping

Delete node pool from the given cluster/zone of the provided project.

If wait_until_complete is set to True (the default), the function will block until the node pool is deleted. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def delete_nodepool(\n        parent: str = None,\n        node_pool_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parent string null No node_pool_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"delete-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"delete_nodepool\"\n}\n}\n
name: delete-nodepool\nprovider:\nfunc: delete_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#get_nodepool","title":"get_nodepool","text":"Type probe Module chaosgcp.gke.nodepool.probes Name get_nodepool Return mapping

Get a specific nodepool of a cluster.

The parent is following the form projects/*/locations/*/clusters/*/nodePools/* and will override any settings in the configuration block.

{\n\"name\": \"retrieve-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"parent\": \"projects/my-project-89/locations/us-east1/clusters/cluster-1/nodePools/default-pool\"\n}\n}\n}\n

If not provided this action uses the configuration settings. In that case, make sure to also pass the node_pool_id value.

{\n\"name\": \"retrieve-our-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\",\n\"secrets\": [\"gcp\"],\n\"arguments\": {\n\"node_pool_id\": \"default-pool\"\n}\n}\n}\n

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/get

Signature:

def get_nodepool(node_pool_id: str = None,\n                 parent: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required node_pool_id string null No parent string null No

Usage:

JSONYAML
{\n\"name\": \"get-nodepool\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"get_nodepool\"\n}\n}\n
name: get-nodepool\nprovider:\nfunc: get_nodepool\nmodule: chaosgcp.gke.nodepool.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#list_nodepools","title":"list_nodepools","text":"Type probe Module chaosgcp.gke.nodepool.probes Name list_nodepools Return mapping

List nodepools of a cluster.

The parent is following the form projects/*/locations/*/clusters/* and will override any settings in the configuration block. If not provided this action uses the configuration settings.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/list

Signature:

def list_nodepools(\n        parent: str = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parent string null No

Usage:

JSONYAML
{\n\"name\": \"list-nodepools\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.probes\",\n\"func\": \"list_nodepools\"\n}\n}\n
name: list-nodepools\nprovider:\nfunc: list_nodepools\nmodule: chaosgcp.gke.nodepool.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#rollback_nodepool","title":"rollback_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name rollback_nodepool Return mapping

Rollback a previously Aborted or Failed NodePool upgrade.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def rollback_nodepool(\n        node_pool_id: str,\n        parent: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required node_pool_id string Yes parent string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"rollback-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"rollback_nodepool\",\n\"arguments\": {\n\"node_pool_id\": \"\"\n}\n}\n}\n
name: rollback-nodepool\nprovider:\narguments:\nnode_pool_id: ''\nfunc: rollback_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#swap_nodepool","title":"swap_nodepool","text":"Type action Module chaosgcp.gke.nodepool.actions Name swap_nodepool Return mapping

Create a new nodepool, drain the old one so pods can be rescheduled on the new pool. Delete the old nodepool only delete_old_node_pool is set to True, which is not the default. Otherwise, leave the old node pool cordonned so it cannot be scheduled any longer.

Please ensure to provide the Kubernetes secrets as well when calling this action. See https://github.com/chaostoolkit/chaostoolkit-kubernetes#configuration

Signature:

def swap_nodepool(old_node_pool_id: str,\n                  new_nodepool_body: Dict[str, Any],\n                  parent: str = None,\n                  wait_until_complete: bool = True,\n                  delete_old_node_pool: bool = False,\n                  drain_timeout: int = 120,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required old_node_pool_id string Yes new_nodepool_body mapping Yes parent string null No wait_until_complete boolean true No delete_old_node_pool boolean false No drain_timeout integer 120 No

Usage:

JSONYAML
{\n\"name\": \"swap-nodepool\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.gke.nodepool.actions\",\n\"func\": \"swap_nodepool\",\n\"arguments\": {\n\"old_node_pool_id\": \"\",\n\"new_nodepool_body\": {}\n}\n}\n}\n
name: swap-nodepool\nprovider:\narguments:\nnew_nodepool_body: {}\nold_node_pool_id: ''\nfunc: swap_nodepool\nmodule: chaosgcp.gke.nodepool.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#lb","title":"lb","text":""},{"location":"drivers/gcp/#inject_traffic_delay","title":"inject_traffic_delay","text":"Type action Module chaosgcp.lb.actions Name inject_traffic_delay Return mapping

Add/set delay for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

For instance:

{\n\"type: \"action\",\n    \"name\": \"add-delay-to-home-page\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"inject_traffic_delay\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n  \"impacted_percentage\": 75.0,\n  \"delay_in_seconds\": 3,\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def inject_traffic_delay(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        impacted_percentage: float = 50.0,\n        delay_in_seconds: int = 1,\n        delay_in_nanos: int = 0,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes impacted_percentage number 50.0 No delay_in_seconds integer 1 No delay_in_nanos integer 0 No

Usage:

JSONYAML
{\n\"name\": \"inject-traffic-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"inject_traffic_delay\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: inject-traffic-delay\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: inject_traffic_delay\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#inject_traffic_faults","title":"inject_traffic_faults","text":"Type action Module chaosgcp.lb.actions Name inject_traffic_faults Return mapping

Add/set HTTP status codes for a percentage of requests going through a url map on a given path.

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

For instance:

{\n\"type: \"action\",\n    \"name\": \"return-503-from-home-page\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"inject_traffic_faults\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n  \"impacted_percentage\": 75.0,\n  \"http_status\": 503,\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def inject_traffic_faults(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        impacted_percentage: float = 50.0,\n        http_status: int = 400,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes impacted_percentage number 50.0 No http_status integer 400 No

Usage:

JSONYAML
{\n\"name\": \"inject-traffic-faults\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"inject_traffic_faults\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: inject-traffic-faults\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: inject_traffic_faults\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#remove_fault_injection_traffic_policy","title":"remove_fault_injection_traffic_policy","text":"Type action Module chaosgcp.lb.actions Name remove_fault_injection_traffic_policy Return mapping

Remove any fault injection policy from url map on a given path.

For instance:

{\n\"type: \"action\",\n    \"name\": \"remove-fault-injection-policy\",\n    \"provider\": {\n   \"type\": \"python\",\n   \"module\": \"chaosgcp.lb.actions\",\n   \"func\": \"remove_fault_injection_traffic_policy\",\n   \"arguments\": {\n  \"url_map\": \"demo-urlmap\",\n  \"target_name\": \"allpaths\",\n  \"target_path\": \"/*\",\n   }\n    }\n}\n

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature:

def remove_fault_injection_traffic_policy(\n        url_map: str,\n        target_name: str,\n        target_path: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required url_map string Yes target_name string Yes target_path string Yes

Usage:

JSONYAML
{\n\"name\": \"remove-fault-injection-traffic-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.lb.actions\",\n\"func\": \"remove_fault_injection_traffic_policy\",\n\"arguments\": {\n\"url_map\": \"\",\n\"target_name\": \"\",\n\"target_path\": \"\"\n}\n}\n}\n
name: remove-fault-injection-traffic-policy\nprovider:\narguments:\ntarget_name: ''\ntarget_path: ''\nurl_map: ''\nfunc: remove_fault_injection_traffic_policy\nmodule: chaosgcp.lb.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#monitoring","title":"monitoring","text":""},{"location":"drivers/gcp/#get_metrics","title":"get_metrics","text":"Type probe Module chaosgcp.monitoring.probes Name get_metrics Return list

Query for Cloud Monitoring metrics and returns a list of time series objects for the metric and period.

Refer to the documentation https://cloud.google.com/python/docs/reference/monitoring/latest/query to learn about the various flags.

Signature:

def get_metrics(\n        metric_type: str,\n        metric_labels_filters: Optional[Dict[str, str]] = None,\n        resource_labels_filters: Optional[Dict[str, str]] = None,\n        end_time: str = 'now',\n        window: str = '5 minutes',\n        aligner: int = 0,\n        aligner_minutes: int = 1,\n        reducer: int = 0,\n        reducer_group_by: Optional[List[str]] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required metric_type string Yes metric_labels_filters object null No resource_labels_filters object null No end_time string \u201cnow\u201d No window string \u201c5 minutes\u201d No aligner integer 0 No aligner_minutes integer 1 No reducer integer 0 No reducer_group_by object null No

Usage:

JSONYAML
{\n\"name\": \"get-metrics\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.monitoring.probes\",\n\"func\": \"get_metrics\",\n\"arguments\": {\n\"metric_type\": \"\"\n}\n}\n}\n
name: get-metrics\nprovider:\narguments:\nmetric_type: ''\nfunc: get_metrics\nmodule: chaosgcp.monitoring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#sql","title":"sql","text":""},{"location":"drivers/gcp/#describe_instance","title":"describe_instance","text":"Type probe Module chaosgcp.sql.probes Name describe_instance Return mapping

Displays configuration and metadata about a Cloud SQL instance.

Information such as instance name, IP address, region, the CA certificate and configuration settings will be displayed.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/get

:param instance_id: Cloud SQL instance ID.

Signature:

def describe_instance(\n        instance_id: str,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes

Usage:

JSONYAML
{\n\"name\": \"describe-instance\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.probes\",\n\"func\": \"describe_instance\",\n\"arguments\": {\n\"instance_id\": \"\"\n}\n}\n}\n
name: describe-instance\nprovider:\narguments:\ninstance_id: ''\nfunc: describe_instance\nmodule: chaosgcp.sql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#disable_replication","title":"disable_replication","text":"Type action Module chaosgcp.sql.actions Name disable_replication Return mapping

Disable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#disable_replication

Signature:

def disable_replication(\n        replica_name: str,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required replica_name string Yes project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"disable-replication\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"disable_replication\",\n\"arguments\": {\n\"replica_name\": \"\"\n}\n}\n}\n
name: disable-replication\nprovider:\narguments:\nreplica_name: ''\nfunc: disable_replication\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#enable_replication","title":"enable_replication","text":"Type action Module chaosgcp.sql.actions Name enable_replication Return mapping

Enable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#enable_replication

Signature:

def enable_replication(\n        replica_name: str,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required replica_name string Yes project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"enable-replication\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"enable_replication\",\n\"arguments\": {\n\"replica_name\": \"\"\n}\n}\n}\n
name: enable-replication\nprovider:\narguments:\nreplica_name: ''\nfunc: enable_replication\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#export_data","title":"export_data","text":"Type action Module chaosgcp.sql.actions Name export_data Return mapping

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/export

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def export_data(instance_id: str,\n                storage_uri: str,\n                project_id: str = None,\n                file_type: str = 'sql',\n                databases: List[str] = None,\n                tables: List[str] = None,\n                export_schema_only: bool = False,\n                wait_until_complete: bool = True,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes storage_uri string Yes project_id string null No file_type string \u201csql\u201d No databases list null No tables list null No export_schema_only boolean false No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"export-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"export_data\",\n\"arguments\": {\n\"instance_id\": \"\",\n\"storage_uri\": \"\"\n}\n}\n}\n
name: export-data\nprovider:\narguments:\ninstance_id: ''\nstorage_uri: ''\nfunc: export_data\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#import_data","title":"import_data","text":"Type action Module chaosgcp.sql.actions Name import_data Return mapping

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/import

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def import_data(instance_id: str,\n                storage_uri: str,\n                database: str,\n                project_id: str = None,\n                file_type: str = 'sql',\n                import_user: str = None,\n                table: str = None,\n                columns: List[str] = None,\n                wait_until_complete: bool = True,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes storage_uri string Yes database string Yes project_id string null No file_type string \u201csql\u201d No import_user string null No table string null No columns list null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"import-data\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"import_data\",\n\"arguments\": {\n\"instance_id\": \"\",\n\"storage_uri\": \"\",\n\"database\": \"\"\n}\n}\n}\n
name: import-data\nprovider:\narguments:\ndatabase: ''\ninstance_id: ''\nstorage_uri: ''\nfunc: import_data\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#list_instances","title":"list_instances","text":"Type probe Module chaosgcp.sql.probes Name list_instances Return mapping

Lists Cloud SQL instances in a given project in the alphabetical order of the instance name.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/list

Signature:

def list_instances(\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"list-instances\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.probes\",\n\"func\": \"list_instances\"\n}\n}\n
name: list-instances\nprovider:\nfunc: list_instances\nmodule: chaosgcp.sql.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/gcp/#restore_backup","title":"restore_backup","text":"Type action Module chaosgcp.sql.actions Name restore_backup Return mapping

Performs a restore of a given backup. If target_instance_id is not set then source and target are the same. If backup_run_id is not set, then it picks the most recent backup automatically.

You may wait for the operation to complete, but bear in mind this can take several minutes.

Signature:

def restore_backup(\n        source_instance_id: str,\n        target_instance_id: Optional[str] = None,\n        backup_run_id: Optional[str] = None,\n        project_id: str = None,\n        wait_until_complete: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required source_instance_id string Yes target_instance_id object null No backup_run_id object null No project_id string null No wait_until_complete boolean true No

Usage:

JSONYAML
{\n\"name\": \"restore-backup\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"restore_backup\",\n\"arguments\": {\n\"source_instance_id\": \"\"\n}\n}\n}\n
name: restore-backup\nprovider:\narguments:\nsource_instance_id: ''\nfunc: restore_backup\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#trigger_failover","title":"trigger_failover","text":"Type action Module chaosgcp.sql.actions Name trigger_failover Return mapping

Causes a high-availability Cloud SQL instance to failover.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/failover

:param instance_id: Cloud SQL instance ID. :param wait_until_complete: wait for the operation in progress to complete. :param settings_version: The current settings version of this instance.

:return:

Signature:

def trigger_failover(\n        instance_id: str,\n        wait_until_complete: bool = True,\n        settings_version: Optional[int] = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required instance_id string Yes wait_until_complete boolean true No settings_version object null No

Usage:

JSONYAML
{\n\"name\": \"trigger-failover\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.sql.actions\",\n\"func\": \"trigger_failover\",\n\"arguments\": {\n\"instance_id\": \"\"\n}\n}\n}\n
name: trigger-failover\nprovider:\narguments:\ninstance_id: ''\nfunc: trigger_failover\nmodule: chaosgcp.sql.actions\ntype: python\ntype: action\n
"},{"location":"drivers/gcp/#storage","title":"storage","text":""},{"location":"drivers/gcp/#object_exists","title":"object_exists","text":"Type probe Module chaosgcp.storage.probes Name object_exists Return boolean

Indicates whether a file in Cloud Storage bucket exists.

:param bucket_name: name of the bucket :param object_name: name of the object within the bucket as path :param configuration: :param secrets:

Signature:

def object_exists(bucket_name: str,\n                  object_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required bucket_name string Yes object_name string Yes

Usage:

JSONYAML
{\n\"name\": \"object-exists\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgcp.storage.probes\",\n\"func\": \"object_exists\",\n\"arguments\": {\n\"bucket_name\": \"\",\n\"object_name\": \"\"\n}\n}\n}\n
name: object-exists\nprovider:\narguments:\nbucket_name: ''\nobject_name: ''\nfunc: object_exists\nmodule: chaosgcp.storage.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/grafana/","title":"Extension chaosgrafana","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-grafana

This project should be used as a starting point to create your own Chaos Toolkit extension.

"},{"location":"drivers/grafana/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-grafana\n
"},{"location":"drivers/grafana/#usage","title":"Usage","text":""},{"location":"drivers/grafana/#sending-chaos-toolkit-logs-to-loki","title":"Sending Chaos Toolkit logs to Loki","text":"

To send the Chaos Toolkit logs to Loki endpoints, you need to enable the according control as follows:

{\n\"secrets\": {\n\"grafana\": {\n\"auth\": [\"admin\", \"admin\"]\n}\n},\n\"controls\": [\n{\n\"name\": \"loki\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgrafana.controls.loki\",\n\"secrets\": [\"grafana\"],\n\"arguments\": {\n\"loki_endpoint\": \"http://localhost:3100\",\n\"tags\": {\"service\": \"something\"}\n}\n}\n}\n]\n}\n

You can set two other arguments to the control:

These are particularly useful when you cpuple this extension with others like Prometheus where you want to cross-reference between logs and metrics.

"},{"location":"drivers/grafana/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/grafana/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/grafana/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/grafana/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/grafana/#loki","title":"loki","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosgrafana\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosgrafana.controls.loki\"\n}\n}\n]\n}\n
controls:\n- name: chaosgrafana\nprovider:\nmodule: chaosgrafana.controls.loki\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/grafana/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/grafana/#controls","title":"controls","text":""},{"location":"drivers/humio/","title":"Extension chaoshumio","text":"Version 0.6.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-humio

This project is an extension for the Chaos Toolkit to target Humio.

"},{"location":"drivers/humio/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-humio\n
"},{"location":"drivers/humio/#humio-token","title":"Humio Token","text":"

To use this extension, you will need one piece of information from Humio, the API token for a user.

"},{"location":"drivers/humio/#usage","title":"Usage","text":"

This extension can be used a control on the experiment or a notification plugin of the Chaos Toolkit CLI itself. Usually, only one of these two methods is used at any given time as they serve similar purpose but feel free to combine them. The control approach is deeper because it logs down to the activity whereas notifications are much higher level.

This extension can also be used as a probe to fetch information from Humio.

"},{"location":"drivers/humio/#query-log-events","title":"Query Log Events","text":"

To use this extension as a probe as part of your experiment, use it as follows:

{\n\"configuration\": {\n\"humio_url\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_URL\",\n\"default\": \"https://cloud.humio.com\"\n},\n\"humio_repository\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_REPOSITORY\",\n\"default\": \"sandbox\"\n}\n},\n\"secrets\": {\n\"humio\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_TOKEN\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Running experiment\",\n\"probes\": [\n{\n\"name\": \"run-humio-search-query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.probes\",\n\"func\": \"search_query\",\n\"secrets\": [\n\"humio\"\n],\n\"arguments\": {\n\"qs\": \"count(as=_count)\",\n\"start\": \"24hours\",\n\"end\": \"now\"\n}\n},\n\"tolerance\": {\n\"name\": \"humio-query-result-value-greater-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_above\",\n\"arguments\": {\n\"field\": \"_count\",\n\"lower\": 1\n}\n}\n}\n}\n]\n}\n}\n

In this example, we are using the search_query probe and validate it with a specific tolerance that can inspect the returned payload from Humio and ensure each value matches the required expectations.

"},{"location":"drivers/humio/#notification","title":"Notification","text":"

To use this extension to push notifications, edit your chaostoolkit settings by adding the following payload:

notifications:\n-\ntype: plugin\nmodule: chaoshumio.notification\nhumio_url: https://myhumio.company.com\ntoken: my-token\n

By default all events will be forwarded to that channel. You may filter only those events you care for:

notifications:\n-\ntype: plugin\nmodule: chaoshumio.notification\nhumio_url: https://myhumio.company.com\ntoken: my-token\nevents:\n- run-failed\n- run-started\n

Only sends those two events.

"},{"location":"drivers/humio/#control","title":"Control","text":"

To use this extension as a control over the experiment and send logs during the execution of the experiment to https://cloud.humio.com, add the following payload to your experiment:

{\n\"secrets\": {\n\"humio\": {\n\"ingest_token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_INGEST_TOKEN\"\n}\n}\n},\n\"controls\": [\n{\n\"name\": \"humio-logger\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n

You do not need to set the secrets property in the provider block. In a control, all secrets are passed directly to each control asking for it.

If you want to send logs to a different Humio URL endpoint, specify the humio_url configuration parameter. The following shows how this parameter:

{\n\"secrets\": {\n\"humio\": {\n\"ingest_token\": {\n\"type\": \"env\",\n\"key\": \"HUMIO_INGEST_TOKEN\"\n}\n}\n},\n\"configuration\": {\n\"humio_url\": \"https://myhumio.company.com\"\n},\n\"controls\": [\n{\n\"name\": \"humio-logger\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n

This will ensure the results of the experiment, steady-state, method, rollbacks and each activity are sent to Humio. The experiment itself will also be send initially.

"},{"location":"drivers/humio/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/humio/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install .[dev]\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/humio/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/humio/#lint","title":"Lint","text":"

Ensure your code is properly linted:

$ make format\n$ make lint\n
"},{"location":"drivers/humio/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/humio/#control_1","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis False True Method False True Rollback False True Activities False True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaoshumio\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.control\"\n}\n}\n]\n}\n
controls:\n- name: chaoshumio\nprovider:\nmodule: chaoshumio.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/humio/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/humio/#control_2","title":"control","text":""},{"location":"drivers/humio/#notification_1","title":"notification","text":""},{"location":"drivers/humio/#notify","title":"notify","text":"Type Module chaoshumio.notification Name notify Return null

Send a log message to the Humio ingest endpoint.

The settings must contain:

If token is missing, no notification is sent. If humio_url is not specified then the default, https://cloud.humio.com, will be used.

Signature:

def notify(settings: Dict[str, Any], event: Dict[str, Any]) -> None:\n    pass\n

Arguments:

Name Type Default Required settings mapping Yes event mapping Yes

Usage:

JSONYAML
{\n\"name\": \"notify\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.notification\",\n\"func\": \"notify\",\n\"arguments\": {\n\"settings\": {},\n\"event\": {}\n}\n}\n}\n
name: notify\nprovider:\narguments:\nevent: {}\nsettings: {}\nfunc: notify\nmodule: chaoshumio.notification\ntype: python\ntype: ''\n
"},{"location":"drivers/humio/#probes","title":"probes","text":""},{"location":"drivers/humio/#search_query","title":"search_query","text":"Type probe Module chaoshumio.probes Name search_query Return Any

Perform a search query against the Humio API and returns its result as-is.

Set result_as_text to true to get the result as a raw string, otherwise the probe returns a JSON payload.

Make sure to set the Humio token as part of the experiment secrets and the repository name as part of its configuration section using the humio_repository key.

See https://docs.humio.com/api/using-the-search-api-with-humio/#query

Signature:

def search_query(qs: str,\n                 start: Union[int, str] = '24hours',\n                 end: Union[int, str] = 'now',\n                 tz_offset: int = 0,\n                 params: Union[str, Dict[str, str], NoneType] = None,\n                 result_as_text: Optional[bool] = False,\n                 configuration: Optional[Dict[str, Dict[str, str]]] = None,\n                 secrets: Optional[Dict[str, Dict[str, str]]] = None) -> Any:\n    pass\n

Arguments:

Name Type Default Required qs string Yes start object \u201c24hours\u201d No end object \u201cnow\u201d No tz_offset integer 0 No params object null No result_as_text object false No

Usage:

JSONYAML
{\n\"name\": \"search-query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.probes\",\n\"func\": \"search_query\",\n\"arguments\": {\n\"qs\": \"\"\n}\n}\n}\n
name: search-query\nprovider:\narguments:\nqs: ''\nfunc: search_query\nmodule: chaoshumio.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/humio/#tolerances","title":"tolerances","text":""},{"location":"drivers/humio/#field_value_above","title":"field_value_above","text":"Type tolerance Module chaoshumio.tolerances Name field_value_above Return boolean

Validate value at the given field to be above the given lower limit.

Signature:

def field_value_above(value: Any = None,\n                      field: Optional[str] = None,\n                      lower: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No lower number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_above\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-above\nprovider:\nfunc: field_value_above\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/humio/#field_value_between","title":"field_value_between","text":"Type tolerance Module chaoshumio.tolerances Name field_value_between Return boolean

Validate value at the given field to be between the lower/upper boundaries.

Signature:

def field_value_between(value: Any = None,\n                        field: Optional[str] = None,\n                        lower: float = 0.0,\n                        upper: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No lower number 0.0 No upper number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-between\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_between\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-between\nprovider:\nfunc: field_value_between\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/humio/#field_value_under","title":"field_value_under","text":"Type tolerance Module chaoshumio.tolerances Name field_value_under Return boolean

Validate value at the given field to be under the given upper limit.

Signature:

def field_value_under(value: Any = None,\n                      field: Optional[str] = None,\n                      upper: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required value object null No field object null No upper number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"field-value-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoshumio.tolerances\",\n\"func\": \"field_value_under\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: field-value-under\nprovider:\nfunc: field_value_under\nmodule: chaoshumio.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/istio/","title":"Extension chaosistio","text":"Version 0.3.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-istio

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/istio/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-istio\n
"},{"location":"drivers/istio/#usage","title":"Usage","text":"

Below is an example of using this extension to inject a delay of 5 seconds to a specific user.

Note this example can be applied against the bookinfo Istio sample application.

To run it, simple set the KUBERNETES_CONTEXT environment variable to the target cluster and ensure your local kubeconfig is properly populated for that context. Set also the PRODUCT_PAGE_SERVICE_BASE_URL to the address of the Istio gateway.

For instance:

$ export PRODUCT_PAGE_SERVICE_BASE_URL=$(kubectl get po -l istio=ingressgateway -n istio-system -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==\"http2\")].nodePort}')\n
{\n\"title\": \"Network latency does not impact our users\",\n\"description\": \"Using Istio fault injection capability, let's explore how latency impacts a single user\",\n\"configuration\": {\n\"product_page_url\": {\n\"type\": \"env\",\n\"key\": \"PRODUCT_PAGE_SERVICE_BASE_URL\"\n}\n},\n\"secrets\": {\n\"istio\": {\n\"KUBERNETES_CONTEXT\": {\n\"type\": \"env\",\n\"key\": \"KUBERNETES_CONTEXT\"\n}\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Our service should respond under 1 second\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"sign-in-as-jason\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"curl\",\n\"arguments\": \"-v -X POST -d 'username=jason&passwd=' -c /tmp/cookie.txt --silent ${product_page_url}/login\"\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-productpage-for-jason-in-due-time\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"curl\",\n\"arguments\": \"-v --connect-timeout 1 --max-time 1 -b /tmp/cookie.txt --silent ${product_page_url}/productpage\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"inject-fault-for-jason-only\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_delay_fault\",\n\"secrets\": [\"istio\"],\n\"arguments\": {\n\"virtual_service_name\": \"reviews\",\n\"fixed_delay\": \"5s\",\n\"percentage\": {\n\"value\":  100.0\n},\n\"routes\": [\n{\n\"destination\": {\n\"host\": \"reviews\",\n\"subset\": \"v2\"\n}\n}\n]\n}\n},\n\"pauses\": {\n\"after\": 2\n}\n}\n],\n\"rollbacks\": [\n{\n\"type\": \"action\",\n\"name\": \"remove-fault-for-jason-only\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_delay_fault\",\n\"secrets\": [\"istio\"],\n\"arguments\": {\n\"virtual_service_name\": \"reviews\",\n\"routes\": [\n{\n\"destination\": {\n\"host\": \"reviews\",\n\"subset\": \"v2\"\n}\n}\n]\n}\n}\n}\n]\n}\n

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/istio/#configuration","title":"Configuration","text":"

This extension needs you specify how to connect to the Kubernetes cluster. This can be done by setting the KUBERNETES_CONTEXT in the secrets payload.

"},{"location":"drivers/istio/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/istio/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/istio/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/istio/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/istio/#fault","title":"fault","text":""},{"location":"drivers/istio/#add_abort_fault","title":"add_abort_fault","text":"Type action Module chaosistio.fault.actions Name add_abort_fault Return mapping

Abort requests early by the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Abort

Signature:

def add_abort_fault(\n        virtual_service_name: str,\n        http_status: int,\n        routes: List[Dict[str, str]],\n        percentage: float = None,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes http_status integer Yes routes list Yes percentage number null No ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"add-abort-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_abort_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"http_status\": 0,\n\"routes\": []\n}\n}\n}\n
name: add-abort-fault\nprovider:\narguments:\nhttp_status: 0\nroutes: []\nvirtual_service_name: ''\nfunc: add_abort_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#add_delay_fault","title":"add_delay_fault","text":"Type action Module chaosistio.fault.actions Name add_delay_fault Return mapping

Add delay to the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Delay

Signature:

def add_delay_fault(\n        virtual_service_name: str,\n        fixed_delay: str,\n        routes: List[Dict[str, str]],\n        percentage: float = None,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes fixed_delay string Yes routes list Yes percentage number null No ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"add-delay-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"add_delay_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"fixed_delay\": \"\",\n\"routes\": []\n}\n}\n}\n
name: add-delay-fault\nprovider:\narguments:\nfixed_delay: ''\nroutes: []\nvirtual_service_name: ''\nfunc: add_delay_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#get_virtual_service","title":"get_virtual_service","text":"Type probe Module chaosistio.fault.probes Name get_virtual_service Return mapping

Get a virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#VirtualService

Signature:

def get_virtual_service(\n        virtual_service_name: str,\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-virtual-service\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.probes\",\n\"func\": \"get_virtual_service\",\n\"arguments\": {\n\"virtual_service_name\": \"\"\n}\n}\n}\n
name: get-virtual-service\nprovider:\narguments:\nvirtual_service_name: ''\nfunc: get_virtual_service\nmodule: chaosistio.fault.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/istio/#remove_abort_fault","title":"remove_abort_fault","text":"Type action Module chaosistio.fault.actions Name remove_abort_fault Return mapping

Remove abort request faults from the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Abort

Signature:

def remove_abort_fault(\n        virtual_service_name: str,\n        routes: List[Dict[str, str]],\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-abort-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_abort_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: remove-abort-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: remove_abort_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#remove_delay_fault","title":"remove_delay_fault","text":"Type action Module chaosistio.fault.actions Name remove_delay_fault Return mapping

Remove delay from the virtual service identified by name

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection-Delay

Signature:

def remove_delay_fault(\n        virtual_service_name: str,\n        routes: List[Dict[str, str]],\n        ns: str = 'default',\n        version: str = 'networking.istio.io/v1alpha3',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-delay-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"remove_delay_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: remove-delay-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: remove_delay_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#set_fault","title":"set_fault","text":"Type action Module chaosistio.fault.actions Name set_fault Return mapping

Setfault injection on the virtual service identified by name

The fault argument must be the object passed as the spec property of a virtual service resource.

If a fault already exists, it is updated with the new specification.

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection

Signature:

def set_fault(virtual_service_name: str,\n              routes: List[Dict[str, str]],\n              fault: Dict[str, Any],\n              ns: str = 'default',\n              version: str = 'networking.istio.io/v1alpha3',\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes fault mapping Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"set-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"set_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": [],\n\"fault\": {}\n}\n}\n}\n
name: set-fault\nprovider:\narguments:\nfault: {}\nroutes: []\nvirtual_service_name: ''\nfunc: set_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/istio/#unset_fault","title":"unset_fault","text":"Type action Module chaosistio.fault.actions Name unset_fault Return mapping

Unset fault injection from the virtual service identified by name

The fault argument must be the object passed as the spec property of a virtual service resource.

See https://istio.io/docs/reference/config/istio.networking.v1alpha3/#HTTPFaultInjection

Signature:

def unset_fault(virtual_service_name: str,\n                routes: List[Dict[str, str]],\n                ns: str = 'default',\n                version: str = 'networking.istio.io/v1alpha3',\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required virtual_service_name string Yes routes list Yes ns string \u201cdefault\u201d No version string \u201cnetworking.istio.io/v1alpha3\u201d No

Usage:

JSONYAML
{\n\"name\": \"unset-fault\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosistio.fault.actions\",\n\"func\": \"unset_fault\",\n\"arguments\": {\n\"virtual_service_name\": \"\",\n\"routes\": []\n}\n}\n}\n
name: unset-fault\nprovider:\narguments:\nroutes: []\nvirtual_service_name: ''\nfunc: unset_fault\nmodule: chaosistio.fault.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/","title":"Extension chaosk6","text":"Version 0.2.0 Repository https://github.com/k6io/chaostoolkit-k6

N/A

"},{"location":"drivers/k6/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/k6/#actions","title":"actions","text":""},{"location":"drivers/k6/#run_script","title":"run_script","text":"Type action Module chaosk6.actions Name run_script Return None

Run an arbitrary k6 script with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 \u00b1 50.

\u2013 scriptPath : str Full path to the k6 test script vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def run_script(scriptPath: str = None, vus: int = 1, duration: str = '1s'):\n    pass\n

Arguments:

Name Type Default Required scriptPath string null No vus integer 1 No duration string \u201c1s\u201d No

Usage:

{\n\"name\": \"run-script\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.actions\",\n\"func\": \"run_script\"\n}\n}\n
name: run-script\nprovider:\nfunc: run_script\nmodule: chaosk6.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/#stress_endpoint","title":"stress_endpoint","text":"Type action Module chaosk6.actions Name stress_endpoint Return None

Stress a single endpoint with a configurable amount of VUs and duration. Depending on the specs of the attacking machine, possible VU amount may vary. For a non-customized 2019 Macbook Pro, it will cap around 250 \u00b1 50.

\u2013 endpoint : str The URL to the endpoint you want to stress, including the scheme prefix. vus : int Amount of virtual users to run the test with duration : str Duration, written as a string, ie: 1h2m3s etc

Signature:

def stress_endpoint(endpoint: str = None, vus: int = 1, duration: str = '1s'):\n    pass\n

Arguments:

Name Type Default Required endpoint string null No vus integer 1 No duration string \u201c1s\u201d No

Usage:

{\n\"name\": \"stress-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.actions\",\n\"func\": \"stress_endpoint\"\n}\n}\n
name: stress-endpoint\nprovider:\nfunc: stress_endpoint\nmodule: chaosk6.actions\ntype: python\ntype: action\n
"},{"location":"drivers/k6/#probes","title":"probes","text":""},{"location":"drivers/k6/#http","title":"http","text":"Type probe Module chaosk6.probes Name http Return boolean

Probe an endpoint to make sure it responds to an http request with the expected HTTP status code. Depending on the endpoint and your payload, this action might be destructive. Use with caution.

\u2013 endpoint : str The URL to the endpoint to probe method : str A valid http request method name, like GET, POST, PUT, DELETE, OPTIONS, or PATCH status : int The expected HTTP Response status code. vus : int The amount of concurrent virtual users accessing the endpoint duration : str How long to probe the endpoint. Expressed as a duration string, i.e \u201c20s\u201d, \u201c1m\u201d, \u201c1h\u201d etc. timeout : int Timeout duration for http requests. Defaults to 1 second

Signature:

def http(endpoint: str,\n         method: str = 'GET',\n         status: int = 200,\n         body: str = '',\n         headers: dict = {},\n         vus: int = 1,\n         duration: str = '',\n         debug: bool = False,\n         timeout: int = 1) -> bool:\n    pass\n

Arguments:

Name Type Default Required endpoint string Yes method string \u201cGET\u201d No status integer 200 No body string \u201d\u201c No headers mapping {} No vus integer 1 No duration string \u201d\u201c No debug boolean false No timeout integer 1 No

Usage:

{\n\"name\": \"http\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk6.probes\",\n\"func\": \"http\",\n\"arguments\": {\n\"endpoint\": \"\"\n}\n}\n}\n
name: http\nprovider:\narguments:\nendpoint: ''\nfunc: http\nmodule: chaosk6.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/","title":"Extension chaosk8s","text":"Version 0.28.0 Repository https://github.com/chaostoolkit/chaostoolkit-kubernetes

This project contains activities, such as probes and actions, you can call from your experiment through the Chaos Toolkit to perform Chaos Engineering against the Kubernetes API: killing a pod, removing a statefulset or node\u2026

"},{"location":"drivers/kubernetes/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kubernetes\n
"},{"location":"drivers/kubernetes/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"title\": \"Do we remain available in face of pod going down?\",\n\"description\": \"We expect Kubernetes to handle the situation gracefully when a pod goes down\",\n\"tags\": [\"kubernetes\"],\n\"steady-state-hypothesis\": {\n\"title\": \"Verifying service remains healthy\",\n\"probes\": [\n{\n\"name\": \"all-our-microservices-should-be-healthy\",\n\"type\": \"probe\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"myapp\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"terminate-db-pod\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"label_selector\": \"app=my-app\",\n\"name_pattern\": \"my-app-[0-9]$\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n}\n]\n}\n

That\u2019s it! Notice how the action gives you the way to kill one pod randomly.

Please explore the documentation to see existing probes and actions.

"},{"location":"drivers/kubernetes/#configuration","title":"Configuration","text":""},{"location":"drivers/kubernetes/#use-kubeconfig","title":"Use ~/.kube/config","text":"

If you have a valid entry in your ~/.kube/config file for the cluster you want to target, then there is nothing to be done.

You may specify KUBECONFIG to specify a different location.

$ export KUBECONFIG=/tmp/my-config\n
"},{"location":"drivers/kubernetes/#specify-the-kubernetes-context","title":"Specify the Kubernetes context","text":"

Quite often, your Kubernetes configuration contains several entries and you need to define the one to use as a default context when not it isn\u2019t explicitely provided.

You may of course change your default using kubectl config use-context KUBERNETES_CONTEXT but you can also be explicit in your experiment as follows:

{\n\"title\": \"Do we remain available in face of pod going down?\",\n\"description\": \"We expect Kubernetes to handle the situation gracefully when a pod goes down\",\n\"tags\": [\"kubernetes\"],\n\"secrets\": {\n\"k8s\": {\n\"KUBERNETES_CONTEXT\": \"...\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Verifying service remains healthy\",\n\"probes\": [\n{\n\"name\": \"all-our-microservices-should-be-healthy\",\n\"type\": \"probe\",\n\"tolerance\": true,\n\"secrets\": [\"k8s\"],\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"myapp\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"terminate-db-pod\",\n\"secrets\": [\"k8s\"],\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"label_selector\": \"app=my-app\",\n\"name_pattern\": \"my-app-[0-9]$\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n}\n]\n}\n

You need to specify the KUBERNETES_CONTEXT secret key to the name of the context you want the experiment to use. Make sure to also inform the actions and probes about the secret entries they should be passed \"secrets\": [\"k8s\"].

"},{"location":"drivers/kubernetes/#use-a-pods-service-account","title":"Use a Pod\u2019s service account","text":"

When running from a pod (not your local machine or a CI for instance), the ./.kube/config file does not exist. Instead, the credentials can be found at /var/run/secrets/kubernetes.io/serviceaccount/token.

To let the extension know about this, simply set CHAOSTOOLKIT_IN_POD from the environment variable of the pod specification:

env:\n- name: CHAOSTOOLKIT_IN_POD\nvalue: \"true\"\n
"},{"location":"drivers/kubernetes/#pass-all-credentials-in-the-experiment","title":"Pass all credentials in the experiment","text":"

Finally, you may pass explicitely all required credentials information to the experiment as follows:

"},{"location":"drivers/kubernetes/#using-an-api-key","title":"Using an API key","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_API_KEY\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#using-a-usernamepassword","title":"Using a username/password","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_USERNAME\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n},\n\"KUBERNETES_PASSWORD\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#using-a-tls-keycertificate","title":"Using a TLS key/certificate","text":"
{\n\"secrets\": {\n\"kubernetes\": {\n\"KUBERNETES_HOST\": \"http://somehost\",\n\"KUBERNETES_CERT_FILE\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n},\n\"KUBERNETES_KEY_FILE\": {\n\"type\": \"env\",\n\"key\": \"SOME_ENV_VAR\"\n}\n}\n}\n}\n
"},{"location":"drivers/kubernetes/#managed-kubernetes-clusters-authentication","title":"Managed Kubernetes Clusters Authentication","text":"

On some managed Kubernetes clusters, you also need to authenticate against the platform itself because the Kubernetes authentication is delegated to it.

"},{"location":"drivers/kubernetes/#google-cloud-platform","title":"Google Cloud Platform","text":"

In addition to your Kubernetes credentials (via the ~/.kube/config file), you need to authenticate against the Google Cloud Platform itself. Usually this is done via:

$ gcloud auth login\n

But can also be achieved by defining the GOOGLE_APPLICATION_CREDENTIALS environment variable.

"},{"location":"drivers/kubernetes/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/kubernetes/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/kubernetes/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/kubernetes/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/kubernetes/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/kubernetes/#actions","title":"actions","text":""},{"location":"drivers/kubernetes/#kill_microservice","title":"kill_microservice","text":"Type action Module chaosk8s.actions Name kill_microservice Return None

!!!DEPRECATED!!!

Signature:

def kill_microservice(name: str,\n                      ns: str = 'default',\n                      label_selector: str = 'name in ({name})',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"kill-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"kill_microservice\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: kill-microservice\nprovider:\narguments:\nname: ''\nfunc: kill_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_service_endpoint","title":"remove_service_endpoint","text":"Type action Module chaosk8s.actions Name remove_service_endpoint Return None

!!!DEPRECATED!!!

Signature:

def remove_service_endpoint(name: str,\n                            ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-service-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"remove_service_endpoint\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: remove-service-endpoint\nprovider:\narguments:\nname: ''\nfunc: remove_service_endpoint\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_microservice","title":"scale_microservice","text":"Type action Module chaosk8s.actions Name scale_microservice Return None

!!!DEPRECATED!!!

Signature:

def scale_microservice(name: str,\n                       replicas: int,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"scale_microservice\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-microservice\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#start_microservice","title":"start_microservice","text":"Type action Module chaosk8s.actions Name start_microservice Return None

!!!DEPRECATED!!!

Signature:

def start_microservice(spec_path: str,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"start-microservice\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"start_microservice\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: start-microservice\nprovider:\narguments:\nspec_path: ''\nfunc: start_microservice\nmodule: chaosk8s.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#crd","title":"crd","text":""},{"location":"drivers/kubernetes/#create_cluster_custom_object","title":"create_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name create_cluster_custom_object Return mapping

Delete a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"create-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"create_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: create-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: create_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_custom_object","title":"create_custom_object","text":"Type action Module chaosk8s.crd.actions Name create_custom_object Return mapping

Create a custom object in the given namespace. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        ns: str = 'default',\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes ns string \u201cdefault\u201d No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"create-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"create_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: create-custom-object\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: create_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_cluster_custom_object","title":"delete_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name delete_cluster_custom_object Return mapping

Delete a custom object cluster wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"delete_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: delete-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: delete_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_custom_object","title":"delete_custom_object","text":"Type action Module chaosk8s.crd.actions Name delete_custom_object Return mapping

Create a custom object cluster wide. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"delete-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"delete_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: delete-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: delete_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#get_cluster_custom_object","title":"get_cluster_custom_object","text":"Type probe Module chaosk8s.crd.probes Name get_cluster_custom_object Return mapping

Get a custom object cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes

Usage:

JSONYAML
{\n\"name\": \"get-cluster-custom-object\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"get_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: get-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: get_cluster_custom_object\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#get_custom_object","title":"get_custom_object","text":"Type probe Module chaosk8s.crd.probes Name get_custom_object Return mapping

Get a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"get-custom-object\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"get_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: get-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: get_custom_object\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#list_cluster_custom_objects","title":"list_cluster_custom_objects","text":"Type probe Module chaosk8s.crd.probes Name list_cluster_custom_objects Return list

List custom objects cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_cluster_custom_objects(\n        group: str,\n        version: str,\n        plural: str,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes

Usage:

JSONYAML
{\n\"name\": \"list-cluster-custom-objects\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"list_cluster_custom_objects\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: list-cluster-custom-objects\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: list_cluster_custom_objects\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#list_custom_objects","title":"list_custom_objects","text":"Type probe Module chaosk8s.crd.probes Name list_custom_objects Return list

List custom objects in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_custom_objects(\n        group: str,\n        version: str,\n        plural: str,\n        ns: str = 'default',\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"list-custom-objects\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.probes\",\n\"func\": \"list_custom_objects\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\"\n}\n}\n}\n
name: list-custom-objects\nprovider:\narguments:\ngroup: ''\nplural: ''\nversion: ''\nfunc: list_custom_objects\nmodule: chaosk8s.crd.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#patch_cluster_custom_object","title":"patch_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name patch_cluster_custom_object Return mapping

Patch a custom object cluster-wide. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"patch-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"patch_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: patch-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: patch_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#patch_custom_object","title":"patch_custom_object","text":"Type action Module chaosk8s.crd.actions Name patch_custom_object Return mapping

Patch a custom object in the given namespace. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"patch-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"patch_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: patch-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: patch_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#replace_cluster_custom_object","title":"replace_cluster_custom_object","text":"Type action Module chaosk8s.crd.actions Name replace_cluster_custom_object Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_cluster_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"replace-cluster-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"replace_cluster_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: replace-cluster-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: replace_cluster_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#replace_custom_object","title":"replace_custom_object","text":"Type action Module chaosk8s.crd.actions Name replace_custom_object Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_custom_object(\n        group: str,\n        version: str,\n        plural: str,\n        name: str,\n        ns: str = 'default',\n        force: bool = False,\n        resource: Dict[str, Any] = None,\n        resource_as_yaml_file: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required group string Yes version string Yes plural string Yes name string Yes ns string \u201cdefault\u201d No force boolean false No resource mapping null No resource_as_yaml_file string null No

Usage:

JSONYAML
{\n\"name\": \"replace-custom-object\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.crd.actions\",\n\"func\": \"replace_custom_object\",\n\"arguments\": {\n\"group\": \"\",\n\"version\": \"\",\n\"plural\": \"\",\n\"name\": \"\"\n}\n}\n}\n
name: replace-custom-object\nprovider:\narguments:\ngroup: ''\nname: ''\nplural: ''\nversion: ''\nfunc: replace_custom_object\nmodule: chaosk8s.crd.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deployment","title":"deployment","text":""},{"location":"drivers/kubernetes/#create_deployment","title":"create_deployment","text":"Type action Module chaosk8s.deployment.actions Name create_deployment Return None

Create a deployment described by the deployment config, which must be the path to the JSON or YAML representation of the deployment.

Signature:

def create_deployment(spec_path: str,\n                      ns: str = 'default',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"create_deployment\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-deployment\nprovider:\narguments:\nspec_path: ''\nfunc: create_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_deployment","title":"delete_deployment","text":"Type action Module chaosk8s.deployment.actions Name delete_deployment Return None

Delete a deployment by name or label_selector in the namespace ns.

The deployment is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the deployments will be deleted in the namespace.

Signature:

def delete_deployment(name: str = None,\n                      ns: str = 'default',\n                      label_selector: str = None,\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"delete-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"delete_deployment\"\n}\n}\n
name: delete-deployment\nprovider:\nfunc: delete_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deployment_available_and_healthy","title":"deployment_available_and_healthy","text":"Type probe Module chaosk8s.deployment.probes Name deployment_available_and_healthy Return Optional[bool]

Lookup a deployment by name in the namespace ns.

The selected resources are matched by the given label_selector.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_unavailable is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_available_and_healthy(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        raise_on_unavailable: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No raise_on_unavailable boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-available-and-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_available_and_healthy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-available-and-healthy\nprovider:\narguments:\nname: ''\nfunc: deployment_available_and_healthy\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_fully_available","title":"deployment_fully_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_fully_available Return Optional[bool]

Wait until all the deployment expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_fully_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        timeout: int = 30,\n        raise_on_not_fully_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_not_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_fully_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_not_fully_available","title":"deployment_not_fully_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_not_fully_available Return Optional[bool]

Wait until the deployment gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_not_fully_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        timeout: int = 30,\n        raise_on_fully_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_not_fully_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_partially_available","title":"deployment_partially_available","text":"Type probe Module chaosk8s.deployment.probes Name deployment_partially_available Return Optional[bool]

Check whether if the given deployment state is ready or at-least partially ready. Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_not_partially_available is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_partially_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        raise_on_not_partially_available: bool = True,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No raise_on_not_partially_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"deployment-partially-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.probes\",\n\"func\": \"deployment_partially_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-partially-available\nprovider:\narguments:\nname: ''\nfunc: deployment_partially_available\nmodule: chaosk8s.deployment.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#rollout_deployment","title":"rollout_deployment","text":"Type action Module chaosk8s.deployment.actions Name rollout_deployment Return None

Rolling the deployment. The name is the name of the deployment.

Signature:

def rollout_deployment(name: str = None,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"rollout-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"rollout_deployment\"\n}\n}\n
name: rollout-deployment\nprovider:\nfunc: rollout_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_deployment","title":"scale_deployment","text":"Type action Module chaosk8s.deployment.actions Name scale_deployment Return None

Scale a deployment up or down. The name is the name of the deployment.

Signature:

def scale_deployment(name: str,\n                     replicas: int,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-deployment\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.deployment.actions\",\n\"func\": \"scale_deployment\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-deployment\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_deployment\nmodule: chaosk8s.deployment.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#networking","title":"networking","text":""},{"location":"drivers/kubernetes/#allow_dns_access","title":"allow_dns_access","text":"Type action Module chaosk8s.networking.actions Name allow_dns_access Return None

Convenient helper rule to DNS access from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def allow_dns_access(label_selectors: Dict[str, Any] = None,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"allow-dns-access\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"allow_dns_access\"\n}\n}\n
name: allow-dns-access\nprovider:\nfunc: allow_dns_access\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_network_policy","title":"create_network_policy","text":"Type action Module chaosk8s.networking.actions Name create_network_policy Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def create_network_policy(spec: Dict[str, Any] = None,\n                          spec_path: str = None,\n                          ns: str = 'default',\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec mapping null No spec_path string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-network-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"create_network_policy\"\n}\n}\n
name: create-network-policy\nprovider:\nfunc: create_network_policy\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deny_all_egress","title":"deny_all_egress","text":"Type action Module chaosk8s.networking.actions Name deny_all_egress Return None

Convenient helper rule to deny all egress network from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_egress(label_selectors: Dict[str, Any] = None,\n                    ns: str = 'default',\n                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"deny-all-egress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"deny_all_egress\"\n}\n}\n
name: deny-all-egress\nprovider:\nfunc: deny_all_egress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#deny_all_ingress","title":"deny_all_ingress","text":"Type action Module chaosk8s.networking.actions Name deny_all_ingress Return None

Convenient helper policy to deny ingress network to all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_ingress(label_selectors: Dict[str, Any] = None,\n                     ns: str = 'default',\n                     secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selectors mapping null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"deny-all-ingress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"deny_all_ingress\"\n}\n}\n
name: deny-all-ingress\nprovider:\nfunc: deny_all_ingress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_allow_dns_access","title":"remove_allow_dns_access","text":"Type action Module chaosk8s.networking.actions Name remove_allow_dns_access Return None

Remove the rule set by the allow_dns_access action.

Signature:

def remove_allow_dns_access(ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-allow-dns-access\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_allow_dns_access\"\n}\n}\n
name: remove-allow-dns-access\nprovider:\nfunc: remove_allow_dns_access\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_deny_all_egress","title":"remove_deny_all_egress","text":"Type action Module chaosk8s.networking.actions Name remove_deny_all_egress Return None

Remove the rule set by the deny_all_egress action.

Signature:

def remove_deny_all_egress(ns: str = 'default',\n                           secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-deny-all-egress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_deny_all_egress\"\n}\n}\n
name: remove-deny-all-egress\nprovider:\nfunc: remove_deny_all_egress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_deny_all_ingress","title":"remove_deny_all_ingress","text":"Type action Module chaosk8s.networking.actions Name remove_deny_all_ingress Return None

Remove the rule set by the deny_all_ingress action.

Signature:

def remove_deny_all_ingress(ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-deny-all-ingress\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_deny_all_ingress\"\n}\n}\n
name: remove-deny-all-ingress\nprovider:\nfunc: remove_deny_all_ingress\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_network_policy","title":"remove_network_policy","text":"Type action Module chaosk8s.networking.actions Name remove_network_policy Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def remove_network_policy(name: str,\n                          ns: str = 'default',\n                          secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"remove-network-policy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.networking.actions\",\n\"func\": \"remove_network_policy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: remove-network-policy\nprovider:\narguments:\nname: ''\nfunc: remove_network_policy\nmodule: chaosk8s.networking.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#node","title":"node","text":""},{"location":"drivers/kubernetes/#cordon_node","title":"cordon_node","text":"Type action Module chaosk8s.node.actions Name cordon_node Return None

Cordon nodes matching the given label or name, so that no pods are scheduled on them any longer.

Signature:

def cordon_node(name: str = None,\n                label_selector: str = None,\n                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"cordon-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"cordon_node\"\n}\n}\n
name: cordon-node\nprovider:\nfunc: cordon_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#create_node","title":"create_node","text":"Type action Module chaosk8s.node.actions Name create_node Return kubernetes.client.models.v1_node.V1Node

Create one new node in the cluster.

Due to the way things work on certain cloud providers, you won\u2019t be able to use this meaningfully on them. For instance on GCE, this will likely fail.

See also: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency

Signature:

def create_node(\n    meta: Dict[str, Any] = None,\n    spec: Dict[str, Any] = None,\n    secrets: Dict[str, Dict[str, str]] = None\n) -> kubernetes.client.models.v1_node.V1Node:\n    pass\n

Arguments:

Name Type Default Required meta mapping null No spec mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"create_node\"\n}\n}\n
name: create-node\nprovider:\nfunc: create_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_nodes","title":"delete_nodes","text":"Type action Module chaosk8s.node.actions Name delete_nodes Return None

Delete nodes gracefully. Select the appropriate nodes by label.

Nodes are not drained beforehand so we can see how cluster behaves. Nodes cannot be restarted, they are really deleted. Please be careful when using this action.

On certain cloud providers, you also need to delete the underneath VM instance as well afterwards. This is the case on GCE for instance.

If all is set to True, all nodes will be terminated. If rand is set to True, one random node will be terminated. If \u0300count is set to a positive number, only a upto count nodes (randomly picked) will be terminated. Otherwise, the first retrieved node will be terminated.

Signature:

def delete_nodes(label_selector: str = None,\n                 all: bool = False,\n                 rand: bool = False,\n                 count: int = None,\n                 grace_period_seconds: int = None,\n                 secrets: Dict[str, Dict[str, str]] = None,\n                 pod_label_selector: str = None,\n                 pod_namespace: str = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No all boolean false No rand boolean false No count integer null No grace_period_seconds integer null No pod_label_selector string null No pod_namespace string null No

Usage:

JSONYAML
{\n\"name\": \"delete-nodes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"delete_nodes\"\n}\n}\n
name: delete-nodes\nprovider:\nfunc: delete_nodes\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#drain_nodes","title":"drain_nodes","text":"Type action Module chaosk8s.node.actions Name drain_nodes Return boolean

Drain nodes matching the given label or name, so that no pods are scheduled on them any longer and running pods are evicted.

It does a similar job to kubectl drain --ignore-daemonsets or kubectl drain --delete-local-data --ignore-daemonsets if delete_pods_with_local_storage is set to True. There is no equivalent to the kubectl drain --force flag.

You probably want to call uncordon from in your experiment\u2019s rollbacks.

Signature:

def drain_nodes(name: str = None,\n                label_selector: str = None,\n                delete_pods_with_local_storage: bool = False,\n                timeout: int = 120,\n                secrets: Dict[str, Dict[str, str]] = None,\n                count: int = None,\n                pod_label_selector: str = None,\n                pod_namespace: str = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No delete_pods_with_local_storage boolean false No timeout integer 120 No count integer null No pod_label_selector string null No pod_namespace string null No

Usage:

JSONYAML
{\n\"name\": \"drain-nodes\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"drain_nodes\"\n}\n}\n
name: drain-nodes\nprovider:\nfunc: drain_nodes\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#get_nodes","title":"get_nodes","text":"Type probe Module chaosk8s.node.probes Name get_nodes Return None

List all Kubernetes worker nodes in your cluster. You may filter nodes by specifying a label selector.

Signature:

def get_nodes(label_selector: str = None,\n              configuration: Dict[str, Dict[str, str]] = None,\n              secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"get-nodes\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.probes\",\n\"func\": \"get_nodes\"\n}\n}\n
name: get-nodes\nprovider:\nfunc: get_nodes\nmodule: chaosk8s.node.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#uncordon_node","title":"uncordon_node","text":"Type action Module chaosk8s.node.actions Name uncordon_node Return None

Uncordon nodes matching the given label name, so that pods can be scheduled on them again.

Signature:

def uncordon_node(name: str = None,\n                  label_selector: str = None,\n                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"uncordon-node\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.node.actions\",\n\"func\": \"uncordon_node\"\n}\n}\n
name: uncordon-node\nprovider:\nfunc: uncordon_node\nmodule: chaosk8s.node.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#pod","title":"pod","text":""},{"location":"drivers/kubernetes/#count_min_pods","title":"count_min_pods","text":"Type probe Module chaosk8s.pod.probes Name count_min_pods Return boolean

Check if minimum number of pods are running.

Signature:

def count_min_pods(label_selector: str,\n                   phase: str = 'Running',\n                   min_count: int = 2,\n                   ns: str = 'default',\n                   secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No min_count integer 2 No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"count-min-pods\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"count_min_pods\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: count-min-pods\nprovider:\narguments:\nlabel_selector: ''\nfunc: count_min_pods\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#count_pods","title":"count_pods","text":"Type probe Module chaosk8s.pod.probes Name count_pods Return integer

Count the number of pods matching the given selector in a given phase, if one is given.

Signature:

def count_pods(label_selector: str,\n               phase: str = None,\n               ns: str = 'default',\n               secrets: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string null No ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"count-pods\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"count_pods\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: count-pods\nprovider:\narguments:\nlabel_selector: ''\nfunc: count_pods\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#exec_in_pods","title":"exec_in_pods","text":"Type action Module chaosk8s.pod.actions Name exec_in_pods Return list

Execute the command cmd in the specified pod\u2019s container. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected for termination.

If all is set to True, all matching pods will be affected.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods affected. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be affected. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be affected Otherwise, the first retrieved n pods will be used

The cmd should be a string or a sequence of program arguments. Providing a sequence of arguments is generally preferred, as it allows the action to take care of any required escaping and quoting (e.g. to permit spaces in the arguments). If passing a single string it will be split automatically.

Signature:

def exec_in_pods(\n        cmd: Union[str, List[str]],\n        label_selector: str = None,\n        name_pattern: str = None,\n        all: bool = False,\n        rand: bool = False,\n        mode: str = 'fixed',\n        qty: int = 1,\n        ns: str = 'default',\n        order: str = 'alphabetic',\n        container_name: str = None,\n        request_timeout: int = 60,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required cmd object Yes label_selector string null No name_pattern string null No all boolean false No rand boolean false No mode string \u201cfixed\u201d No qty integer 1 No ns string \u201cdefault\u201d No order string \u201calphabetic\u201d No container_name string null No request_timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"exec-in-pods\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"exec_in_pods\",\n\"arguments\": {\n\"cmd\": null\n}\n}\n}\n
name: exec-in-pods\nprovider:\narguments:\ncmd: null\nfunc: exec_in_pods\nmodule: chaosk8s.pod.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#pod_is_not_available","title":"pod_is_not_available","text":"Type probe Module chaosk8s.pod.probes Name pod_is_not_available Return boolean

Lookup pods with a name label set to the given name in the specified ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when one of the pods with the specified name is in the \"Running\" phase.

Signature:

def pod_is_not_available(name: str,\n                         ns: str = 'default',\n                         label_selector: str = 'name in ({name})',\n                         raise_on_is_available: bool = True,\n                         secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No raise_on_is_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"pod-is-not-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pod_is_not_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: pod-is-not-available\nprovider:\narguments:\nname: ''\nfunc: pod_is_not_available\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_in_conditions","title":"pods_in_conditions","text":"Type probe Module chaosk8s.pod.probes Name pods_in_conditions Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed if one of the given conditions type/status is not as expected unless raise_on_invalid_conditions. In that case, returns False.

Signature:

def pods_in_conditions(label_selector: str,\n                       conditions: List[Dict[str, str]],\n                       ns: str = 'default',\n                       raise_on_invalid_conditions: bool = True,\n                       secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes conditions list Yes ns string \u201cdefault\u201d No raise_on_invalid_conditions boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-in-conditions\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_in_conditions\",\n\"arguments\": {\n\"label_selector\": \"\",\n\"conditions\": []\n}\n}\n}\n
name: pods-in-conditions\nprovider:\narguments:\nconditions: []\nlabel_selector: ''\nfunc: pods_in_conditions\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_in_phase","title":"pods_in_phase","text":"Type probe Module chaosk8s.pod.probes Name pods_in_phase Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected unless raise_on_invalid_phase. In that case, returns False.

Signature:

def pods_in_phase(label_selector: str,\n                  phase: str = 'Running',\n                  ns: str = 'default',\n                  raise_on_invalid_phase: bool = True,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No ns string \u201cdefault\u201d No raise_on_invalid_phase boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-in-phase\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_in_phase\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: pods-in-phase\nprovider:\narguments:\nlabel_selector: ''\nfunc: pods_in_phase\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#pods_not_in_phase","title":"pods_not_in_phase","text":"Type probe Module chaosk8s.pod.probes Name pods_not_in_phase Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the pod is in the given phase and should not have, unless raise_on_in_phase. In that case, returns False.

Signature:

def pods_not_in_phase(label_selector: str,\n                      phase: str = 'Running',\n                      ns: str = 'default',\n                      raise_on_in_phase: bool = True,\n                      secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required label_selector string Yes phase string \u201cRunning\u201d No ns string \u201cdefault\u201d No raise_on_in_phase boolean true No

Usage:

JSONYAML
{\n\"name\": \"pods-not-in-phase\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"pods_not_in_phase\",\n\"arguments\": {\n\"label_selector\": \"\"\n}\n}\n}\n
name: pods-not-in-phase\nprovider:\narguments:\nlabel_selector: ''\nfunc: pods_not_in_phase\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#read_pod_logs","title":"read_pod_logs","text":"Type probe Module chaosk8s.pod.probes Name read_pod_logs Return mapping

Fetch logs for all the pods with the label \"name\" set to name and return a dictionary with the keys being the pod\u2019s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod\u2019s incarnation, if any.

Signature:

def read_pod_logs(name: str = None,\n                  last: Optional[str] = None,\n                  ns: str = 'default',\n                  from_previous: bool = False,\n                  label_selector: str = 'name in ({name})',\n                  container_name: str = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:\n    pass\n

Arguments:

Name Type Default Required name string null No last object null No ns string \u201cdefault\u201d No from_previous boolean false No label_selector string \u201cname in ({name})\u201d No container_name string null No

Usage:

JSONYAML
{\n\"name\": \"read-pod-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"read_pod_logs\"\n}\n}\n
name: read-pod-logs\nprovider:\nfunc: read_pod_logs\nmodule: chaosk8s.pod.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#terminate_pods","title":"terminate_pods","text":"Type action Module chaosk8s.pod.actions Name terminate_pods Return None

Terminate a pod gracefully. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected for termination.

If all is set to True, all matching pods will be terminated.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods to be terminated. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be terminated. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be terminated Otherwise, the first retrieved n pods will be terminated.

If grace_period is greater than or equal to 0, it will be used as the grace period (in seconds) to terminate the pods. Otherwise, the default pod\u2019s grace period will be used.

Signature:

def terminate_pods(label_selector: str = None,\n                   name_pattern: str = None,\n                   all: bool = False,\n                   rand: bool = False,\n                   mode: str = 'fixed',\n                   qty: int = 1,\n                   grace_period: int = -1,\n                   ns: str = 'default',\n                   order: str = 'alphabetic',\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required label_selector string null No name_pattern string null No all boolean false No rand boolean false No mode string \u201cfixed\u201d No qty integer 1 No grace_period integer -1 No ns string \u201cdefault\u201d No order string \u201calphabetic\u201d No

Usage:

JSONYAML
{\n\"name\": \"terminate-pods\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\"\n}\n}\n
name: terminate-pods\nprovider:\nfunc: terminate_pods\nmodule: chaosk8s.pod.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#probes","title":"probes","text":""},{"location":"drivers/kubernetes/#all_microservices_healthy","title":"all_microservices_healthy","text":"Type probe Module chaosk8s.probes Name all_microservices_healthy Return Tuple[Dict[str, Any], Dict[str, Any]]

!!!DEPRECATED!!!

Signature:

def all_microservices_healthy(\n    ns: str = 'default',\n    secrets: Dict[str, Dict[str, str]] = None\n) -> Tuple[Dict[str, Any], Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"all-microservices-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"all_microservices_healthy\"\n}\n}\n
name: all-microservices-healthy\nprovider:\nfunc: all_microservices_healthy\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_is_fully_available","title":"deployment_is_fully_available","text":"Type probe Module chaosk8s.probes Name deployment_is_fully_available Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_fully_available(name: str,\n                                  ns: str = 'default',\n                                  label_selector: str = None,\n                                  timeout: int = 30,\n                                  secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No

Usage:

JSONYAML
{\n\"name\": \"deployment-is-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"deployment_is_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-is-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_is_fully_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#deployment_is_not_fully_available","title":"deployment_is_not_fully_available","text":"Type probe Module chaosk8s.probes Name deployment_is_not_fully_available Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_not_fully_available(name: str,\n                                      ns: str = 'default',\n                                      label_selector: str = None,\n                                      timeout: int = 30,\n                                      secrets: Dict[str, Dict[str,\n                                                              str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No

Usage:

JSONYAML
{\n\"name\": \"deployment-is-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"deployment_is_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: deployment-is-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: deployment_is_not_fully_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#microservice_available_and_healthy","title":"microservice_available_and_healthy","text":"Type probe Module chaosk8s.probes Name microservice_available_and_healthy Return Optional[bool]

!!!DEPRECATED!!!

Signature:

def microservice_available_and_healthy(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"microservice-available-and-healthy\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_available_and_healthy\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: microservice-available-and-healthy\nprovider:\narguments:\nname: ''\nfunc: microservice_available_and_healthy\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#microservice_is_not_available","title":"microservice_is_not_available","text":"Type probe Module chaosk8s.probes Name microservice_is_not_available Return boolean

!!!DEPRECATED!!!

Signature:

def microservice_is_not_available(\n        name: str,\n        ns: str = 'default',\n        label_selector: str = 'name in ({name})',\n        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"microservice-is-not-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"microservice_is_not_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: microservice-is-not-available\nprovider:\narguments:\nname: ''\nfunc: microservice_is_not_available\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#read_microservices_logs","title":"read_microservices_logs","text":"Type probe Module chaosk8s.probes Name read_microservices_logs Return mapping

Fetch logs for all the pods with the label \"name\" set to name and return a dictionary with the keys being the pod\u2019s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod\u2019s incarnation, if any.

Signature:

def read_microservices_logs(\n        name: str = None,\n        last: Optional[str] = None,\n        ns: str = 'default',\n        from_previous: bool = False,\n        label_selector: str = 'name in ({name})',\n        container_name: str = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:\n    pass\n

Arguments:

Name Type Default Required name string null No last object null No ns string \u201cdefault\u201d No from_previous boolean false No label_selector string \u201cname in ({name})\u201d No container_name string null No

Usage:

JSONYAML
{\n\"name\": \"read-microservices-logs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"read_microservices_logs\"\n}\n}\n
name: read-microservices-logs\nprovider:\nfunc: read_microservices_logs\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#service_endpoint_is_initialized","title":"service_endpoint_is_initialized","text":"Type probe Module chaosk8s.probes Name service_endpoint_is_initialized Return None

!!!DEPRECATED!!!

Signature:

def service_endpoint_is_initialized(name: str,\n                                    ns: str = 'default',\n                                    label_selector: str = 'name in ({name})',\n                                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string \u201cname in ({name})\u201d No

Usage:

JSONYAML
{\n\"name\": \"service-endpoint-is-initialized\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"service_endpoint_is_initialized\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: service-endpoint-is-initialized\nprovider:\narguments:\nname: ''\nfunc: service_endpoint_is_initialized\nmodule: chaosk8s.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#replicaset","title":"replicaset","text":""},{"location":"drivers/kubernetes/#delete_replica_set","title":"delete_replica_set","text":"Type action Module chaosk8s.replicaset.actions Name delete_replica_set Return None

Delete a replica set by name or label_selector in the namespace ns.

The replica set is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the replica sets will be deleted in the namespace.

Signature:

def delete_replica_set(name: str = None,\n                       ns: str = 'default',\n                       label_selector: str = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"delete-replica-set\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.replicaset.actions\",\n\"func\": \"delete_replica_set\"\n}\n}\n
name: delete-replica-set\nprovider:\nfunc: delete_replica_set\nmodule: chaosk8s.replicaset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#service","title":"service","text":""},{"location":"drivers/kubernetes/#create_service_endpoint","title":"create_service_endpoint","text":"Type action Module chaosk8s.service.actions Name create_service_endpoint Return None

Create a service endpoint described by the service config, which must be the path to the JSON or YAML representation of the service.

Signature:

def create_service_endpoint(spec_path: str,\n                            ns: str = 'default',\n                            secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-service-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.actions\",\n\"func\": \"create_service_endpoint\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-service-endpoint\nprovider:\narguments:\nspec_path: ''\nfunc: create_service_endpoint\nmodule: chaosk8s.service.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#delete_service","title":"delete_service","text":"Type action Module chaosk8s.service.actions Name delete_service Return None

Remove the given service

Signature:

def delete_service(name: str,\n                   ns: str = 'default',\n                   secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"delete-service\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.actions\",\n\"func\": \"delete_service\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: delete-service\nprovider:\narguments:\nname: ''\nfunc: delete_service\nmodule: chaosk8s.service.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#service_is_initialized","title":"service_is_initialized","text":"Type probe Module chaosk8s.service.probes Name service_is_initialized Return boolean

Lookup a service endpoint by its name and raises :exc:FailedProbe when the service was not found or not initialized.

If raise_if_service_not_initialized is set to False return False when probe isn\u2019t as expected. Otherwise raises chaoslib.exceptions.ActivityFailed

Signature:

def service_is_initialized(name: str = None,\n                           ns: str = 'default',\n                           label_selector: str = None,\n                           raise_if_service_not_initialized: bool = True,\n                           secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No raise_if_service_not_initialized boolean true No

Usage:

JSONYAML
{\n\"name\": \"service-is-initialized\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.service.probes\",\n\"func\": \"service_is_initialized\"\n}\n}\n
name: service-is-initialized\nprovider:\nfunc: service_is_initialized\nmodule: chaosk8s.service.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#statefulset","title":"statefulset","text":""},{"location":"drivers/kubernetes/#create_statefulset","title":"create_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name create_statefulset Return None

Create a statefulset described by the service config, which must be the path to the JSON or YAML representation of the statefulset.

Signature:

def create_statefulset(spec_path: str,\n                       ns: str = 'default',\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required spec_path string Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"create-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"create_statefulset\",\n\"arguments\": {\n\"spec_path\": \"\"\n}\n}\n}\n
name: create-statefulset\nprovider:\narguments:\nspec_path: ''\nfunc: create_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#remove_statefulset","title":"remove_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name remove_statefulset Return None

Remove a statefulset by name or label_selector in the namespace ns.

The statefulset is removed by deleting it without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the statefulsets will be deleted in the namespace.

Signature:

def remove_statefulset(name: str = None,\n                       ns: str = 'default',\n                       label_selector: str = None,\n                       secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string null No ns string \u201cdefault\u201d No label_selector string null No

Usage:

JSONYAML
{\n\"name\": \"remove-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"remove_statefulset\"\n}\n}\n
name: remove-statefulset\nprovider:\nfunc: remove_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#scale_statefulset","title":"scale_statefulset","text":"Type action Module chaosk8s.statefulset.actions Name scale_statefulset Return None

Scale a stateful set up or down. The name is the name of the stateful set.

Signature:

def scale_statefulset(name: str,\n                      replicas: int,\n                      ns: str = 'default',\n                      secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes replicas integer Yes ns string \u201cdefault\u201d No

Usage:

JSONYAML
{\n\"name\": \"scale-statefulset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.actions\",\n\"func\": \"scale_statefulset\",\n\"arguments\": {\n\"name\": \"\",\n\"replicas\": 0\n}\n}\n}\n
name: scale-statefulset\nprovider:\narguments:\nname: ''\nreplicas: 0\nfunc: scale_statefulset\nmodule: chaosk8s.statefulset.actions\ntype: python\ntype: action\n
"},{"location":"drivers/kubernetes/#statefulset_fully_available","title":"statefulset_fully_available","text":"Type probe Module chaosk8s.statefulset.probes Name statefulset_fully_available Return None

Wait until all the statefulSet expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_fully_available(name: str,\n                                ns: str = 'default',\n                                label_selector: str = None,\n                                timeout: int = 30,\n                                raise_on_not_fully_available: bool = True,\n                                secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_not_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"statefulset-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.probes\",\n\"func\": \"statefulset_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: statefulset-fully-available\nprovider:\narguments:\nname: ''\nfunc: statefulset_fully_available\nmodule: chaosk8s.statefulset.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/kubernetes/#statefulset_not_fully_available","title":"statefulset_not_fully_available","text":"Type probe Module chaosk8s.statefulset.probes Name statefulset_not_fully_available Return None

Wait until the statefulSet gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_not_fully_available(name: str,\n                                    ns: str = 'default',\n                                    label_selector: str = None,\n                                    timeout: int = 30,\n                                    raise_on_fully_available: bool = True,\n                                    secrets: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required name string Yes ns string \u201cdefault\u201d No label_selector string null No timeout integer 30 No raise_on_fully_available boolean true No

Usage:

JSONYAML
{\n\"name\": \"statefulset-not-fully-available\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.statefulset.probes\",\n\"func\": \"statefulset_not_fully_available\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n}\n
name: statefulset-not-fully-available\nprovider:\narguments:\nname: ''\nfunc: statefulset_not_fully_available\nmodule: chaosk8s.statefulset.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/opentracing/","title":"Extension chaostracing","text":"Version 0.13.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing

This project is an extension for the Chaos Toolkit for OpenTracing and OpenTelemetry.

Here is an example of what it could look like with the Jaeger backend.

"},{"location":"drivers/opentracing/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-opentracing\n
"},{"location":"drivers/opentracing/#usage","title":"Usage","text":"

This extension provides two controls to trace your Chaos Toolkit experiment:

The only supported one is Open Telemetry as the Open Tracing is no longer maintained.

"},{"location":"drivers/opentracing/#open-telemetry","title":"Open Telemetry","text":"

To enable Open Telemetry tracing, simply add the following control to your experiment:

{\n\"controls\": [\n{\n\"name\": \"opentelemetry\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\"\n}\n}\n]\n}\n

We suggest you make it the first extension so it runs before and after all other extensions.

To configure the various Open Telemetry settings, please use the standard OLTP environment variables:

Mostly, you should set:

NOTE: This extension supports OLTP over HTTP but not gRPC.

You can also instrument a variety of frameworks like this:

{\n\"controls\": [\n{\n\"name\": \"opentelemetry\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\",\n\"arguments\": {\n\"trace_httpx\": true,\n\"trace_requests\": true,\n\"trace_botocore\": true\n}\n}\n}\n]\n}\n

This will enable the according instrumentation automatically.

"},{"location":"drivers/opentracing/#aws","title":"AWS","text":"

This extension supports AWS X-Ray directly. Simply set the following variable:

export OTEL_VENDOR=aws\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"aws\"\n}\n}\n
"},{"location":"drivers/opentracing/#google-cloud-platform-traces","title":"Google Cloud Platform Traces","text":"

If you intend on using Google Cloud Platform to export your traces to, please consider also installing the followings:

$ pip install opentelemetry-exporter-gcp-trace \\\n    opentelemetry-resourcedetector-gcp \\\n    opentelemetry-propagator-gcp\n

To authenticate the client, you can either:

In all cases, point to a service account which has the roles/cloudtrace.agent role as nthe name of the target project.

Finally, set the following variable:

export OTEL_VENDOR=gcp\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"gcp\"\n}\n}\n
"},{"location":"drivers/opentracing/#azure-traces","title":"Azure Traces","text":"

To use this package to send traces to Azure monitors, please install the dependencies as follows:

$ pip install chaostoolkit-opentracing[azure]\n

Then set the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable appropriately.

Finally, set the following variable:

export OTEL_VENDOR=azure\n

This can also be set in the configuration block:

{\n\"configuration\": {\n\"otel_vendor\": \"azure\"\n}\n}\n

See Azure documentation for more details:

"},{"location":"drivers/opentracing/#other-open-telemetry-vendors","title":"Other Open Telemetry vendors","text":"

Other vendors should work out of the box with the default settings. Otherwise, feel free to open an issue.

"},{"location":"drivers/opentracing/#legacy-open-tracing","title":"Legacy Open Tracing","text":"

This extensions supports the Open Tracing export format but highly recommends you to switch to Open Telemetry instead. There will be no support for Open Tracing support.

NOTE: Please see at the bottom of the page all the supported clients and exporters this control supports.

"},{"location":"drivers/opentracing/#declare-within-the-experiment","title":"Declare within the experiment","text":"

To use this control, you can declare it on a per experiment basis like this:

{\n\"configuration\": {\n\"tracing_provider\": \"jaeger\",\n\"tracing_host\": \"127.0.0.1\",\n\"tracing_port\": 6831,\n\"tracing_propagation\": \"b3\"\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n

This will automatically create a Jaeger client to emit traces onto the address 127.0.0.1:6831 (over UDP).

"},{"location":"drivers/opentracing/#declare-within-the-settings","title":"Declare within the settings","text":"

You may also declare the control to be applied to all experiments by declaring the control from within the Chaos Toolkit settings file. In that case, you do not need to set the configuration or the controls at the experiment level and the control will be applied to every experiments you run.

controls:\nopentracing:\nprovider:\ntype: python\nmodule: chaostracing.control\narguments:\nprovider: jaeger\nhost: 127.0.0.1\nport: 6831\npropagation: b3\n
"},{"location":"drivers/opentracing/#send-traces-from-other-extensions","title":"Send traces from other extensions","text":"

You may also access the tracer from other extensions as follows.

For instance, assuming you have an extension that makes a HTTP call you want to trace specifically, you could do this from your extension\u2019s code:

from chaoslib import Configuration, Secrets\nimport requests\nimport opentracing\n\ndef some_function(configuration: Configuration, secrets: Secrets):\n    tracer = opentracing.global_tracer()\n    scope = tracer.scope_manager.active\n    parent = scope.span\n\n    with tracer.start_span(\"call-service1\", child_of=parent) as span:\n        span.set_tag('http.method','GET')\n        span.set_tag('http.url', url)\n        span.set_tag('span.kind', 'client')\n        span.tracer.inject(span, 'http_headers', headers)\n\n        r = requests.get(url, headers=headers)\n        span.set_tag('http.status_code', r.status_code)\n

Because the opentracing exposes a noop tracer when non has been initialized, it should be safe to have that code in your extensions without having to determine if the extension has been enabled in the experiment.

Please note that, Open Tracing scope cannot be shared across threads (while spans can). So, when running this in a background activity, the tracer will not actually be set to the one that was initialized.

"},{"location":"drivers/opentracing/#open-tracing-provider-support","title":"Open Tracing Provider Support","text":""},{"location":"drivers/opentracing/#jaeger-tracer","title":"Jaeger tracer","text":"

The Jager tracer relies on the OpenTracing protocol which has now be superseded by OpenTelemetry. However, we still provide support for it.

To install the necessary dependencies for the Jaeger tracer, please run:

$ pip install -U jaeger-client~=4.8\n

Use the following configuration:

{\n\"configuration\": {\n\"tracing_provider\": \"jaeger\",\n\"tracing_host\": \"127.0.0.1\",\n\"tracing_port\": 6831,\n\"tracing_propagation\": \"b3\"\n},\n\"controls\": [\n{\n\"name\": \"opentracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n
"},{"location":"drivers/opentracing/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/opentracing/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/opentracing/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/opentracing/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment True True Steady-state Hypothesis True True Method True True Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control True

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#oltp","title":"oltp","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaostracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.oltp\"\n}\n}\n]\n}\n
controls:\n- name: chaostracing\nprovider:\nmodule: chaostracing.oltp\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/opentracing/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/opentracing/#control_1","title":"control","text":""},{"location":"drivers/opentracing/#metrics_1","title":"metrics","text":""},{"location":"drivers/opentracing/#oltp_1","title":"oltp","text":""},{"location":"drivers/overview/","title":"Drivers Overview","text":"

Chaos Toolkit drivers extend the toolkit to be able to cause chaos and probe different types of systems.

"},{"location":"drivers/pixie/","title":"Extension chaospixie","text":"Version 0.1.1 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-pixie

This extension allows you to run Pixie script during your experiments.

"},{"location":"drivers/pixie/#install","title":"Install","text":"

This package requires Python 3.8+ as Pixie\u2019s dependency requires it.

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-pixie\n
"},{"location":"drivers/pixie/#usage","title":"Usage","text":"

This extension provides two probes to run Pixie scripts, either directly embedded into the experiment or in a file local to the experiment.

For instance, a complete script:

{\n\"version\": \"1.0.0\",\n\"title\": \"Consumer service remains fast under higher traffic load\",\n\"description\": \"Showcase for how we remain responsive under a certain load. This should help us figure how many replicas we should run\",\n\"secrets\": {\n\"pixie\": {\n\"api_key\": {\n\"type\": \"env\",\n\"key\": \"PIXIE_API_KEY\"\n}\n}\n},\n\"configuration\": {\n\"pixie_cluster_id\": {\n\"type\": \"env\",\n\"key\": \"PIXIE_CLUSTER_ID\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Run a Pixie script and evaluate it\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"p99-latency-of-consumer-service-for-past-2m-remained-under-300ms\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"compute-median\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_below\",\n\"secrets\": [\"pixie\"],\n\"arguments\": {\n\"column\": \"latency_p99\",\n\"percentile\": 99,\n\"convert_from_nanoseconds\": \"milliseconds\",\n\"treshold\": 300.0\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script_from_local_file\",\n\"secrets\": [\"pixie\"],\n\"arguments\": {\n\"script_path\": \"./pixiescript.py\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"send-10-requests-per-second-for-60s\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"ddosify\",\n\"arguments\": \"-d 60 -n 600 -o stdout-json -t http://mydomain.com/consumer\"\n}\n}\n]\n}\n

This assumes you have a a service named consumer. Pixie monitors its latency and produces percentiles for it. We then use a probe tolerance to evaluate the returned latency for the past 2 minutes and we measure if the latency was mainly (99-percentile) under 300ms.

In this example, we use ddosify to induce the load, but you can use your favourite tooling of course.

The Pixie script we run is as follows:

import px\n\nns_per_ms = 1000 * 1000\nns_per_s = 1000 * ns_per_ms\nwindow_ns = px.DurationNanos(10 * ns_per_s)\nfilter_unresolved_inbound = True\nfilter_health_checks = True\nfilter_ready_checks = True\n\n\ndef inbound_let_timeseries(start_time: str, service: px.Service):\n''' Compute the let as a timeseries for requests received by `service`.\n\n    Args:\n    @start_time: The timestamp of data to start at.\n    @service: The name of the service to filter on.\n\n    '''\n    df = let_helper(start_time)\n    df = df[px.has_service_name(df.service, service)]\n\n    df = df.groupby(['timestamp']).agg(\n        latency_quantiles=('latency', px.quantiles),\n        error_rate_per_window=('failure', px.mean),\n        throughput_total=('latency', px.count),\n        bytes_total=('resp_body_size', px.sum)\n    )\n\n    # Format the result of LET aggregates into proper scalar formats and\n    # time series.\n    df.latency_p50 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p50')))\n    df.latency_p90 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p90')))\n    df.latency_p99 = px.DurationNanos(px.floor(px.pluck_float64(df.latency_quantiles, 'p99')))\n    df.request_throughput = df.throughput_total / window_ns\n    df.errors_per_ns = df.error_rate_per_window * df.request_throughput / px.DurationNanos(1)\n    df.error_rate = px.Percent(df.error_rate_per_window)\n    df.bytes_per_ns = df.bytes_total / window_ns\n    df.time_ = df.timestamp\n\n    return df[['time_', 'latency_p50', 'latency_p90', 'latency_p99',\n               'request_throughput', 'errors_per_ns', 'error_rate', 'bytes_per_ns']]\n\n\ndef let_helper(start_time: str):\n''' Compute the initial part of the let for requests.\n        Filtering to inbound/outbound traffic by service is done by the calling function.\n\n    Args:\n    @start_time: The timestamp of data to start at.\n\n    '''\n    df = px.DataFrame(table='http_events', start_time=start_time)\n    # Filter only to inbound service traffic (server-side).\n    # Don't include traffic initiated by this service to an external location.\n    df = df[df.trace_role == 2]\n    df.service = df.ctx['service']\n    df.pod = df.ctx['pod']\n    df.latency = df.latency\n\n    df.timestamp = px.bin(df.time_, window_ns)\n\n    df.failure = df.resp_status >= 400\n    filter_out_conds = ((df.req_path != '/healthz' or not filter_health_checks) and (\n        df.req_path != '/readyz' or not filter_ready_checks)) and (\n        df['remote_addr'] != '-' or not filter_unresolved_inbound)\n\n    df = df[filter_out_conds]\n    return df\n\n\ndf = inbound_let_timeseries(\"-2m\", \"default/consumer\")\npx.display(df)\n

This is an abridged script from Pixie itself.

That\u2019s it!

"},{"location":"drivers/pixie/#configuration","title":"Configuration","text":"

"},{"location":"drivers/pixie/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/pixie/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/pixie/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/pixie/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/pixie/#probes","title":"probes","text":""},{"location":"drivers/pixie/#run_script","title":"run_script","text":"Type probe Module chaospixie.probes Name run_script Return string

Run a Pixie script.

Make sure to provide the name of the table you want to fetch data for. Usually it\u2019s the name given to the px.display() function in your script.

Signature:

def run_script(script: str,\n               table_name: str = 'output',\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required script string Yes table_name string \u201coutput\u201d No

Usage:

JSONYAML
{\n\"name\": \"run-script\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script\",\n\"arguments\": {\n\"script\": \"\"\n}\n}\n}\n
name: run-script\nprovider:\narguments:\nscript: ''\nfunc: run_script\nmodule: chaospixie.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/pixie/#run_script_from_local_file","title":"run_script_from_local_file","text":"Type probe Module chaospixie.probes Name run_script_from_local_file Return list

Run a Pixie script loaded from a local file.

Make sure to provide the name of the table you want to fetch data for. Usually it\u2019s the name given to the px.display() function in your script.

Signature:

def run_script_from_local_file(\n        script_path: str,\n        table_name: str = 'output',\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required script_path string Yes table_name string \u201coutput\u201d No

Usage:

JSONYAML
{\n\"name\": \"run-script-from-local-file\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.probes\",\n\"func\": \"run_script_from_local_file\",\n\"arguments\": {\n\"script_path\": \"\"\n}\n}\n}\n
name: run-script-from-local-file\nprovider:\narguments:\nscript_path: ''\nfunc: run_script_from_local_file\nmodule: chaospixie.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/pixie/#tolerances","title":"tolerances","text":""},{"location":"drivers/pixie/#median_should_be_above","title":"median_should_be_above","text":"Type tolerance Module chaospixie.tolerances Name median_should_be_above Return boolean

Compute the median of all the column in the list of results. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the median is above (or equal) to the threshold you provide.

Signature:

def median_should_be_above(column: str,\n                           treshold: float,\n                           target: Tuple[str, str] = None,\n                           convert_from_nanoseconds: Literal[\n                               'seconds', 'milliseconds',\n                               'microseconds'] = None,\n                           value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"median-should-be-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"median_should_be_above\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: median-should-be-above\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: median_should_be_above\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#median_should_be_below","title":"median_should_be_below","text":"Type tolerance Module chaospixie.tolerances Name median_should_be_below Return boolean

Compute the median of all the column in the list of results. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds flag so we automatically convert to seconds the value. In that case, the threshold must also be in seconds. The convert_from_nanoseconds flag can be: \"seconds\", \"milliseconds\" or \"microseconds\".

Return true if the median is below (or equal) to the threshold you provide.

Signature:

def median_should_be_below(column: str,\n                           treshold: float,\n                           convert_from_nanoseconds: Literal[\n                               'seconds', 'milliseconds',\n                               'microseconds'] = None,\n                           target: Tuple[str, str] = None,\n                           value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes convert_from_nanoseconds object null No target object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"median-should-be-below\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"median_should_be_below\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: median-should-be-below\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: median_should_be_below\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#percentile_should_be_above","title":"percentile_should_be_above","text":"Type tolerance Module chaospixie.tolerances Name percentile_should_be_above Return boolean

Compute the percentiles of all the column in the list of results. The default returned percentile is the 99-percentile. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the percentile is above (or equal) to the threshold you provide.

Signature:

def percentile_should_be_above(column: str,\n                               treshold: float,\n                               percentile: int = 99,\n                               target: Tuple[str, str] = None,\n                               convert_from_nanoseconds: Literal[\n                                   'seconds', 'milliseconds',\n                                   'microseconds'] = None,\n                               value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes percentile integer 99 No target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-should-be-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_above\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-should-be-above\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: percentile_should_be_above\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/pixie/#percentile_should_be_below","title":"percentile_should_be_below","text":"Type tolerance Module chaospixie.tolerances Name percentile_should_be_below Return boolean

Compute the percentiles of all the column in the list of results. The default returned percentile is the 99-percentile. If you need to limit the computation to a specific dataset within the results, you can provide the target as a tuple such as (key, value). The value can be a fixed value or a regular expression to match many.

Sometimes the column\u2019s value type is in nanoseconds, which isn\u2019t always easy to make sense of. You can set the convert_from_nanoseconds_to_seconds flag so we automatically convert to seconds the value. In that case, the threshold mus also be in seconds.

Return true if the percentile is below (or equal) to the threshold you provide.

Signature:

def percentile_should_be_below(column: str,\n                               treshold: float,\n                               percentile: int = 99,\n                               target: Tuple[str, str] = None,\n                               convert_from_nanoseconds: Literal[\n                                   'seconds', 'milliseconds',\n                                   'microseconds'] = None,\n                               value: List[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required column string Yes treshold number Yes percentile integer 99 No target object null No convert_from_nanoseconds object null No value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-should-be-below\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaospixie.tolerances\",\n\"func\": \"percentile_should_be_below\",\n\"arguments\": {\n\"column\": \"\",\n\"treshold\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-should-be-below\nprovider:\narguments:\ncolumn: ''\ntreshold: null\nfunc: percentile_should_be_below\nmodule: chaospixie.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/prometheus/","title":"Extension chaosprometheus","text":"Version 0.5.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-prometheus

Prometheus support for the Chaos Toolkit.

"},{"location":"drivers/prometheus/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-prometheus\n
"},{"location":"drivers/prometheus/#usage","title":"Usage","text":"

To use this package, you must create have access to a Prometheus instance via HTTP and be allowed to connect to it.

This package only exports probes to query for some aspects of your system as monitored by Prometheus.

Here is an example of querying Prometheus at a given moment

{\n\"type\": \"probe\",\n\"name\": \"fetch-cpu-just-2mn-ago\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query\",\n\"arguments\": {\n\"query\": \"process_cpu_seconds_total{job='websvc'}\",\n\"when\": \"2 minutes ago\"\n}\n}\n}\n

You can also ask for an interval as follows:

{\n\"type\": \"probe\",\n\"name\": \"fetch-cpu-over-interval\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"arguments\": {\n\"query\": \"process_cpu_seconds_total{job='websvc'}\",\n\"start\": \"2 minutes ago\",\n\"end\": \"now\",\n\"step\": 5\n}\n}\n}\n

In both cases, the probe returns the JSON payload as-is from Prometheus or raises an exception when an error is met.

The result is not further process and should be found in the generated report of the experiment run.

You can also send metrics to a pushgateway service via a control:

{\n\"controls\": [\n{\n\"name\": \"prometheus\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.metrics\",\n\"arguments\": {\n\"pushgateway_url\": \"http://someip:9091\",\n\"job\": \"chaostoolkit\"\n}\n}\n}\n]\n}\n

You can also set three more arguments:

These are particularly useful when you couple this extension with others like Loki where you want to cross-reference between logs and metrics.

"},{"location":"drivers/prometheus/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

"},{"location":"drivers/prometheus/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/prometheus/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False True Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosprometheus\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaosprometheus\nprovider:\nmodule: chaosprometheus.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/prometheus/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/prometheus/#metrics_1","title":"metrics","text":""},{"location":"drivers/prometheus/#probes","title":"probes","text":""},{"location":"drivers/prometheus/#compute_mean","title":"compute_mean","text":"Type probe Module chaosprometheus.probes Name compute_mean Return number

Compute the mean of all returned datapoints of the range vector matching the given query. The query must return a range vector.

The default computes an arithmetic mean. You can switch to geometric or harmonic mean by passing mean_type=\"geometric\" or mean_type=\"harmonic\".

Signature:

def compute_mean(query: str,\n                 window: str = '1d',\n                 mean_type: str = 'arithmetic',\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required query string Yes window string \u201c1d\u201d No mean_type string \u201carithmetic\u201d No

Usage:

JSONYAML
{\n\"name\": \"compute-mean\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"compute_mean\",\n\"arguments\": {\n\"query\": \"\"\n}\n}\n}\n
name: compute-mean\nprovider:\narguments:\nquery: ''\nfunc: compute_mean\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#nodes_cpu_usage_mean","title":"nodes_cpu_usage_mean","text":"Type probe Module chaosprometheus.probes Name nodes_cpu_usage_mean Return number

Computes a mean of all nodes activities per minute over the given window. We use the node_cpu_seconds_total metric to perform this query.

Signature:

def nodes_cpu_usage_mean(window: str = '1d',\n                         configuration: Dict[str, Dict[str, str]] = None,\n                         secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required window string \u201c1d\u201d No

Usage:

JSONYAML
{\n\"name\": \"nodes-cpu-usage-mean\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"nodes_cpu_usage_mean\"\n}\n}\n
name: nodes-cpu-usage-mean\nprovider:\nfunc: nodes_cpu_usage_mean\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#query","title":"query","text":"Type probe Module chaosprometheus.probes Name query Return mapping

Run an instant query against a Prometheus server and returns its result as-is.

Signature:

def query(query: str,\n          when: str = None,\n          timeout: float = None,\n          configuration: Dict[str, Dict[str, str]] = None,\n          secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required query string Yes when string null No timeout number null No

Usage:

JSONYAML
{\n\"name\": \"query\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query\",\n\"arguments\": {\n\"query\": \"\"\n}\n}\n}\n
name: query\nprovider:\narguments:\nquery: ''\nfunc: query\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/prometheus/#query_interval","title":"query_interval","text":"Type probe Module chaosprometheus.probes Name query_interval Return mapping

Run a range query against a Prometheus server and returns its result as-is.

The start and end arguments can be a RFC 3339 date or expressed more colloquially such as \"5 minutes ago\".

Signature:

def query_interval(\n        query: str,\n        start: str,\n        end: str,\n        step: int = 1,\n        timeout: float = None,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required query string Yes start string Yes end string Yes step integer 1 No timeout number null No

Usage:

JSONYAML
{\n\"name\": \"query-interval\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"arguments\": {\n\"query\": \"\",\n\"start\": \"\",\n\"end\": \"\"\n}\n}\n}\n
name: query-interval\nprovider:\narguments:\nend: ''\nquery: ''\nstart: ''\nfunc: query_interval\nmodule: chaosprometheus.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/","title":"Extension chaosreliably","text":"Version 0.66.0+editable Repository https://github.com/chaostoolkit-incubator/chaostoolkit-reliably

Chaos Toolkit extension for Reliably.

"},{"location":"drivers/reliably/#install","title":"Install","text":"

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-reliably\n
"},{"location":"drivers/reliably/#authentication","title":"Authentication","text":"

To use this package, you must create have registered with Reliably services.

Then you need to set some environment variables as secrets.

{\n\"secrets\": {\n\"reliably\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"RELIABLY_TOKEN\"\n},\n\"host\": {\n\"type\": \"env\",\n\"key\": \"RELIABLY_HOST\",\n\"default\": \"app.reliably.com\"\n}\n}\n}\n}\n
"},{"location":"drivers/reliably/#usage","title":"Usage","text":""},{"location":"drivers/reliably/#as-steady-steate-hypothesis-or-method","title":"As Steady Steate Hypothesis or Method","text":"

This extensions offers a variety of probes and tolerances ready to be used in your steady-state blocks.

For instance:

{\n\"version\": \"1.0.0\",\n\"title\": \"SLO error-count-3h / Error budget 10%\",\n\"description\": \"Monitor the health of our demo service from our users perspective and ensure they have a high-quality experience\",\n\"runtime\": {\n\"hypothesis\": {\n\"strategy\": \"after-method-only\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Compute SLO and validate its Error Budget with our target\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"get-slo\",\n\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"there-should-be-error-budget-left\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.tolerances\",\n\"func\": \"has_error_budget_left\",\n\"arguments\": {\n\"name\": \"cloudrun-service-availability\"\n}\n}\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.probes\",\n\"func\": \"compute_slo\",\n\"arguments\": {\n\"slo\": {\n\"apiVersion\": \"sre.google.com/v2\",\n\"kind\": \"ServiceLevelObjective\",\n\"metadata\": {\n\"name\": \"cloudrun-service-availability\",\n\"labels\": {\n\"service_name\": \"cloudrun\",\n\"feature_name\": \"service\",\n\"slo_name\": \"availability\"\n}\n},\n\"spec\": {\n\"description\": \"Availability of Cloud Run service\",\n\"backend\": \"cloud_monitoring_mql\",\n\"method\": \"good_bad_ratio\",\n\"exporters\": [\n\n],\n\"service_level_indicator\": {\n\"filter_good\": \"fetch cloud_run_revision | metric 'run.googleapis.com/request_count' | filter resource.project_id == '${CLOUDRUN_PROJECT_ID}' | filter resource.service_name == '${CLOUDRUN_SERVICE_NAME}' | filter metric.response_code_class == '2xx'\",\n\"filter_valid\": \"fetch cloud_run_revision | metric 'run.googleapis.com/request_count' | filter resource.project_id == '${CLOUDRUN_PROJECT_ID}' | filter resource.service_name == '${CLOUDRUN_SERVICE_NAME}'\"\n},\n\"goal\": 0.9\n}\n},\n\"config\": {\n\"backends\": {\n\"cloud_monitoring_mql\": {\n\"project_id\": \"${STACKDRIVER_HOST_PROJECT_ID}\"\n}\n},\n\"error_budget_policies\": {\n\"default\": {\n\"steps\": [\n{\n\"name\": \"3 hours\",\n\"burn_rate_threshold\": 9,\n\"alert\": false,\n\"window\": 10800,\n\"message_alert\": \"Page the SRE team to defend the SLO\",\n\"message_ok\": \"Last 3 hours on track\"\n}\n]\n}\n}\n}\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"name\": \"inject-traffic-into-endpoint\",\n\"type\": \"action\",\n\"background\": true,\n\"provider\": {\n\"func\": \"inject_gradual_traffic_into_endpoint\",\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.actions\",\n\"arguments\": {\n\"endpoint\": \"${ENDPOINT}\",\n\"step_duration\": 30,\n\"test_duration\": 300,\n\"step_additional_vu\": 3,\n\"vu_per_second_rate\": 1,\n\"results_json_filepath\": \"./load-test-results.json\"\n}\n}\n}\n]\n}\n

This above example will get the last 5 Objective Results for our Must be good SLO and determine if they were all okay or whether we\u2019ve spent our error budget they are allowed.

"},{"location":"drivers/reliably/#as-controls","title":"As controls","text":"

You can use controls provided by chaostoolkit-reliably to track your experiments within Reliably. The block is inserted automatically by Reliably when you import the experiment into Reliably.

"},{"location":"drivers/reliably/#contribute","title":"Contribute","text":"

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 by black, ruff, isort, and mypy, add an entry into CHANGELOG.md, and then raise a PR to the repository for review

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/reliably/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. First you will need to install globally pdm and create a virtual environment:

$ pdm create venv\n$ pdm use\n$ $(pdm venv activate)\n

Then install the dependencies:

$ pdm sync -d\n
"},{"location":"drivers/reliably/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pdm run test\n
"},{"location":"drivers/reliably/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, [ruff][flake8], isort, mypy and [bandit][] to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ pmd run format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ pdm run lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up. It will also provide you with any errors mypy picks up.

"},{"location":"drivers/reliably/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/reliably/#autopause","title":"autopause","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.autopause\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.autopause\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#chatgpt","title":"chatgpt","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.chatgpt\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.chatgpt\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#experiment","title":"experiment","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.experiment\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.experiment\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#metrics","title":"metrics","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.metrics\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.metrics\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#prechecks","title":"prechecks","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.prechecks\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.prechecks\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#safeguard","title":"safeguard","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False False Experiment False False Steady-state Hypothesis False False Method False False Rollback False False Activities False False

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control True Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosreliably\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.safeguard\"\n}\n}\n]\n}\n
controls:\n- name: chaosreliably\nprovider:\nmodule: chaosreliably.controls.safeguard\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/reliably/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/reliably/#dns","title":"dns","text":""},{"location":"drivers/reliably/#dns_response_is_superset","title":"dns_response_is_superset","text":"Type tolerance Module chaosreliably.activities.dns.tolerances Name dns_response_is_superset Return boolean

Validates the response from the DNS resolve_name probe is a superset of the given set of values.

Signature:

def dns_response_is_superset(expect: List[str],\n                             value: List[str] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expect list Yes value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"dns-response-is-superset\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.tolerances\",\n\"func\": \"dns_response_is_superset\",\n\"arguments\": {\n\"expect\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: dns-response-is-superset\nprovider:\narguments:\nexpect: []\nfunc: dns_response_is_superset\nmodule: chaosreliably.activities.dns.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#dns_response_must_be_equal","title":"dns_response_must_be_equal","text":"Type tolerance Module chaosreliably.activities.dns.tolerances Name dns_response_must_be_equal Return boolean

Validates the response from the DNS resolve_name probe is exactly equal to the given set.

Signature:

def dns_response_must_be_equal(expect: List[str],\n                               value: List[str] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expect list Yes value list null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"dns-response-must-be-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.tolerances\",\n\"func\": \"dns_response_must_be_equal\",\n\"arguments\": {\n\"expect\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: dns-response-must-be-equal\nprovider:\narguments:\nexpect: []\nfunc: dns_response_must_be_equal\nmodule: chaosreliably.activities.dns.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#resolve_name","title":"resolve_name","text":"Type probe Module chaosreliably.activities.dns.probes Name resolve_name Return list

Resolve a domain for a specific type from the given nameservers.

Signature:

def resolve_name(domain: str,\n                 nameservers: Sequence[str] = ('8.8.8.8', ),\n                 resolve_type: str = 'A') -> List[str]:\n    pass\n

Arguments:

Name Type Default Required domain string Yes nameservers object [\u201c8.8.8.8\u201d] No resolve_type string \u201cA\u201d No

Usage:

JSONYAML
{\n\"name\": \"resolve-name\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.dns.probes\",\n\"func\": \"resolve_name\",\n\"arguments\": {\n\"domain\": \"\"\n}\n}\n}\n
name: resolve-name\nprovider:\narguments:\ndomain: ''\nfunc: resolve_name\nmodule: chaosreliably.activities.dns.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#gh","title":"gh","text":""},{"location":"drivers/reliably/#cancel_workflow_run","title":"cancel_workflow_run","text":"Type action Module chaosreliably.activities.gh.actions Name cancel_workflow_run Return mapping

Cancels a GitHub Workflow run.

The target run is chosen from the list of workflow runs matching the given parameters.

To refine the choice, you can set commit_message_pattern which is a regex matching the commit message that triggered the event.

If you set at_random, a run will be picked from the matching list randomly. otherwise, the first match will be used.

You may also filter down by workflow_id to ensure only runs of a specific workflow are considered.

Finally, if you know the workflow_run_id you may directly target it.

See the parameters meaning and values at: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

Signature:

def cancel_workflow_run(\n        repo: str,\n        at_random: bool = False,\n        commit_message_pattern: Optional[str] = None,\n        actor: Optional[str] = None,\n        branch: str = 'main',\n        event: str = 'push',\n        status: str = 'in_progress',\n        window: str = '5d',\n        workflow_id: Optional[str] = None,\n        workflow_run_id: Optional[str] = None,\n        exclude_pull_requests: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes at_random boolean false No commit_message_pattern object null No actor object null No branch string \u201cmain\u201d No event string \u201cpush\u201d No status string \u201cin_progress\u201d No window string \u201c5d\u201d No workflow_id object null No workflow_run_id object null No exclude_pull_requests boolean false No

Usage:

JSONYAML
{\n\"name\": \"cancel-workflow-run\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.actions\",\n\"func\": \"cancel_workflow_run\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: cancel-workflow-run\nprovider:\narguments:\nrepo: ''\nfunc: cancel_workflow_run\nmodule: chaosreliably.activities.gh.actions\ntype: python\ntype: action\n
"},{"location":"drivers/reliably/#closed_pr_ratio","title":"closed_pr_ratio","text":"Type probe Module chaosreliably.activities.gh.probes Name closed_pr_ratio Return number

Computes a ratio of closed PRs during the given window in a repo.

By default, only computes the ratio for PRs that were opened and closed during the given period. When only_opened_and_closed_during_window is not set, this computes the ratio for closed PRs in the period against all still opened PRs, whether they were opened before the period started or not.

The former is a measure of latency for teams while the latter is more the throughput of the team.

The repo should be given as owner/repo and the window should be given as a pattern like this: <int>s|m|d|w (seconds, minutes, days, weeks).

Signature:

def closed_pr_ratio(repo: str,\n                    base: str = 'main',\n                    only_opened_and_closed_during_window: bool = True,\n                    window: str = '5d',\n                    configuration: Dict[str, Dict[str, str]] = None,\n                    secrets: Dict[str, Dict[str, str]] = None) -> float:\n    pass\n

Arguments:

Name Type Default Required repo string Yes base string \u201cmain\u201d No only_opened_and_closed_during_window boolean true No window string \u201c5d\u201d No

Usage:

JSONYAML
{\n\"name\": \"closed-pr-ratio\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"closed_pr_ratio\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: closed-pr-ratio\nprovider:\narguments:\nrepo: ''\nfunc: closed_pr_ratio\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#list_workflow_runs","title":"list_workflow_runs","text":"Type probe Module chaosreliably.activities.gh.probes Name list_workflow_runs Return mapping

List GitHub Workflow runs.

If no runs are returned when there should be, please review if GitHub has fixed https://github.com/orgs/community/discussions/53266

See the parameters meaning and values at: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

Signature:

def list_workflow_runs(\n        repo: str,\n        actor: Optional[str] = None,\n        branch: str = 'main',\n        event: str = 'push',\n        status: str = 'in_progress',\n        window: str = '5d',\n        exclude_pull_requests: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes actor object null No branch string \u201cmain\u201d No event string \u201cpush\u201d No status string \u201cin_progress\u201d No window string \u201c5d\u201d No exclude_pull_requests boolean false No

Usage:

JSONYAML
{\n\"name\": \"list-workflow-runs\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"list_workflow_runs\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: list-workflow-runs\nprovider:\narguments:\nrepo: ''\nfunc: list_workflow_runs\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#percentile_under","title":"percentile_under","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name percentile_under Return boolean

Computes that the values under percentile are below the given duration.

For instance, for PR durations, this could be helpful to understand that 99% of them were closed in less than the given duration.

v = pr_duration(\"chaostoolkit/chaostoolkit\", \"master\", window=None)\np = percentile_under(0.99, duration=\"1d\", value=v)\n

Signature:

def percentile_under(percentile: float,\n                     duration: str = '1d',\n                     value: Optional[List[Union[int, float]]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required percentile number Yes duration string \u201c1d\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"percentile-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"percentile_under\",\n\"arguments\": {\n\"percentile\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: percentile-under\nprovider:\narguments:\npercentile: null\nfunc: percentile_under\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#pr_duration","title":"pr_duration","text":"Type probe Module chaosreliably.activities.gh.probes Name pr_duration Return list

Get a list of opened pull-requests durations.

If you don\u2019t set a window (by setting window to None), then it returns the duration of all PRs that were ever opened in this repository. Otherwise, only return the durations for PRs that were opened or closed within that window.

The repo should be given as owner/repo and the window should be given as a pattern like this: <int>s|m|d|w (seconds, minutes, days, weeks).

Signature:

def pr_duration(repo: str,\n                base: str = 'main',\n                window: Optional[str] = '5d',\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> List[float]:\n    pass\n

Arguments:

Name Type Default Required repo string Yes base string \u201cmain\u201d No window object \u201c5d\u201d No

Usage:

JSONYAML
{\n\"name\": \"pr-duration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.probes\",\n\"func\": \"pr_duration\",\n\"arguments\": {\n\"repo\": \"\"\n}\n}\n}\n
name: pr-duration\nprovider:\narguments:\nrepo: ''\nfunc: pr_duration\nmodule: chaosreliably.activities.gh.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#ratio_above","title":"ratio_above","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_above Return boolean

Validates the ratio returned by a probe is strictly greater than the target.

Signature:

def ratio_above(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-above\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_above\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-above\nprovider:\narguments:\ntarget: null\nfunc: ratio_above\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_above_or_equal","title":"ratio_above_or_equal","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_above_or_equal Return boolean

Validates the ratio returned by a probe is greater than the target.

Signature:

def ratio_above_or_equal(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-above-or-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_above_or_equal\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-above-or-equal\nprovider:\narguments:\ntarget: null\nfunc: ratio_above_or_equal\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_under","title":"ratio_under","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_under Return boolean

Validates the ratio returned by a probe is strictly below the target.

Signature:

def ratio_under(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_under\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-under\nprovider:\narguments:\ntarget: null\nfunc: ratio_under\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#ratio_under_or_equal","title":"ratio_under_or_equal","text":"Type tolerance Module chaosreliably.activities.gh.tolerances Name ratio_under_or_equal Return boolean

Validates the ratio returned by a probe is below the target.

Signature:

def ratio_under_or_equal(target: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required target number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"ratio-under-or-equal\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.gh.tolerances\",\n\"func\": \"ratio_under_or_equal\",\n\"arguments\": {\n\"target\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: ratio-under-or-equal\nprovider:\narguments:\ntarget: null\nfunc: ratio_under_or_equal\nmodule: chaosreliably.activities.gh.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#http","title":"http","text":""},{"location":"drivers/reliably/#measure_response_time","title":"measure_response_time","text":"Type probe Module chaosreliably.activities.http.probes Name measure_response_time Return number

Measure the response time of the GET request to the given URL.

Signature:

def measure_response_time(url: str) -> float:\n    pass\n

Arguments:

Name Type Default Required url string Yes

Usage:

JSONYAML
{\n\"name\": \"measure-response-time\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.http.probes\",\n\"func\": \"measure_response_time\",\n\"arguments\": {\n\"url\": \"\"\n}\n}\n}\n
name: measure-response-time\nprovider:\narguments:\nurl: ''\nfunc: measure_response_time\nmodule: chaosreliably.activities.http.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#response_time_must_be_under","title":"response_time_must_be_under","text":"Type tolerance Module chaosreliably.activities.http.tolerances Name response_time_must_be_under Return boolean

Validates the response time is under the given latency.

Use this as the tolerance of the chaosreliably.activities.http.probes.measure_response_time probe.

Signature:

def response_time_must_be_under(latency: float, value: float = 0.0) -> bool:\n    pass\n

Arguments:

Name Type Default Required latency number Yes value number 0.0 No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"response-time-must-be-under\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.http.tolerances\",\n\"func\": \"response_time_must_be_under\",\n\"arguments\": {\n\"latency\": null\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: response-time-must-be-under\nprovider:\narguments:\nlatency: null\nfunc: response_time_must_be_under\nmodule: chaosreliably.activities.http.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#load","title":"load","text":""},{"location":"drivers/reliably/#inject_gradual_traffic_into_endpoint","title":"inject_gradual_traffic_into_endpoint","text":"Type action Module chaosreliably.activities.load.actions Name inject_gradual_traffic_into_endpoint Return mapping

Load traffic into the given endpoint. Uses an approach that creates an incremental load into the endpoint rather than swarming it. The point of this action is to ensure your endpoint is active while you perform another action. This you means you likely want to run this action in the background.

You may set a bearer token if your application uses one to authenticate. Pass test_bearer_token as a secret key in the secrets payload.

This action return a dictionary payload of the load test results.

Signature:

def inject_gradual_traffic_into_endpoint(\n        endpoint: str,\n        step_duration: int = 5,\n        step_additional_vu: int = 1,\n        vu_per_second_rate: int = 1,\n        test_duration: int = 30,\n        results_json_filepath: Optional[str] = None,\n        enable_opentracing: bool = False,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required endpoint string Yes step_duration integer 5 No step_additional_vu integer 1 No vu_per_second_rate integer 1 No test_duration integer 30 No results_json_filepath object null No enable_opentracing boolean false No

Usage:

JSONYAML
{\n\"name\": \"inject-gradual-traffic-into-endpoint\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.actions\",\n\"func\": \"inject_gradual_traffic_into_endpoint\",\n\"arguments\": {\n\"endpoint\": \"\"\n}\n}\n}\n
name: inject-gradual-traffic-into-endpoint\nprovider:\narguments:\nendpoint: ''\nfunc: inject_gradual_traffic_into_endpoint\nmodule: chaosreliably.activities.load.actions\ntype: python\ntype: action\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be","title":"load_test_result_field_should_be","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be Return boolean

Reads a load test result and compares the field\u2019s value to the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be_greater_than","title":"load_test_result_field_should_be_greater_than","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be_greater_than Return boolean

Reads a load test result and compares the field\u2019s value to greater than the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be_greater_than(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be-greater-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be_greater_than\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be-greater-than\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be_greater_than\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#load_test_result_field_should_be_less_than","title":"load_test_result_field_should_be_less_than","text":"Type probe Module chaosreliably.activities.load.probes Name load_test_result_field_should_be_less_than Return boolean

Reads a load test result and compares the field\u2019s value to less than the expected given value.

If the load test runs against many endpoint, specify which one must be validated by setting the result_item_name to match the name field.

Signature:

def load_test_result_field_should_be_less_than(\n        result_filepath: str,\n        field: str,\n        expect: int,\n        result_item_name: Optional[str] = None,\n        pass_if_file_is_missing: bool = True) -> bool:\n    pass\n

Arguments:

Name Type Default Required result_filepath string Yes field string Yes expect integer Yes result_item_name object null No pass_if_file_is_missing boolean true No

Usage:

JSONYAML
{\n\"name\": \"load-test-result-field-should-be-less-than\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.load.probes\",\n\"func\": \"load_test_result_field_should_be_less_than\",\n\"arguments\": {\n\"result_filepath\": \"\",\n\"field\": \"\",\n\"expect\": 0\n}\n}\n}\n
name: load-test-result-field-should-be-less-than\nprovider:\narguments:\nexpect: 0\nfield: ''\nresult_filepath: ''\nfunc: load_test_result_field_should_be_less_than\nmodule: chaosreliably.activities.load.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#activities","title":"activities","text":""},{"location":"drivers/reliably/#pause_execution","title":"pause_execution","text":"Type Module chaosreliably.activities.pauses Name pause_execution Return null

Pause the execution of the experiment until the resume state has been received.

Signature:

def pause_execution(duration: int = 0,\n                    username: str = '',\n                    user_id: str = '') -> None:\n    pass\n

Arguments:

Name Type Default Required duration integer 0 No username string \u201d\u201c No user_id string \u201d\u201c No

Usage:

JSONYAML
{\n\"name\": \"pause-execution\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.pauses\",\n\"func\": \"pause_execution\"\n}\n}\n
name: pause-execution\nprovider:\nfunc: pause_execution\nmodule: chaosreliably.activities.pauses\ntype: python\ntype: ''\n
"},{"location":"drivers/reliably/#safeguard_1","title":"safeguard","text":""},{"location":"drivers/reliably/#call_endpoint","title":"call_endpoint","text":"Type probe Module chaosreliably.activities.safeguard.probes Name call_endpoint Return boolean

Signature:

def call_endpoint(url: str,\n                  auth: Optional[str] = None,\n                  configuration: Dict[str, Dict[str, str]] = None,\n                  secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required url string Yes auth object null No

Usage:

JSONYAML
{\n\"name\": \"call-endpoint\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.safeguard.probes\",\n\"func\": \"call_endpoint\",\n\"arguments\": {\n\"url\": \"\"\n}\n}\n}\n
name: call-endpoint\nprovider:\narguments:\nurl: ''\nfunc: call_endpoint\nmodule: chaosreliably.activities.safeguard.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#slo","title":"slo","text":""},{"location":"drivers/reliably/#compute_slo","title":"compute_slo","text":"Type probe Module chaosreliably.activities.slo.probes Name compute_slo Return list

Computes the given SLO and return a list of outcomes for each error budget policies in the config.

This is a wrapper around https://github.com/google/slo-generator so all of its documentation applies for the definition of the slo and config objects. The former contains the the SLO description while the latter describes where to source SLIs from and the error budget policies.

The most notable difference is that we disable any exporters so there is no need to define them in your objects.

Signature:

def compute_slo(\n        slo: Dict[str, Any],\n        config: Dict[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required slo mapping Yes config mapping Yes

Usage:

JSONYAML
{\n\"name\": \"compute-slo\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.probes\",\n\"func\": \"compute_slo\",\n\"arguments\": {\n\"slo\": {},\n\"config\": {}\n}\n}\n}\n
name: compute-slo\nprovider:\narguments:\nconfig: {}\nslo: {}\nfunc: compute_slo\nmodule: chaosreliably.activities.slo.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#has_error_budget_left","title":"has_error_budget_left","text":"Type tolerance Module chaosreliably.activities.slo.tolerances Name has_error_budget_left Return boolean

Signature:

def has_error_budget_left(name: str,\n                          value: Optional[List[Dict[str,\n                                                    Any]]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required name string Yes value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-error-budget-left\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.slo.tolerances\",\n\"func\": \"has_error_budget_left\",\n\"arguments\": {\n\"name\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-error-budget-left\nprovider:\narguments:\nname: ''\nfunc: has_error_budget_left\nmodule: chaosreliably.activities.slo.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#tls","title":"tls","text":""},{"location":"drivers/reliably/#expire_in_more_than","title":"expire_in_more_than","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name expire_in_more_than Return boolean

Verifies that the certificate expires in more than the given duration.

The duration is expressed as followed: where is one of \"s\", \"m\", \"d\" or \"w\". For example, in more than a week can be expressed as \"7d\" or \"1w\".

Signature:

def expire_in_more_than(duration: str = '7d',\n                        value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required duration string \u201c7d\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"expire-in-more-than\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"expire_in_more_than\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: expire-in-more-than\nprovider:\nfunc: expire_in_more_than\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#get_certificate_info","title":"get_certificate_info","text":"Type probe Module chaosreliably.activities.tls.probes Name get_certificate_info Return mapping

Extract certificate information from the remote connection.

Signature:

def get_certificate_info(host: str, port: int = 443) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer 443 No

Usage:

JSONYAML
{\n\"name\": \"get-certificate-info\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.probes\",\n\"func\": \"get_certificate_info\",\n\"arguments\": {\n\"host\": \"\"\n}\n}\n}\n
name: get-certificate-info\nprovider:\narguments:\nhost: ''\nfunc: get_certificate_info\nmodule: chaosreliably.activities.tls.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#has_fingerprint","title":"has_fingerprint","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name has_fingerprint Return boolean

Validate the fingerprint of the certificate. The hash is one of \"md5\", \"sha1\" or \"sha256\".

Signature:

def has_fingerprint(fingerprint: str,\n                    hash: str = 'sha256',\n                    value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required fingerprint string Yes hash string \u201csha256\u201d No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-fingerprint\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"has_fingerprint\",\n\"arguments\": {\n\"fingerprint\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-fingerprint\nprovider:\narguments:\nfingerprint: ''\nfunc: has_fingerprint\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#has_subject_alt_names","title":"has_subject_alt_names","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name has_subject_alt_names Return boolean

Validates the certficate covers at least the given list of alternative names. If strict is set, then the list of exported names must be exactly the provided ones.

Signature:

def has_subject_alt_names(alt_names: List[str],\n                          strict: bool = True,\n                          value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required alt_names list Yes strict boolean true No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"has-subject-alt-names\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"has_subject_alt_names\",\n\"arguments\": {\n\"alt_names\": []\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: has-subject-alt-names\nprovider:\narguments:\nalt_names: []\nfunc: has_subject_alt_names\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#is_issued_by","title":"is_issued_by","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name is_issued_by Return boolean

Validate the issue of the certificate.

Signature:

def is_issued_by(issuer: str, value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required issuer string Yes value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"is-issued-by\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"is_issued_by\",\n\"arguments\": {\n\"issuer\": \"\"\n}\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: is-issued-by\nprovider:\narguments:\nissuer: ''\nfunc: is_issued_by\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#verify_certificate","title":"verify_certificate","text":"Type probe Module chaosreliably.activities.tls.probes Name verify_certificate Return boolean

Performs a range of checks on the certificate of the remote endpoint:

If any of these values is not set (the default), the according check is not performed. This doesn\u2019t apply to the expiration date which is always checked.

Signature:

def verify_certificate(host: str,\n                       port: int = 443,\n                       expire_after: str = '7d',\n                       alt_names: Optional[List[str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer 443 No expire_after string \u201c7d\u201d No alt_names object null No

Usage:

JSONYAML
{\n\"name\": \"verify-certificate\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.probes\",\n\"func\": \"verify_certificate\",\n\"arguments\": {\n\"host\": \"\"\n}\n}\n}\n
name: verify-certificate\nprovider:\narguments:\nhost: ''\nfunc: verify_certificate\nmodule: chaosreliably.activities.tls.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/reliably/#verify_tls_cert","title":"verify_tls_cert","text":"Type tolerance Module chaosreliably.activities.tls.tolerances Name verify_tls_cert Return boolean

Performs a range of checks on the certificate of the remote endpoint:

If any of these values is not set (the default), the according check is not performed. This doesn\u2019t apply to the expiration date which is always checked.

Signature:

def verify_tls_cert(expire_after: str = '7d',\n                    alt_names: Optional[List[str]] = None,\n                    fingerprint_sha256: Optional[str] = None,\n                    issuer: Optional[str] = None,\n                    value: Optional[Dict[str, Any]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required expire_after string \u201c7d\u201d No alt_names object null No fingerprint_sha256 object null No issuer object null No value object null No

Tolerances declare the value argument which is automatically injected by Chaos Toolkit as the output of the probe they are evaluating.

Usage:

JSONYAML
{\n\"steady-state-hypothesis\": {\n\"title\": \"...\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"tolerance\": {\n\"name\": \"verify-tls-cert\",\n\"type\": \"tolerance\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.activities.tls.tolerances\",\n\"func\": \"verify_tls_cert\"\n}\n},\n\"...\": \"...\"\n}\n]\n}\n}\n
steady-state-hypothesis:\nprobes:\n- '...': '...'\ntolerance:\nname: verify-tls-cert\nprovider:\nfunc: verify_tls_cert\nmodule: chaosreliably.activities.tls.tolerances\ntype: python\ntype: tolerance\ntype: probe\ntitle: '...'\n
"},{"location":"drivers/reliably/#controls","title":"controls","text":""},{"location":"drivers/reliably/#capture","title":"capture","text":""},{"location":"drivers/reliably/#start_capturing","title":"start_capturing","text":"Type Module chaosreliably.controls.capture.slack Name start_capturing Return null

Signature:

def start_capturing(experiment: Dict[str, Any],\n                    configuration: Dict[str, Dict[str, str]],\n                    secrets: Dict[str, Dict[str, str]]) -> None:\n    pass\n

Arguments:

Name Type Default Required experiment mapping Yes

Usage:

JSONYAML
{\n\"name\": \"start-capturing\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.capture.slack\",\n\"func\": \"start_capturing\",\n\"arguments\": {\n\"experiment\": {}\n}\n}\n}\n
name: start-capturing\nprovider:\narguments:\nexperiment: {}\nfunc: start_capturing\nmodule: chaosreliably.controls.capture.slack\ntype: python\ntype: ''\n
"},{"location":"drivers/reliably/#stop_capturing","title":"stop_capturing","text":"Type Module chaosreliably.controls.capture.slack Name stop_capturing Return Optional[Dict[str, Any]]

Signature:

def stop_capturing(\n        start: datetime.datetime, end: datetime.datetime,\n        experiment: Dict[str, Any], configuration: Dict[str, Dict[str, str]],\n        secrets: Dict[str, Dict[str, str]]) -> Optional[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required start object Yes end object Yes experiment mapping Yes

Usage:

JSONYAML
{\n\"name\": \"stop-capturing\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosreliably.controls.capture.slack\",\n\"func\": \"stop_capturing\",\n\"arguments\": {\n\"start\": null,\n\"end\": null,\n\"experiment\": {}\n}\n}\n}\n
name: stop-capturing\nprovider:\narguments:\nend: null\nexperiment: {}\nstart: null\nfunc: stop_capturing\nmodule: chaosreliably.controls.capture.slack\ntype: python\ntype: ''\n
"},{"location":"drivers/service-fabric/","title":"Extension chaosservicefabric","text":"Version 0.2.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-service-fabric

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit. It targets the Microsoft Service Fabric platform.

"},{"location":"drivers/service-fabric/#install","title":"Install","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-service-fabric\n
"},{"location":"drivers/service-fabric/#usage","title":"Usage","text":"

To use the probes and actions from this package, add the following to your experiment file:

{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"start_chaos\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"stop-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"stop_chaos\",\n\"secrets\": [\"azure\"]\n}\n}\n

The parameters are straight from the Service Fabric API.

That\u2019s it!

Please explore the code to see existing probes and actions.

"},{"location":"drivers/service-fabric/#configuration","title":"Configuration","text":""},{"location":"drivers/service-fabric/#credentials","title":"Credentials","text":"

This extension uses the requests library under the hood. The requests library expects that you have a PFX certificate, converted as to the PEM format, that allows you to authenticate with the Service Factory endpoint.

Generally speaking, there are two ways of doing this:

"},{"location":"drivers/service-fabric/#putting-it-all-together","title":"Putting it all together","text":"

Here is a full example:

{\n\"version\": \"1.0.0\",\n\"title\": \"...\",\n\"description\": \"...\",\n\"configuration\": {\n\"endpoint\": \"https://XYZ.westus.cloudapp.azure.com:19080\",\n\"verify_tls\": false,\n\"use_ca\": false\n},\n\"secrets\": {\n\"azure\": {\n\"security\": \"pem\",\n\"pem_path\": \"./cluster-client-cert.pem\"\n}\n},\n\"steady-state-hypothesis\": {\n\"title\": \"Services is healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"application-must-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"verify_tls\": false,\n\"url\": \"https://some-url-in-cluster/\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"start-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"start_chaos\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"parameters\": {\n\"TimeToRunInSeconds\": 45\n}\n}\n},\n\"pauses\": {\n\"after\": 30\n}\n},\n{\n\"type\": \"probe\",\n\"ref\": \"application-must-respond\"\n},\n{\n\"type\": \"action\",\n\"name\": \"stop-service-factory-chaos\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.actions\",\n\"func\": \"stop_chaos\",\n\"secrets\": [\"azure\"]\n},\n\"pauses\": {\n\"after\": 5\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"get-service-factory-chaos-report\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.factory.probes\",\n\"func\": \"chaos_report\",\n\"secrets\": [\"azure\"],\n\"arguments\": {\n\"start_time_utc\": \"1 minute ago\",\n\"end_time_utc\": \"now\"\n}\n}\n}\n]\n}\n
"},{"location":"drivers/service-fabric/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/service-fabric/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/service-fabric/#test","title":"Test","text":"

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/service-fabric/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/service-fabric/#cluster","title":"cluster","text":""},{"location":"drivers/service-fabric/#chaos_report","title":"chaos_report","text":"Type probe Module chaosservicefabric.cluster.probes Name chaos_report Return mapping

Get Chaos report using following the Service Fabric API:

https://docs.microsoft.com/en-us/rest/api/servicefabric/sfclient-model-chaosparameters

Please see the :func:chaosazure.fabric.auth help for more information on authenticating with the service.

Signature:

def chaos_report(timeout: int = 60,\n                 start_time_utc: str = None,\n                 end_time_utc: str = None,\n                 configuration: Dict[str, Dict[str, str]] = None,\n                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required timeout integer 60 No start_time_utc string null No end_time_utc string null No

Usage:

JSONYAML
{\n\"name\": \"chaos-report\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.probes\",\n\"func\": \"chaos_report\"\n}\n}\n
name: chaos-report\nprovider:\nfunc: chaos_report\nmodule: chaosservicefabric.cluster.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/service-fabric/#start_chaos","title":"start_chaos","text":"Type action Module chaosservicefabric.cluster.actions Name start_chaos Return mapping

Start Chaos in your cluster using the given parameters. This is a mapping of keys as declared in the Service Fabric API:

https://docs.microsoft.com/en-us/rest/api/servicefabric/sfclient-model-chaosparameters

Please see the :func:chaosservicefabric.fabric.auth help for more information on authenticating with the service.

Signature:

def start_chaos(parameters: Dict[str, Any],\n                timeout: int = 60,\n                configuration: Dict[str, Dict[str, str]] = None,\n                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required parameters mapping Yes timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"start-chaos\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.actions\",\n\"func\": \"start_chaos\",\n\"arguments\": {\n\"parameters\": {}\n}\n}\n}\n
name: start-chaos\nprovider:\narguments:\nparameters: {}\nfunc: start_chaos\nmodule: chaosservicefabric.cluster.actions\ntype: python\ntype: action\n
"},{"location":"drivers/service-fabric/#stop_chaos","title":"stop_chaos","text":"Type action Module chaosservicefabric.cluster.actions Name stop_chaos Return mapping

Stop Chaos in your cluster.

Please see the :func:chaosservicefabric.fabric.auth help for more information on authenticating with the service.

Signature:

def stop_chaos(timeout: int = 60,\n               configuration: Dict[str, Dict[str, str]] = None,\n               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required timeout integer 60 No

Usage:

JSONYAML
{\n\"name\": \"stop-chaos\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosservicefabric.cluster.actions\",\n\"func\": \"stop_chaos\"\n}\n}\n
name: stop-chaos\nprovider:\nfunc: stop_chaos\nmodule: chaosservicefabric.cluster.actions\ntype: python\ntype: action\n
"},{"location":"drivers/slack/","title":"Extension chaosslack","text":"Version 0.7.0 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-slack

This project is an extension for the Chaos Toolkit to target Slack.

"},{"location":"drivers/slack/#install","title":"Install","text":"

This package requires Python 3.7+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-slack\n
"},{"location":"drivers/slack/#slack-app","title":"Slack App","text":"

To use this extension, you need to create a Slack app in your workspace. Please follow the Slack documentation to create a basic app:

https://api.slack.com/apps?new_app=1 https://api.slack.com/tutorials

You can start from this manifest if you want:

display_information:\nname: Chaos Toolkit events\nlong_description: Get live feedback information of all your Chaos Engineering\nexperiments executed from Chaos Toolkit. See which experiments deviated and\ninvestigate their logs directly from a Slack thread.\ndescription: Chaos Engineering experiments live events from Chaos Toolkit.\nbackground_color: \"#ffffff\"\nsettings:\norg_deploy_enabled: false\nsocket_mode_enabled: false\nis_hosted: false\ntoken_rotation_enabled: false\nfeatures:\nbot_user:\ndisplay_name: chaostoolkit\noauth_config:\nscopes:\nbot:\n- channels:read\n- chat:write\n- files:write\n

Once your application is created, you may want to set the Chaos Toolkit logo to clarify to your users where these messages come from.

"},{"location":"drivers/slack/#slack-token","title":"Slack Token","text":"

Please follow the procedure on Slack to create a token suitable for API calls made using the Python client. The token should start with xoxb-. You can find the token in your app settings under the OAuth & Permissions page.

The token should have at least the following scopes:

channels:read, chat:write and files:write

"},{"location":"drivers/slack/#install-your-slack-app","title":"Install your Slack app","text":"

Once created, you need to install the app in your workspace and invite it in any channel you wish to send events to. This channel will also have to be part specified as a controls argument (see below).

Now you should be good to go!

"},{"location":"drivers/slack/#usage","title":"Usage","text":"

Currently, this extension only provides a control to send Chaos Toolkit events to Slack channels.

To use this extension, add the following to your experiment (or settings):

\"secrets\": {\n\"slack\": {\n\"token\": \"xoxb-...\"\n}\n},\n\"controls\": [\n{\n\"name\": \"slack\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.control\",\n\"secrets\": [\"slack\"],\n\"arguments\": {\n\"channel\": \"general\"\n}\n}\n}\n]\n
"},{"location":"drivers/slack/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please fork this project, make your changes following the usual PEP 8 code style, add appropriate tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/slack/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ pip install -e .\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

To run the tests for the project execute the following:

$ pytest\n
"},{"location":"drivers/slack/#exported-controls","title":"Exported Controls","text":""},{"location":"drivers/slack/#control","title":"control","text":"

This module exports controls covering the following phases of the execution of an experiment:

Level Before After Experiment Loading False True Experiment True True Steady-state Hypothesis True True Method True False Rollback True True Activities True True

In addition, the controls may define the followings:

Level Enabled Validate Control False Configure Control False Cleanup Control False

To use this control module, please add the following section to your experiment:

JSONYAML
{\n\"controls\": [\n{\n\"name\": \"chaosslack\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.control\"\n}\n}\n]\n}\n
controls:\n- name: chaosslack\nprovider:\nmodule: chaosslack.control\ntype: python\n

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

"},{"location":"drivers/slack/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/slack/#control_1","title":"control","text":""},{"location":"drivers/slack/#notification","title":"notification","text":""},{"location":"drivers/slack/#notify","title":"notify","text":"Type Module chaosslack.notification Name notify Return None

Send a chat message to a channel to relate this Chaos Toolkit event.

The settings must contain:

If one of these two attributes is missing, no notification is sent.

Signature:

def notify(settings: Dict[str, Any], event: Dict[str, Any]):\n    pass\n

Arguments:

Name Type Default Required settings mapping Yes event mapping Yes

Usage:

JSONYAML
{\n\"name\": \"notify\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.notification\",\n\"func\": \"notify\",\n\"arguments\": {\n\"settings\": {},\n\"event\": {}\n}\n}\n}\n
name: notify\nprovider:\narguments:\nevent: {}\nsettings: {}\nfunc: notify\nmodule: chaosslack.notification\ntype: python\ntype: ''\n
"},{"location":"drivers/slack/#probes","title":"probes","text":""},{"location":"drivers/slack/#get_channel_history","title":"get_channel_history","text":"Type probe Module chaosslack.probes Name get_channel_history Return list

Fetches the history of a channel up to a certain limit of messages or for the past minutes.

By default no more than 100 messages in the last 15 minutes.

Signature:

def get_channel_history(\n        channel: str,\n        limit: int = 100,\n        past: int = 15,\n        include_metadata: bool = False,\n        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required channel string Yes limit integer 100 No past integer 15 No include_metadata boolean false No

Usage:

JSONYAML
{\n\"name\": \"get-channel-history\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosslack.probes\",\n\"func\": \"get_channel_history\",\n\"arguments\": {\n\"channel\": \"\"\n}\n}\n}\n
name: get-channel-history\nprovider:\narguments:\nchannel: ''\nfunc: get_channel_history\nmodule: chaosslack.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/","title":"Extension chaosspring","text":"Version 0.3.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-spring

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

"},{"location":"drivers/spring/#install","title":"Install","text":"

This package requires Python 3.6+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-spring\n
"},{"location":"drivers/spring/#usage","title":"Usage","text":"

Currently this driver supports interactions with a Spring Boot-based service that has included the 2.0.0.-SNAPSHOT release of the Chaos Monkey for Spring Boot. This snapshot includes the necessary Spring Boot Actuator HTTP endpoints so that the Chaos Toolkit to interact with the chaos features at runtime.

Once you have added the Chaos Monkey for Spring Boot and enabled the Spring Boot Actuator HTTP endpoints you can then use the probes and actions from this driver.

To use the probes and actions from this package, add the following to your experiment file:

{\n\"name\": \"enable_chaosmonkey\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\"\n},\n\"func\": \"enable_chaosmonkey\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

This will interact with the specified service and enable the Chaos Monkey features. You can also turn off the Chaos Monkey if you wish by specifying the following action:

{\n\"name\": \"disable_chaosmonkey\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\"\n},\n\"func\": \"disable_chaosmonkey\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

You can then manipulate the Chaos Monkey assaults active on your service by specifing the following action:

{\n\"name\": \"configure_assaults\",\n\"provider\": {\n\"arguments\": {\n\"base_url\": \"http://localhost:8080/actuator\",\n\"assaults_configuration\": {\n\"level\": 5,\n\"latencyRangeStart\": 2000,\n\"latencyRangeEnd\": 5000,\n\"latencyActive\": false,\n\"exceptionsActive\": false,\n\"killApplicationActive\": true,\n\"restartApplicationActive\": false\n}\n},\n\"func\": \"change_assaults_configuration\",\n\"module\": \"chaosspring.actions\",\n\"type\": \"python\"\n},\n\"type\": \"action\"\n}\n

That\u2019s it!

Please explore the code to use further probes and actions.

"},{"location":"drivers/spring/#ssl-verification","title":"SSL Verification","text":"

If you do not wish to have SSL Verification performed during your actions/probes then you can pass the argument \"verify_ssl\": false to the individual activities.

If you wish to provide a CA_BUNDLE or directory of trusted CAs certificates, provide the environment variables specified in the requests documentation here: Requests SSL Cert Verification.

"},{"location":"drivers/spring/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/spring/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ make install-dev\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/spring/#tests","title":"Tests","text":"

To run the tests for the project execute the following:

$ make tests\n
"},{"location":"drivers/spring/#formatting-and-linting","title":"Formatting and Linting","text":"

We use a combination of black, flake8, and isort to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ make format\n

This will automatically format any code that doesn\u2019t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ make lint\n

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

"},{"location":"drivers/spring/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/spring/#actions","title":"actions","text":""},{"location":"drivers/spring/#change_assaults_configuration","title":"change_assaults_configuration","text":"Type action Module chaosspring.actions Name change_assaults_configuration Return string

Change Assaults configuration on a specific service.

Signature:

def change_assaults_configuration(\n        base_url: str,\n        assaults_configuration: Dict[str, Any],\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes assaults_configuration mapping Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"change-assaults-configuration\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"change_assaults_configuration\",\n\"arguments\": {\n\"base_url\": \"\",\n\"assaults_configuration\": {}\n}\n}\n}\n
name: change-assaults-configuration\nprovider:\narguments:\nassaults_configuration: {}\nbase_url: ''\nfunc: change_assaults_configuration\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#disable_chaosmonkey","title":"disable_chaosmonkey","text":"Type action Module chaosspring.actions Name disable_chaosmonkey Return string

Disable Chaos Monkey on a specific service.

Signature:

def disable_chaosmonkey(base_url: str,\n                        headers: Dict[str, Any] = None,\n                        timeout: float = None,\n                        verify_ssl: bool = True,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"disable-chaosmonkey\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"disable_chaosmonkey\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: disable-chaosmonkey\nprovider:\narguments:\nbase_url: ''\nfunc: disable_chaosmonkey\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#enable_chaosmonkey","title":"enable_chaosmonkey","text":"Type action Module chaosspring.actions Name enable_chaosmonkey Return string

Enable Chaos Monkey on a specific service.

Signature:

def enable_chaosmonkey(base_url: str,\n                       headers: Dict[str, Any] = None,\n                       timeout: float = None,\n                       verify_ssl: bool = True,\n                       configuration: Dict[str, Dict[str, str]] = None,\n                       secrets: Dict[str, Dict[str, str]] = None) -> str:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"enable-chaosmonkey\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.actions\",\n\"func\": \"enable_chaosmonkey\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: enable-chaosmonkey\nprovider:\narguments:\nbase_url: ''\nfunc: enable_chaosmonkey\nmodule: chaosspring.actions\ntype: python\ntype: action\n
"},{"location":"drivers/spring/#probes","title":"probes","text":""},{"location":"drivers/spring/#assaults_configuration","title":"assaults_configuration","text":"Type probe Module chaosspring.probes Name assaults_configuration Return mapping

Get the current assaults configuraton from the specified service.

Signature:

def assaults_configuration(\n        base_url: str,\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"assaults-configuration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"assaults_configuration\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: assaults-configuration\nprovider:\narguments:\nbase_url: ''\nfunc: assaults_configuration\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/#chaosmonkey_enabled","title":"chaosmonkey_enabled","text":"Type probe Module chaosspring.probes Name chaosmonkey_enabled Return boolean

Enquire whether Chaos Monkey is enabled on the specified service.

Signature:

def chaosmonkey_enabled(base_url: str,\n                        headers: Dict[str, Any] = None,\n                        timeout: float = None,\n                        verify_ssl: bool = True,\n                        configuration: Dict[str, Dict[str, str]] = None,\n                        secrets: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"chaosmonkey-enabled\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"chaosmonkey_enabled\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: chaosmonkey-enabled\nprovider:\narguments:\nbase_url: ''\nfunc: chaosmonkey_enabled\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/spring/#watcher_configuration","title":"watcher_configuration","text":"Type probe Module chaosspring.probes Name watcher_configuration Return mapping

Get the current watcher configuraton from the specified service.

Signature:

def watcher_configuration(\n        base_url: str,\n        headers: Dict[str, Any] = None,\n        timeout: float = None,\n        verify_ssl: bool = True,\n        configuration: Dict[str, Dict[str, str]] = None,\n        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required base_url string Yes headers mapping null No timeout number null No verify_ssl boolean true No

Usage:

JSONYAML
{\n\"name\": \"watcher-configuration\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosspring.probes\",\n\"func\": \"watcher_configuration\",\n\"arguments\": {\n\"base_url\": \"\"\n}\n}\n}\n
name: watcher-configuration\nprovider:\narguments:\nbase_url: ''\nfunc: watcher_configuration\nmodule: chaosspring.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/terraform/","title":"Extension chaosterraform","text":"Version 0.0.9 Repository https://github.com/mcastellin/chaostoolkit-terraform

A Chaos Toolkit driver to extend chaos experiments with Terraform

"},{"location":"drivers/terraform/#package-installation","title":"Package Installation","text":""},{"location":"drivers/terraform/#from-python-package-index","title":"From Python package index","text":"

To install the latest chaostoolkit-terraform stable release:

pip install -U chaostoolkit-terraform\n
"},{"location":"drivers/terraform/#edge-version-from-the-github-repository","title":"Edge version from the GitHub repository","text":"

To install the edge version of the chaostoolkit-terraform package directly from the repository source code:

pip install -U \"git+https://github.com/mcastellin/chaostoolkit-terraform.git#egg=chaostoolkit-terraform\"\n
"},{"location":"drivers/terraform/#usage","title":"Usage","text":"

chaostoolkit-terraform provides a control to deploy Terraform modules. The control will automatically create the resources defined in the Terraform stack before experiment execution and destroy them once the experiment is completed.

To activate the chaosterraform.control for your experiments you need to define it in your experiment files (or settings):

title: My experiment\ndescription: ...\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n\nsteady-state-hypothesis: {...}\n\nmethod: []\n

By default the chaosterraform.control will reference the Terraform module found in the current working directory.

The control will execute Terraform command in the following phases of the experiment execution:

Phase Actions Configure control Initialize the Terraform driver in Chaos Toolkit Before experiment Initialize and apply the selected Terraform module After experiment Run terraform destroy unless specifically asked to retain the created resources"},{"location":"drivers/terraform/#configuration","title":"Configuration","text":"

You can configure the Terraform control either via control arguments or using Chaos Toolkit parameters with the tf_conf__ prefix:

Configuration with control arguments

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nsilent: false\nretain: true\n

Configuration using Chaos Toolkit parameters

configuration:\n# parameters prefixed with `tf_conf__` will configure chaosterraform driver\ntf_conf__silent: false\ntf_conf__retain: true\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n

When both options are provided configuration parameters supplied via the experiment configuration will be used.

Parameter Name Usage silent Suppress Terraform console output to avoid verbose experiment logs, defaults to true retain Do not run terraform destroy at the end of the experiment to retain resources, defaults to false chdir Instruct Terraform to change its working directory"},{"location":"drivers/terraform/#provide-input-variables-for-terraform","title":"Provide Input Variables for Terraform","text":"

You can override input variables defined in the Terraform module from within the experiment using the variables argument for the control:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nvariables:\nvpc_id: \"vpc-0000000000\"\nnumber_of_azs: 2\n

Alternatively, you can provide input variables from Chaos Toolkit configuration by referencing a parameter name already defined in Chaos Toolkit configuration:

configuration:\nenv_name: \"live\"\n...\n\ncontrols:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\nvariables:\nenvironment:\nname: \"env_name\"\n
"},{"location":"drivers/terraform/#use-terraform-outputs-in-chaos-experiments","title":"Use Terraform Outputs In Chaos Experiments","text":"

If your Terraform module exports some output variables you can use them in the Chaos Toolkit experiments as regular experiment parameters. Such variables are added to the configuration context with the tf_out__ prefix.

For example, this Terraform module exports a load balancer DNS name:

terraform {\n...\n}\n\noutput \"alb_dns_name\" {\nvalue = aws_lb.application_lb.dns_name\n}\n

We can use the exported DNS name in our chaos experiment like so:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\n\nsteady-state-hypothesis:\ntitle: \"Application is available\"\nprobes:\n- type: probe\nname: \"should-respond-200\"\ntolerance: 200\nprovider:\ntype: http\nurl: \"http://${tf_out__alb_dns_name}\"\nmethod: \"GET\"\ntimeout: 3\n

In addition, we can ask the chaosterraform.control to map Terraform output values to new Chaos Toolkit configuration variables or override existing ones using the outputs argument:

controls:\n- name: \"Deploy Terraform module\"\nprovider:\ntype: python\nmodule: chaosterraform.control\narguments:\noutputs:\nalb_dns_name: \"application_dns_name\"\n

In the example above, the control will map the output value alb_dns_name into a new Chaos Toolkit configuration application_dns_name that can be referenced in the experiment template using the ${application_dns_name} notation.

"},{"location":"drivers/toxiproxy/","title":"Extension chaostoxi","text":"Version 0.3.1 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-toxiproxy

Welcome to the Chaos Toolkit driver for Toxiproxy! This extension allows you to setup toxy proxy probes and methods from chaostoolkit by leveraging the toxyproxy http management api.

"},{"location":"drivers/toxiproxy/#install","title":"Install","text":"
  1. Install the Toxiproxy base client
  2. Install the Toxiproxy CLI
"},{"location":"drivers/toxiproxy/#driver","title":"Driver","text":"

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-toxiproxy\n
"},{"location":"drivers/toxiproxy/#usage","title":"Usage","text":""},{"location":"drivers/toxiproxy/#configuration","title":"Configuration","text":"

First, run the Toxiproxy base client locally to create a localhost:8474 host on your computer. Then create a proxy.

Next, to start using the actions and probes all you need to do is add the toxiproxy host with \u201ctoxiproxy_host\u201d as the key, and optionally the port with \u201ctoxiproxy_port\u201d as the key, to the configuration section in your experiment json. If not provided the port defaults to 8474.

Alternatively, if toxiproxy api is accessible using a reverse proxy, you can use toxiproxy_url setting.

Example using toxiproxy_host in experiment.json

\"configuration\": {\n\"toxiproxy_host\" : \"10.124.23.183\",\n\"some_environment_variable\": {\n\"type\": \"environment\",\n\"key\": \"ENVIRONMENT_VARIABLE\"\n}\n},\n

Example using toxiproxy_url in experiment.json

\"configuration\": {\n\"toxiproxy_url\" : \"http://mydomain.com:8080/path-to-toxiproxy-api\",\n\"some_environment_variable\": {\n\"type\": \"environment\",\n\"key\": \"ENVIRONMENT_VARIABLE\"\n}\n},\n

This extension follows the toxiproxy rules. A proxy is the channel where toxicity can be added. For this reason the extension is broken into proxy management and toxic management.

All actions and probes in the extension are of python type and are used like any other python extension.

"},{"location":"drivers/toxiproxy/#proxy-actions","title":"Proxy actions","text":""},{"location":"drivers/toxiproxy/#create_proxy","title":"create_proxy","text":"

Creates a proxy to which toxics can be added. In toxiproxy a listen port of value 0 tells the API to assign a random available port. The value where the proxy is listenting will be attached to the chaostoolkit configuration object as \\<proxyname>_PORT. Should the creation of the proxy fail, an assertion error is raised stopping all subsequent actions.

Argument Description Required Default proxy_name name for the proxy Yes None upstream_host ip address of the host to send traffic to Yes None upstream_port port of the application to send traffic to Yes None listen_host IP address to bind where toxiproxy listens No 0.0.0.0 listen_port port to listen for requests, 0 means pick random value No 0 enabled Whether to start listening or not No True"},{"location":"drivers/toxiproxy/#modify_proxy","title":"modify_proxy","text":"

Modify the configuration of a given proxy. Useful to change the upstream configiuration. Only arguments supplied result in modification of the proxy.

Argument Description Required Default proxy_name name for the proxy Yes None listen_addres ip:port address to modify No None upstream_addres ip:port of the upstream No None enabled Toggle enabled/disabled state No None"},{"location":"drivers/toxiproxy/#disable_proxy","title":"disable_proxy","text":"

Disables the proxy, this is useful to simulate a proxied service being down.

Argument Description Required Default proxy_name name for the proxy to disable Yes None"},{"location":"drivers/toxiproxy/#enable_proxy","title":"enable_proxy","text":"

Enables a disabled proxy.

Argument Description Required Default proxy_name name for the proxy to enable Yes None"},{"location":"drivers/toxiproxy/#delete_proxy","title":"delete_proxy","text":"

Removes the proxy from the system.

Example usage

 \"method\": [\n{\n\"type\": \"action\",\n\"name\": \"setup_toxiproxy_proxy\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"create_proxy\",\n\"arguments\": {\n\"proxy_name\": \"myproxy\",\n\"listen_port\" : 6666,\n\"upstream_host\" : \"10.28.188.118\",\n\"upstream_port\" : 6040\n}\n},\n\"pauses\": {\n\"after\": 1\n}\n}\n] 
"},{"location":"drivers/toxiproxy/#reset","title":"reset","text":"

Enable all proxies and remove all active toxics.

Example usage:

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"reset all proxies\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"reset\"\n},\n\"pauses\": {\n\"after\": 1\n}\n}\n]\n

"},{"location":"drivers/toxiproxy/#proxy-pobes","title":"Proxy pobes","text":""},{"location":"drivers/toxiproxy/#proxy_exist","title":"proxy_exist","text":"

Returns True of False if a given proxy exists.

Argument Description Required Default proxy_name name for the proxy Yes None"},{"location":"drivers/toxiproxy/#toxic-actions","title":"Toxic actions","text":"

All actions provided by this extension match the types and attributes of toxics.

"},{"location":"drivers/toxiproxy/#create_toxic","title":"create_toxic","text":"

Allows you to create any of the supported types of toxics with their attributes.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None toxic_type A valid toxic type Yes None stream The direction of the toxic \u201cupstream\u201d or \u201cdownstream\u201d No downstream toxicity Percentage of toxiciy 1.0 is 100%, 0.5 is 50% etc No 1.0 attributes Dictionary of attributes for the type of toxic No None"},{"location":"drivers/toxiproxy/#create_latency_toxic","title":"create_latency_toxic","text":"

Add a delay to all data going through the proxy using a downstream with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None latency time in milliseconds to add for latency Yes None jitter time in milliseconds to jitter No 0"},{"location":"drivers/toxiproxy/#create_bandwith_degradation_toxic","title":"create_bandwith_degradation_toxic","text":"

Limit the bandwith of a downstream connection with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None rate desired bandwith rate in KB/s Yes None"},{"location":"drivers/toxiproxy/#create_slow_connection_close_toxic","title":"create_slow_connection_close_toxic","text":"

Generate as downstream delayed TCP close with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None delay desired close delay in milliseconds Yes None"},{"location":"drivers/toxiproxy/#create_slicer_toxic","title":"create_slicer_toxic","text":"

Slices TCP data up into small bits, optionally adding a delay between each sliced \u201cpacket\u201d with a toxicity of 100%.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None average_size size in bytes for the average package Yes None size_variation variation in bytes of an average pkg (should be smaller than average_size) Yes None delay time in microseconds to delay each packet by Yes None"},{"location":"drivers/toxiproxy/#create_limiter_toxic","title":"create_limiter_toxic","text":"

Closes connections when transmitted data after the limit, sets it up as a dowsntream, 100% toxicity.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None bytes number of bytes to transmit before connection is closed Yes None"},{"location":"drivers/toxiproxy/#delete_toxic","title":"delete_toxic","text":"

Deletes the a given toxic.

Argument Description Required Default for_proxy name for the proxy to attach the toxy Yes None toxic_name name for this toxy Yes None

Example usage:

 \"method\": [        {\n\"type\": \"action\",\n\"name\": \"create_latency_toxic\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"toxiproxy.toxic.actions\",\n\"func\": \"create_dowsntream_latency_toxic\",\n\"arguments\": {\n\"for_proxy\": \"edsproxy\",\n\"toxic_name\": \"latency_toxic\",\n\"latency\": 5000,\n\"jitter\": 200\n}\n},\n\"pauses\": {\n\"after\": 1\n}\n}    ]\n
"},{"location":"drivers/toxiproxy/#contribute","title":"Contribute","text":"

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on 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.

"},{"location":"drivers/toxiproxy/#develop","title":"Develop","text":"

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt\n

Then, point your environment to this directory:

$ python setup.py develop\n

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

"},{"location":"drivers/toxiproxy/#test","title":"Test","text":"

To run the unit tests for the project execute the following:

$ pytest\n

To run the integration tests for the project execute the following:

$ tox\n
"},{"location":"drivers/toxiproxy/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/toxiproxy/#proxy","title":"proxy","text":""},{"location":"drivers/toxiproxy/#create_proxy_1","title":"create_proxy","text":"Type action Module chaostoxi.proxy.actions Name create_proxy Return None

Creates a proxy to which toxics can be added.

Signature:

def create_proxy(proxy_name: str,\n                 upstream_host: str,\n                 upstream_port: int,\n                 listen_host: str = '0.0.0.0',\n                 listen_port: int = 0,\n                 enabled: bool = True,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes upstream_host string Yes upstream_port integer Yes listen_host string \u201c0.0.0.0\u201d No listen_port integer 0 No enabled boolean true No

Usage:

JSONYAML
{\n\"name\": \"create-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"create_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\",\n\"upstream_host\": \"\",\n\"upstream_port\": 0\n}\n}\n}\n
name: create-proxy\nprovider:\narguments:\nproxy_name: ''\nupstream_host: ''\nupstream_port: 0\nfunc: create_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#delete_proxy_1","title":"delete_proxy","text":"Type action Module chaostoxi.proxy.actions Name delete_proxy Return None

Removes the proxy from the system.

Signature:

def delete_proxy(proxy_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"delete_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: delete-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: delete_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#disable_proxy_1","title":"disable_proxy","text":"Type action Module chaostoxi.proxy.actions Name disable_proxy Return None

Disables the proxy, this is useful to simulate a proxied service being down.

Signature:

def disable_proxy(proxy_name: str,\n                  configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"disable-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"disable_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: disable-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: disable_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#enable_proxy_1","title":"enable_proxy","text":"Type action Module chaostoxi.proxy.actions Name enable_proxy Return None

Enables a disabled proxy.

Signature:

def enable_proxy(proxy_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"enable-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"enable_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: enable-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: enable_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#get_proxy_attribute","title":"get_proxy_attribute","text":"Type probe Module chaostoxi.proxy.probes Name get_proxy_attribute Return None

Returns an attribute of a specified proxy.

Signature:

def get_proxy_attribute(proxy_name: str,\n                        attribute: str,\n                        configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes attribute string Yes

Usage:

JSONYAML
{\n\"name\": \"get-proxy-attribute\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.probes\",\n\"func\": \"get_proxy_attribute\",\n\"arguments\": {\n\"proxy_name\": \"\",\n\"attribute\": \"\"\n}\n}\n}\n
name: get-proxy-attribute\nprovider:\narguments:\nattribute: ''\nproxy_name: ''\nfunc: get_proxy_attribute\nmodule: chaostoxi.proxy.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/toxiproxy/#modify_proxy_1","title":"modify_proxy","text":"Type action Module chaostoxi.proxy.actions Name modify_proxy Return None

Modify the configuration of a given proxy. Useful to change the upstream configiuration. Only arguments supplied result in modification of the proxy.

Signature:

def modify_proxy(proxy_name: str,\n                 listen_address: str = None,\n                 upstream_address: str = None,\n                 enabled: bool = None,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes listen_address string null No upstream_address string null No enabled boolean null No

Usage:

JSONYAML
{\n\"name\": \"modify-proxy\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"modify_proxy\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: modify-proxy\nprovider:\narguments:\nproxy_name: ''\nfunc: modify_proxy\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#proxy_exist_1","title":"proxy_exist","text":"Type probe Module chaostoxi.proxy.probes Name proxy_exist Return None

Returns True of False if a given proxy exists.

Signature:

def proxy_exist(proxy_name: str,\n                configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required proxy_name string Yes

Usage:

JSONYAML
{\n\"name\": \"proxy-exist\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.probes\",\n\"func\": \"proxy_exist\",\n\"arguments\": {\n\"proxy_name\": \"\"\n}\n}\n}\n
name: proxy-exist\nprovider:\narguments:\nproxy_name: ''\nfunc: proxy_exist\nmodule: chaostoxi.proxy.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/toxiproxy/#reset_1","title":"reset","text":"Type action Module chaostoxi.proxy.actions Name reset Return None

Enable all proxies and remove all active toxics

Signature:

def reset(configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"reset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.proxy.actions\",\n\"func\": \"reset\"\n}\n}\n
name: reset\nprovider:\nfunc: reset\nmodule: chaostoxi.proxy.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#toxic","title":"toxic","text":""},{"location":"drivers/toxiproxy/#create_bandwith_degradation_toxic_1","title":"create_bandwith_degradation_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_bandwith_degradation_toxic Return mapping

Limit the bandwith of a downstream connection with a toxicity of 100%.

Signature:

def create_bandwith_degradation_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        rate: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes rate integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-bandwith-degradation-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_bandwith_degradation_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"rate\": 0\n}\n}\n}\n
name: create-bandwith-degradation-toxic\nprovider:\narguments:\nfor_proxy: ''\nrate: 0\ntoxic_name: ''\nfunc: create_bandwith_degradation_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_latency_toxic_1","title":"create_latency_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_latency_toxic Return mapping

Add a delay to all data going through the proxy using a downstream with a toxicity of 100%.

Signature:

def create_latency_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        latency: int,\n        jitter: int = 0,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes latency integer Yes jitter integer 0 No

Usage:

JSONYAML
{\n\"name\": \"create-latency-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_latency_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"latency\": 0\n}\n}\n}\n
name: create-latency-toxic\nprovider:\narguments:\nfor_proxy: ''\nlatency: 0\ntoxic_name: ''\nfunc: create_latency_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_limiter_toxic_1","title":"create_limiter_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_limiter_toxic Return mapping

Closes connections when transmitted data after the limit, sets it up as a dowsntream, 100% toxicity.

Signature:

def create_limiter_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        bytes_limit: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes bytes_limit integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-limiter-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_limiter_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"bytes_limit\": 0\n}\n}\n}\n
name: create-limiter-toxic\nprovider:\narguments:\nbytes_limit: 0\nfor_proxy: ''\ntoxic_name: ''\nfunc: create_limiter_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_slicer_toxic_1","title":"create_slicer_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_slicer_toxic Return mapping

Slices TCP data up into small bits, optionally adding a delay between each sliced \u201cpacket\u201d with a toxicity of 100%.

Signature:

def create_slicer_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        average_size: int,\n        size_variation: int,\n        delay: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes average_size integer Yes size_variation integer Yes delay integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-slicer-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_slicer_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"average_size\": 0,\n\"size_variation\": 0,\n\"delay\": 0\n}\n}\n}\n
name: create-slicer-toxic\nprovider:\narguments:\naverage_size: 0\ndelay: 0\nfor_proxy: ''\nsize_variation: 0\ntoxic_name: ''\nfunc: create_slicer_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_slow_connection_close_toxic_1","title":"create_slow_connection_close_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_slow_connection_close_toxic Return mapping

Limit the bandwith of a downstream connection with a toxicity of 100%.

Signature:

def create_slow_connection_close_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        delay: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes delay integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-slow-connection-close-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_slow_connection_close_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"delay\": 0\n}\n}\n}\n
name: create-slow-connection-close-toxic\nprovider:\narguments:\ndelay: 0\nfor_proxy: ''\ntoxic_name: ''\nfunc: create_slow_connection_close_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_timeout_toxic","title":"create_timeout_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_timeout_toxic Return mapping

Generate as downstream delayed TCP close with a toxicity of 100%.

Signature:

def create_timeout_toxic(\n        for_proxy: str,\n        toxic_name: str,\n        timeout: int,\n        configuration: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes timeout integer Yes

Usage:

JSONYAML
{\n\"name\": \"create-timeout-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_timeout_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"timeout\": 0\n}\n}\n}\n
name: create-timeout-toxic\nprovider:\narguments:\nfor_proxy: ''\ntimeout: 0\ntoxic_name: ''\nfunc: create_timeout_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#create_toxic_1","title":"create_toxic","text":"Type action Module chaostoxi.toxic.actions Name create_toxic Return boolean

Allows you to create any of the supported types of toxics with their attributes.

Signature:

def create_toxic(for_proxy: str,\n                 toxic_name: str,\n                 toxic_type: str,\n                 stream: str = 'downstream',\n                 toxicity: float = 1.0,\n                 attributes: Dict[str, Any] = None,\n                 configuration: Dict[str, Dict[str, str]] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes toxic_type string Yes stream string \u201cdownstream\u201d No toxicity number 1.0 No attributes mapping null No

Usage:

JSONYAML
{\n\"name\": \"create-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"create_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\",\n\"toxic_type\": \"\"\n}\n}\n}\n
name: create-toxic\nprovider:\narguments:\nfor_proxy: ''\ntoxic_name: ''\ntoxic_type: ''\nfunc: create_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/toxiproxy/#delete_toxic_1","title":"delete_toxic","text":"Type action Module chaostoxi.toxic.actions Name delete_toxic Return None

Deletes the a given toxic.

Signature:

def delete_toxic(for_proxy: str,\n                 toxic_name: str,\n                 configuration: Dict[str, Dict[str, str]] = None):\n    pass\n

Arguments:

Name Type Default Required for_proxy string Yes toxic_name string Yes

Usage:

JSONYAML
{\n\"name\": \"delete-toxic\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostoxi.toxic.actions\",\n\"func\": \"delete_toxic\",\n\"arguments\": {\n\"for_proxy\": \"\",\n\"toxic_name\": \"\"\n}\n}\n}\n
name: delete-toxic\nprovider:\narguments:\nfor_proxy: ''\ntoxic_name: ''\nfunc: delete_toxic\nmodule: chaostoxi.toxic.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/","title":"Extension chaoswm","text":"Version 0.1.2 Repository https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock

=====================

Chaos Toolkit driver for WireMock.

"},{"location":"drivers/wiremock/#package-installation","title":"Package installation","text":"

To install the package from pypi.org:

pip install -U chaostoolkit-wiremock\n
"},{"location":"drivers/wiremock/#installation-from-source","title":"Installation from source","text":"

In order to use it, you need python 3.5+ in your environment. Once downloaded the project, cd into it and run:

pip install -r requirements.txt -r requirements-dev.txt\nmake clean && make test && make install\n
"},{"location":"drivers/wiremock/#configuration","title":"Configuration","text":"

The following keys can be configured in the experiment global configuration section, under the \"wiremock\" key:

Configuration example:

{\n    \"configuration\": {\n        \"wiremock\": {\n            \"host\": \"localhost\",\n            \"port\": 8080,\n            \"contextPath\": \"/wiremock\",\n            \"timeout\": 10,\n            \"down\": {\n                \"type\": \"lognormal\",\n                \"median\": 3000,\n                \"sigma\": 0.2\n            }\n        }\n    }\n}\n
"},{"location":"drivers/wiremock/#exported-actions","title":"Exported Actions","text":"

Adding a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"adding a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"add_mappings\",\n        \"arguments\": {\n          \"mappings\": [{\n            \"request\": {\n               \"method\": \"GET\",\n               \"url\": \"/hello\"\n            },\n            \"response\": {\n               \"status\": 200,\n               \"body\": \"Hello world!\",\n               \"headers\": {\n                   \"Content-Type\": \"text/plain\"\n               }\n            } \n          }]\n        }\n      }\n    }\n  ]\n}\n

Deleting a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"deleting a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"delete_mappings\",\n        \"arguments\": {\n          \"filter\": [{\n             \"method\": \"GET\",\n             \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Adding a global fixed delay:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a global fixed delay\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"global_fixed_delay\",\n        \"arguments\": {\n          \"fixedDelay\": 10\n        }\n      }\n    }\n  ]\n}\n

Adding a global random delay:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a global random delay\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"global_random_delay\",\n        \"arguments\": {\n          \"delayDistribution\": {\n            \"type\": \"lognormal\",\n            \"median\": 20,\n            \"sigma\": 0.1\n          }\n        }\n      }\n    }\n  ]\n}\n

Adding a fixed delay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a fixed delay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"fixed_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello1\"\n          }],\n          \"fixedDelayMilliseconds\": 1000\n        }\n      }\n    }\n  ]\n}\n

Adding a random delay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a random delay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"random_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello2\"\n          }],\n          \"delayDistribution\": {\n            \"type\": \"lognormal\",\n            \"median\": 2000,\n            \"sigma\": 0.5\n          }\n        }\n      }\n    }\n  ]\n}\n

Adding a ChunkedDribbleDelay to a list of mappings:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Adding a ChunkedDribbleDelay to a mapping\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"chunked_dribble_delay\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }],\n          \"chunkedDribbleDelay\": {\n            \"numberOfChunks\": 5,\n            \"totalDuration\": 1000\n          }\n        }\n      }\n    }\n  ]\n}\n

Taking a list of mappings down (heavy distribution delay). This action will use the parameters specified in the \"down\" key of the configuration section:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"down\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Taking a list of mappings up back again:

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"up\",\n        \"arguments\": {\n          \"filter\": [{\n            \"method\": \"GET\",\n            \"url\": \"/hello\"\n          }]\n        }\n      }\n    }\n  ]\n}\n

Resetting the wiremock server (deleting all mappings):

{\n  \"method\": [\n    {\n      \"type\": \"action\",\n      \"name\": \"Taking a mapping down\",\n      \"provider\": {\n        \"type\": \"python\",\n        \"module\": \"chaoswm.actions\",\n        \"func\": \"reset\"\n      }\n    }\n  ]\n}\n
"},{"location":"drivers/wiremock/#experiments","title":"Experiments","text":"

The driver comes with an experiments directory where you can find snippets to test all APIs against a WireMock server listening on localhost:8080.

"},{"location":"drivers/wiremock/#discovery","title":"Discovery","text":"

You may use the Chaos Toolkit to discover the capabilities of this extension:

$ chaos discover chaostoolkit-wiremock  --no-install\n
"},{"location":"drivers/wiremock/#credits","title":"Credits","text":"

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

"},{"location":"drivers/wiremock/#exported-activities","title":"Exported Activities","text":""},{"location":"drivers/wiremock/#actions","title":"actions","text":""},{"location":"drivers/wiremock/#add_mappings","title":"add_mappings","text":"Type action Module chaoswm.actions Name add_mappings Return list

adds more mappings to wiremock returns the list of ids of the mappings added

Signature:

def add_mappings(mappings: List[Any],\n                 configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required mappings list Yes

Usage:

JSONYAML
{\n\"name\": \"add-mappings\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"add_mappings\",\n\"arguments\": {\n\"mappings\": []\n}\n}\n}\n
name: add-mappings\nprovider:\narguments:\nmappings: []\nfunc: add_mappings\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#chunked_dribble_delay","title":"chunked_dribble_delay","text":"Type action Module chaoswm.actions Name chunked_dribble_delay Return list

adds a chunked dribble delay to a list of mappings

Signature:

def chunked_dribble_delay(\n        filter: List[Any],\n        chunkedDribbleDelay: Mapping[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes chunkedDribbleDelay object Yes

Usage:

JSONYAML
{\n\"name\": \"chunked-dribble-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"chunked_dribble_delay\",\n\"arguments\": {\n\"filter\": [],\n\"chunkedDribbleDelay\": null\n}\n}\n}\n
name: chunked-dribble-delay\nprovider:\narguments:\nchunkedDribbleDelay: null\nfilter: []\nfunc: chunked_dribble_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#delete_mappings","title":"delete_mappings","text":"Type action Module chaoswm.actions Name delete_mappings Return list

deletes a list of mappings returns the list of ids of the mappings deleted

Signature:

def delete_mappings(\n        filter: List[Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"delete-mappings\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"delete_mappings\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: delete-mappings\nprovider:\narguments:\nfilter: []\nfunc: delete_mappings\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#down","title":"down","text":"Type action Module chaoswm.actions Name down Return list

set a list of services down more correctly it adds a chunked dribble delay to the mapping as defined in the configuration section (or action attributes) Returns the list of delayed mappings

Signature:

def down(filter: List[Any],\n         configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"down\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"down\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: down\nprovider:\narguments:\nfilter: []\nfunc: down\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#fixed_delay","title":"fixed_delay","text":"Type action Module chaoswm.actions Name fixed_delay Return list

adds a fixed delay to a list of mappings

Signature:

def fixed_delay(filter: List[Any],\n                fixedDelayMilliseconds: int,\n                configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes fixedDelayMilliseconds integer Yes

Usage:

JSONYAML
{\n\"name\": \"fixed-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"fixed_delay\",\n\"arguments\": {\n\"filter\": [],\n\"fixedDelayMilliseconds\": 0\n}\n}\n}\n
name: fixed-delay\nprovider:\narguments:\nfilter: []\nfixedDelayMilliseconds: 0\nfunc: fixed_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#global_fixed_delay","title":"global_fixed_delay","text":"Type action Module chaoswm.actions Name global_fixed_delay Return integer

add a fixed delay to all mappings

Signature:

def global_fixed_delay(fixedDelay: int = 0,\n                       configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required fixedDelay integer 0 No

Usage:

JSONYAML
{\n\"name\": \"global-fixed-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"global_fixed_delay\"\n}\n}\n
name: global-fixed-delay\nprovider:\nfunc: global_fixed_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#global_random_delay","title":"global_random_delay","text":"Type action Module chaoswm.actions Name global_random_delay Return integer

adds a random delay to all mappings

Signature:

def global_random_delay(\n        delayDistribution: Mapping[str, Any],\n        configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required delayDistribution object Yes

Usage:

JSONYAML
{\n\"name\": \"global-random-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"global_random_delay\",\n\"arguments\": {\n\"delayDistribution\": null\n}\n}\n}\n
name: global-random-delay\nprovider:\narguments:\ndelayDistribution: null\nfunc: global_random_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#populate_from_dir","title":"populate_from_dir","text":"Type action Module chaoswm.actions Name populate_from_dir Return list

adds all mappings found in the passed folder returns the list of ids of the mappings added

Signature:

def populate_from_dir(\n        dir: str = '.',\n        configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required dir string \u201d.\u201d No

Usage:

JSONYAML
{\n\"name\": \"populate-from-dir\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"populate_from_dir\"\n}\n}\n
name: populate-from-dir\nprovider:\nfunc: populate_from_dir\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#random_delay","title":"random_delay","text":"Type action Module chaoswm.actions Name random_delay Return list

adds a random delay to a list of mapppings

Signature:

def random_delay(filter: List[Any],\n                 delayDistribution: Mapping[str, Any],\n                 configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes delayDistribution object Yes

Usage:

JSONYAML
{\n\"name\": \"random-delay\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"random_delay\",\n\"arguments\": {\n\"filter\": [],\n\"delayDistribution\": null\n}\n}\n}\n
name: random-delay\nprovider:\narguments:\ndelayDistribution: null\nfilter: []\nfunc: random_delay\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#reset","title":"reset","text":"Type action Module chaoswm.actions Name reset Return integer

resets the wiremock server: deletes all mappings!

Signature:

def reset(configuration: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required

Usage:

JSONYAML
{\n\"name\": \"reset\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"reset\"\n}\n}\n
name: reset\nprovider:\nfunc: reset\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#up","title":"up","text":"Type action Module chaoswm.actions Name up Return list

deletes all delays connected with a list of mappings

Signature:

def up(filter: List[Any],\n       configuration: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required filter list Yes

Usage:

JSONYAML
{\n\"name\": \"up\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.actions\",\n\"func\": \"up\",\n\"arguments\": {\n\"filter\": []\n}\n}\n}\n
name: up\nprovider:\narguments:\nfilter: []\nfunc: up\nmodule: chaoswm.actions\ntype: python\ntype: action\n
"},{"location":"drivers/wiremock/#probes","title":"probes","text":""},{"location":"drivers/wiremock/#mappings","title":"mappings","text":"Type probe Module chaoswm.probes Name mappings Return list

Signature:

def mappings(c: Dict[str, Dict[str, str]] = None) -> List[Any]:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"mappings\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.probes\",\n\"func\": \"mappings\"\n}\n}\n
name: mappings\nprovider:\nfunc: mappings\nmodule: chaoswm.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/wiremock/#server_running","title":"server_running","text":"Type probe Module chaoswm.probes Name server_running Return integer

Signature:

def server_running(c: Dict[str, Dict[str, str]] = None) -> int:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"server-running\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.probes\",\n\"func\": \"server_running\"\n}\n}\n
name: server-running\nprovider:\nfunc: server_running\nmodule: chaoswm.probes\ntype: python\ntype: probe\n
"},{"location":"drivers/wiremock/#utils","title":"utils","text":""},{"location":"drivers/wiremock/#can_connect_to","title":"can_connect_to","text":"Type Module chaoswm.utils Name can_connect_to Return boolean

Test a connection to a host/port

Signature:

def can_connect_to(host: str, port: int) -> bool:\n    pass\n

Arguments:

Name Type Default Required host string Yes port integer Yes

Usage:

JSONYAML
{\n\"name\": \"can-connect-to\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"can_connect_to\",\n\"arguments\": {\n\"host\": \"\",\n\"port\": 0\n}\n}\n}\n
name: can-connect-to\nprovider:\narguments:\nhost: ''\nport: 0\nfunc: can_connect_to\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"drivers/wiremock/#check_configuration","title":"check_configuration","text":"Type Module chaoswm.utils Name check_configuration Return boolean

Signature:

def check_configuration(c: Dict[str, Any] = None) -> bool:\n    pass\n

Arguments:

Name Type Default Required c mapping null No

Usage:

JSONYAML
{\n\"name\": \"check-configuration\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"check_configuration\"\n}\n}\n
name: check-configuration\nprovider:\nfunc: check_configuration\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"drivers/wiremock/#get_wm_params","title":"get_wm_params","text":"Type Module chaoswm.utils Name get_wm_params Return Optional[Dict[str, Any]]

Signature:

def get_wm_params(c: Dict[str, Any]) -> Optional[Dict[str, Any]]:\n    pass\n

Arguments:

Name Type Default Required c mapping Yes

Usage:

JSONYAML
{\n\"name\": \"get-wm-params\",\n\"type\": \"\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaoswm.utils\",\n\"func\": \"get_wm_params\",\n\"arguments\": {\n\"c\": {}\n}\n}\n}\n
name: get-wm-params\nprovider:\narguments:\nc: {}\nfunc: get_wm_params\nmodule: chaoswm.utils\ntype: python\ntype: ''\n
"},{"location":"reference/concepts/","title":"Chaos Engineering Concepts in the Chaos Toolkit","text":"

If you haven\u2019t already, we strongly recommend reading the fantastic Chaos Engineering book from O\u2019Reilly Media. This book will give you some fantastic background on the whole Chaos Engineering discipline, and it\u2019s free!

Chaos Engineering is a discipline that allows you to surface weaknesses, and eventually build confidence, in complex and often distributed systems.

The Chaos Toolkit aims to give you the simplest experience for writing and running your own Chaos Engineering experiments. The main concepts are all expressed in an experiment definition, of which the following is an example from the Chaos Toolkit Samples project:

JSONYAML
{\n\"title\": \"System is resilient to provider's failures\",\n\"description\": \"Can our consumer survive gracefully a provider's failure?\",\n\"tags\": [\n\"service\",\n\"kubernetes\",\n\"spring\"\n],\n\"steady-state-hypothesis\": {\n\"title\": \"Services are all available and healthy\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"all-services-are-healthy\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.probes\",\n\"func\": \"all_microservices_healthy\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"stop-provider-service\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.actions\",\n\"func\": \"kill_microservice\",\n\"arguments\": {\n\"name\": \"my-provider-service\"\n}\n},\n\"pauses\": {\n\"after\": 10\n}\n},\n{\n\"ref\": \"all-services-are-healthy\"\n},\n{\n\"type\": \"probe\",\n\"name\": \"consumer-service-must-still-respond\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://192.168.42.58:31018/invokeConsumedService\"\n}\n}\n],\n\"rollbacks\": []\n}\n
title: System is resilient to provider's failures\ndescription: Can our consumer survive gracefully a provider's failure?\ntags:\n- service\n- kubernetes\n- spring\nsteady-state-hypothesis:\ntitle: Services are all available and healthy\nprobes:\n- type: probe\nname: all-services-are-healthy\ntolerance: true\nprovider:\ntype: python\nmodule: chaosk8s.probes\nfunc: all_microservices_healthy\nmethod:\n- type: action\nname: stop-provider-service\nprovider:\ntype: python\nmodule: chaosk8s.actions\nfunc: kill_microservice\narguments:\nname: my-provider-service\npauses:\nafter: 10\n- ref: all-services-are-healthy\n- type: probe\nname: consumer-service-must-still-respond\nprovider:\ntype: http\nurl: http://192.168.42.58:31018/invokeConsumedService\nrollbacks: []\n

The key concepts of the Chaos Toolkit are Experiments, Steady State Hypothesis and the experiment\u2019s Method. The Method contains a combination of Probes and Actions.

"},{"location":"reference/concepts/#experiments","title":"Experiments","text":"

A Chaos Toolkit experiment is provided in a single file and is currently expressed in JSON.

"},{"location":"reference/concepts/#steady-state-hypothesis","title":"Steady State Hypothesis","text":"

A Steady State Hypothesis describes \u201cwhat normal looks like\u201d for your system in order for the experiment to surface information about weaknesses when compared against the declared \u201cnormal\u201d tolerances of what is measured.

The Chaos Toolkit uses the Steady State Hypothesis for two purposes. It is used as a check before an experiment is run that the target system is in a recognised normal state. It is also used as the template for comparison of the state of your system after the experiment has been run, forming the results provided by the experiment\u2019s report.

"},{"location":"reference/concepts/#method","title":"Method","text":"

An experiment\u2019s activities are contained within its Method block.

"},{"location":"reference/concepts/#probes","title":"Probes","text":"

A probe is a way of observing a particular set of conditions in the system that is undergoing experimentation.

"},{"location":"reference/concepts/#actions","title":"Actions","text":"

An action is a particular activity that needs to be enacted on the system under experimentation.

"},{"location":"reference/concepts/#rollbacks","title":"Rollbacks","text":"

An experiment may define a sequence of actions that revert what was undone during the experiment.

"},{"location":"reference/concepts/#controls","title":"Controls","text":"

An experiment may declare a set of controls which have an impact over the execution of the experiment itself. Controls are operational elements rather than experimental.

"},{"location":"reference/contributing/","title":"Contributing to the Chaos Toolkit","text":"

The Chaos Toolkit is a free and open source tool and a community-driven set of projects. The community\u2019s input is what makes this project special and a success.

Your input could take the form of raising issues, voting for issues, starring projects, joining us on our community Slack team, submitting pull requests, or even suggesting whole new extension projects.

Whatever you can contribute, we\u2019re listening and want you to help us drive the project forward.

"},{"location":"reference/contributing/#the-chaos-toolkit-incubator","title":"The Chaos Toolkit Incubator","text":"

New potential projects should be first incubated in the Chaos Toolkit Incubator until they are ready to be moved into the main Chaos Toolkit suite of projects. Conditions for graduating a project from the Incubator to the main suite of projects include:

"},{"location":"reference/contributing/#how-to-submit-your-own-project-to-the-incubator","title":"How to submit your own project to the incubator?","text":"

The incubator is a place for community projects to be collected. If you think your extension makes sense as a community project, please don\u2019t hesitate to suggest it. The best place to start is on the community Slack team to announce it.

Generally speaking, you should consider the followings:

Notice also that we deal with contributors on a repository basis. Collaborators are external contributors with little permissions to the org and write permissions to the repositories they contribute to. We suggest that accounts should have 2FA enabled. This reduces the security surface risks in case a contributor account is breached.

"},{"location":"reference/contributing/#licensing-and-certification-of-origin","title":"Licensing and Certification of Origin","text":"

Every project in the Chaos Toolkit and the Chaos Toolkit Incubator is licensed under the Apache License, Version 2.0 and abides by the Developer Certificate of Origin on all accepted commits to the master branch.

"},{"location":"reference/tutorial/","title":"Getting Started with the Chaos Toolkit","text":"

When you practice chaos engineering, you are discovering how your system reacts following certain conditions you inject. By doing this in a controlled fashion, you may learn how to change the system accordingly.

This tutorial will quickly give you a tour of the basic elements of an experiment.

Tip

You will find many more in-depth labs on GitHub.

"},{"location":"reference/tutorial/#get-ready","title":"Get Ready","text":"

Before you can run the experiment against your system, you will need to have it setup.

"},{"location":"reference/tutorial/#get-the-code","title":"Get the Code","text":"

You can fetch the code as follows:

git clone https://github.com/chaostoolkit/chaostoolkit-documentation-code\n

This particular tutorial is under tutorials/a-simple-walkthrough.

cd chaostoolkit-documentation-code/tutorials/a-simple-walkthrough\n
"},{"location":"reference/tutorial/#third-party-binaries","title":"Third-party binaries","text":"

The experiment will use the following binaries, make sure you have them in your PATH:

"},{"location":"reference/tutorial/#install-the-application-dependencies","title":"Install the Application dependencies","text":"

Our application is made of a simple set of two microservices that converse with each other over HTTPS.

Tip

It\u2019s recommended that you use a Python virtual environment to keep your project dependencies isolated from any other projects.

As you should already run Python 3 for the toolkit itself, we assume you are set accordingly, please install only the application dependencies:

pip install -U -r requirements.txt\n
"},{"location":"reference/tutorial/#install-the-chaos-toolkit","title":"Install the Chaos Toolkit","text":"

You must install the Chaos Toolkit and its dependencies for the purpose of this tutorial. While we suggest you go through the install section, it boils down to:

pip install -U chaostoolkit\n
"},{"location":"reference/tutorial/#your-first-experiment","title":"Your First Experiment","text":""},{"location":"reference/tutorial/#explore-a-potential-weakness","title":"Explore a Potential Weakness","text":"

So, looking at our application, what could we consider as of interest to discover through an experiment? Well, we are using HTTPS between the two services in our application, what if the certificate expired?

Tip

In such a simple setup, we appreciate that things will likely break and, in general there is no point to run an experiment when you already know the outcome. However, let\u2019s humor ourselves for the sake of learning the basics behind the Chaos Toolkit.

We can intuit things will fall apart if the sunset service cannot talk the astre service but, should the chain be part of much more complex graph of services, it could be difficult to fully understand all the branches that would be affected nor how badly. So, it may still be useful to experiment by injecting an expired certificate.

"},{"location":"reference/tutorial/#define-the-steady-state-hypothesis","title":"Define the Steady State Hypothesis","text":"

You can only learn if you know where you start from and what a good baseline for your application is.

Here we assume two things:

During our experiment, we will vary the conditions of the system and expect the state to remain valid.

"},{"location":"reference/tutorial/#changing-the-conditions","title":"Changing the Conditions","text":"

In this tutorial, we are going to set an expired certificate and restart the services. We will then call our application and see how it responds.

"},{"location":"reference/tutorial/#declare-an-experiment-to-observe-the-weakness","title":"Declare an Experiment to Observe the Weakness","text":"

At this stage, we can create an experiment that tells how the system behaves when a certificate expires.

JSON

```json { \u201ctitle\u201d: \u201cWhat is the impact of an expired certificate on our application chain?\u201d, \u201cdescription\u201d: \u201cIf a certificate expires, we should gracefully deal with the issue.\u201d, \u201ctags\u201d: [\u201ctls\u201d], \u201csteady-state-hypothesis\u201d: { \u201ctitle\u201d: \u201cApplication responds\u201d, \u201cprobes\u201d: [ { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cthe-astre-service-must-be-running\u201d, \u201ctolerance\u201d: true, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cos.path\u201d, \u201cfunc\u201d: \u201cexists\u201d, \u201carguments\u201d: { \u201cpath\u201d: \u201castre.pid\u201d } } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cthe-sunset-service-must-be-running\u201d, \u201ctolerance\u201d: true, \u201cprovider\u201d: { \u201ctype\u201d: \u201cpython\u201d, \u201cmodule\u201d: \u201cos.path\u201d, \u201cfunc\u201d: \u201cexists\u201d, \u201carguments\u201d: { \u201cpath\u201d: \u201csunset.pid\u201d } } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cwe-can-request-sunset\u201d, \u201ctolerance\u201d: 200, \u201cprovider\u201d: { \u201ctype\u201d: \u201chttp\u201d, \u201ctimeout\u201d: 3, \u201cverify_tls\u201d: false, \u201curl\u201d: \u201chttps://localhost:8443/city/Paris\u201d } } ] }, \u201cmethod\u201d: [ { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cswap-to-expired-cert\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201ccp\u201d, \u201carguments\u201d: \u201cexpired-cert.pem cert.pem\u201d } }, { \u201ctype\u201d: \u201cprobe\u201d, \u201cname\u201d: \u201cread-tls-cert-expiry-date\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201copenssl\u201d, \u201carguments\u201d: \u201cx509 -enddate -noout -in cert.pem\u201d } }, { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201crestart-astre-service-to-pick-up-certificate\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201cpkill\u201d, \u201carguments\u201d: \u201c\u2013echo -HUP -F astre.pid\u201d } }, { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201crestart-sunset-service-to-pick-up-certificate\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201cpkill\u201d, \u201carguments\u201d: \u201c\u2013echo -HUP -F sunset.pid\u201d }, \u201cpauses\u201d: { \u201cafter\u201d: 1 } } ], \u201crollbacks\u201d: [ { \u201ctype\u201d: \u201caction\u201d, \u201cname\u201d: \u201cswap-to-valid-cert\u201d, \u201cprovider\u201d: { \u201ctype\u201d: \u201cprocess\u201d, \u201cpath\u201d: \u201ccp\u201d, \u201carguments\u201d: \u201cvalid-cert.pem cert.pem\u201d } }, { \u201cref\u201d: \u201crestart-astre-service-to-pick-up-certificate\u201d }, { \u201cref\u201d: \u201crestart-sunset-service-to-pick-up-certificate\u201d } ]

} ```

YAML

title: What is the impact of an expired certificate on our application chain? description: If a certificate expires, we should gracefully deal with the issue. tags: - tls steady-state-hypothesis: title: Application responds probes: - type: probe name: the-astre-service-must-be-running tolerance: true provider: type: python module: os.path func: exists arguments: path: astre.pid - type: probe name: the-sunset-service-must-be-running tolerance: true provider: type: python module: os.path func: exists arguments: path: sunset.pid - type: probe name: we-can-request-sunset tolerance: 200 provider: type: http timeout: 3 verify_tls: false url: https://localhost:8443/city/Paris method: - type: action name: swap-to-expired-cert provider: type: process path: cp arguments: expired-cert.pem cert.pem - type: probe name: read-tls-cert-expiry-date provider: type: process path: openssl arguments: x509 -enddate -noout -in cert.pem - type: action name: restart-astre-service-to-pick-up-certificate provider: type: process path: pkill arguments: \u201c\u2013echo -HUP -F astre.pid\u201d - type: action name: restart-sunset-service-to-pick-up-certificate provider: type: process path: pkill arguments: \u201c\u2013echo -HUP -F sunset.pid\u201d pauses: after: 1 rollbacks: - type: action name: swap-to-valid-cert provider: type: process path: cp arguments: valid-cert.pem cert.pem - ref: restart-astre-service-to-pick-up-certificate - ref: restart-sunset-service-to-pick-up-certificate ```

"},{"location":"reference/tutorial/#yaml","title":"```yaml","text":""},{"location":"reference/tutorial/#the-various-sections-of-an-experiment","title":"The Various Sections of an Experiment","text":"

Let\u2019s now go through the experiment blocks.

The steady state hypothesis declares the various probes that will be applied as part of the hypothesis check.

The hypothesis is played twice. The first time before we do anything else to ensure the system is indeed in a normal state, here we check the services are running by looking up their PID files and we call the sunset service which should respond OK. The second time the hypothesis is applied is after the conditions were changed in the system, to validate it is still in a normal state.

The method is the block which changes the conditions of our system/application. Here, we swap the valid certificate for an expired one and restart the services by sending them a SIGHUP signal.

Finally, the rollback section (which is optional) tries to remediate to the changes we made, in this case by swapping back to the valid certificate.

"},{"location":"reference/tutorial/#different-kinds-of-activities","title":"Different Kinds of Activities","text":"

It is interesting to notice that the hypothesis uses probes while rollbacks are made of actions only. The method may use both. The reason is that the hypothesis is only about querying the system while rollbacks act on it. Finally, it is often useful to query the system while we change the conditions, for future analysis.

Probes and Actions are activities that do not differ in the way they work, it\u2019s only their goal that differs.

You can create activities that make HTTP calls, execute processes or perform more complex operations through extensions (often implemented in Python). This tutorial showcases a bit of all of those.

"},{"location":"reference/tutorial/#tolerances-in-the-hypothesis","title":"Tolerances in the Hypothesis","text":"

Hypothesis probes expect a tolerance property which tells the Chaos Toolkit how to validate a certain aspect of the state. In our example, tolerances are rather simple. We check file exists and that a HTTP request returns a status code of 200. Richer tolerances can be created by using regex or jsonpath.

"},{"location":"reference/tutorial/#run-the-experiment","title":"Run the Experiment","text":""},{"location":"reference/tutorial/#start-the-experiment-without-the-application","title":"Start the Experiment without the Application","text":"

To run the experiment, simply execute the following command:

chaos run experiment.json\n
[2018-05-14 18:38:04 INFO] Validating the experiment's syntax\n[2018-05-14 18:38:04 INFO] Experiment looks valid\n[2018-05-14 18:38:04 INFO] Running experiment: What is the impact of an expired certificate on our application chain?\n[2018-05-14 18:38:04 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:38:04 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:38:04 CRITICAL] Steady state probe 'the-astre-service-must-be-running' is not in the given tolerance so failing this experiment\n[2018-05-14 18:38:04 INFO] Let's rollback...\n[2018-05-14 18:38:04 INFO] Rollback: swap-to-valid-cert\n[2018-05-14 18:38:04 INFO] Action: swap-to-valid-cert\n[2018-05-14 18:38:04 INFO] Rollback: None\n[2018-05-14 18:38:04 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:38:04 INFO] Rollback: None\n[2018-05-14 18:38:04 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:38:04 INFO] Pausing after activity for 1s...\n[2018-05-14 18:38:05 INFO] Experiment ended with status: failed\n

Because we ran this command before we even started our application, our steady-state hypothesis failed and bailed the experiment immediately.

Note that the rollbacks will run anyway. They are only bypassed when you send a SIGINT or SIGTERM signal to the chaos process because the toolkit assumes you may want to review your system.

"},{"location":"reference/tutorial/#start-the-application","title":"Start the Application","text":"

You may now run the application.

First, copy the valid certificate as follows:

cp valid-cert.pem cert.pem\n

Next, start the services, in one terminal:

python3 astre.py\n

[14/May/2018:16:11:09] ENGINE Listening for SIGTERM.\n[14/May/2018:16:11:09] ENGINE Listening for SIGHUP.\n[14/May/2018:16:11:09] ENGINE Listening for SIGUSR1.\n[14/May/2018:16:11:09] ENGINE Bus STARTING\n[14/May/2018:16:11:09] ENGINE Serving on https://127.0.0.1:8444\n[14/May/2018:16:11:09] ENGINE Bus STARTE\n
Then, in another terminal:

python3 sunset.py\n
[14/May/2018:16:13:58] ENGINE Listening for SIGTERM.\n[14/May/2018:16:13:58] ENGINE Listening for SIGHUP.\n[14/May/2018:16:13:58] ENGINE Listening for SIGUSR1.\n[14/May/2018:16:13:58] ENGINE Bus STARTING\n[14/May/2018:16:13:58] ENGINE Serving on https://127.0.0.1:8443\n[14/May/2018:16:13:58] ENGINE Bus STARTED\n

Now you may perform a simple call:

curl -k https://localhost:8443/city/Paris\n
The sunset will occur at 2018-05-14T21:23:09+02:00 in Paris\n

What happens is that the sunset service performs a call to the astre service for the data and simply render them to you, as plain text. Both services are chained together over HTTPS.

"},{"location":"reference/tutorial/#run-the-experiment_1","title":"Run the Experiment","text":"

Now your application is running, execute the experiment once again:

chaos run experiment.json\n
[2018-05-14 18:41:09 INFO] Validating the experiment's syntax\n[2018-05-14 18:41:09 INFO] Experiment looks valid\n[2018-05-14 18:41:09 INFO] Running experiment: What is the impact of an expired certificate on our application chain?\n[2018-05-14 18:41:09 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:41:09 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:41:09 INFO] Probe: the-sunset-service-must-be-running\n[2018-05-14 18:41:09 INFO] Probe: we-can-request-sunset\n[2018-05-14 18:41:09 INFO] Steady state hypothesis is met!\n[2018-05-14 18:41:09 INFO] Action: swap-to-expired-cert\n[2018-05-14 18:41:09 INFO] Probe: read-tls-cert-expiry-date\n[2018-05-14 18:41:09 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:41:09 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:41:09 INFO] Pausing after activity for 1s...\n[2018-05-14 18:41:10 INFO] Steady state hypothesis: Application responds\n[2018-05-14 18:41:10 INFO] Probe: the-astre-service-must-be-running\n[2018-05-14 18:41:10 INFO] Probe: the-sunset-service-must-be-running\n[2018-05-14 18:41:10 INFO] Probe: we-can-request-sunset\n[2018-05-14 18:41:10 CRITICAL] Steady state probe 'we-can-request-sunset' is not in the given tolerance so failing this experiment\n[2018-05-14 18:41:10 INFO] Let's rollback...\n[2018-05-14 18:41:10 INFO] Rollback: swap-to-valid-cert\n[2018-05-14 18:41:10 INFO] Action: swap-to-valid-cert\n[2018-05-14 18:41:10 INFO] Rollback: None\n[2018-05-14 18:41:10 INFO] Action: restart-astre-service-to-pick-up-certificate\n[2018-05-14 18:41:10 INFO] Rollback: None\n[2018-05-14 18:41:10 INFO] Action: restart-sunset-service-to-pick-up-certificate\n[2018-05-14 18:41:10 INFO] Pausing after activity for 1s...\n[2018-05-14 18:41:11 INFO] Experiment ended with status: failed\n

Each activity is run in the order it appears in the experiment. Notice now how the hypothesis is not met after we swapped the certificates. But, we learn something interesting, even if expected, using an expired certificate does not prevent our services to even start.

"},{"location":"reference/tutorial/#report-on-your-findings","title":"Report on your Findings","text":""},{"location":"reference/tutorial/#review-the-journal-of-the-run","title":"Review the Journal of the Run","text":"

You may now review the journal generated by the run:

cat journal.json\n

It contains the activities runs and the output of each of them.

"},{"location":"reference/tutorial/#generate-a-report","title":"Generate a Report","text":"

You can generate a PDF (or HTML, markdown\u2026) report from the journal if you install the chaostoolkit-reporting plugin first:

chaos report --export-format=pdf journal.json report.pdf\n
"},{"location":"reference/tutorial/#learnings-and-responses","title":"Learnings and Responses","text":"

In this experiment, we proved what we guessed initially, that an expired certificate will create trouble and break the application for our users. What could be the responses?

For each of these potential responses, you could create an experiment should they unearth potential new questions.

"},{"location":"reference/tutorial/#next","title":"Next?","text":"

An experiment is never the end game. The flow should be continuous and you should create and run experiments regularly.

"},{"location":"reference/walkthrough/","title":"Learning Chaos Toolkit by Practicing","text":"

You can find progressive labs here to help you use Chaos Toolkit in much more realistic settings than the base tutorials.

"},{"location":"reference/api/experiment/","title":"An Open API for Chaos Engineering Experiments","text":""},{"location":"reference/api/experiment/#introduction","title":"Introduction","text":"

The purpose of this specification is to formalize the elements of a Chaos Engineering experiment and offer a way to federate the community around a common syntax and semantic.

As a fairly recent field, Chaos Engineering is a dynamic and its foundations are still emerging. However, it appears certain concepts are settling down enough to start agreeing on a shared understanding.

This specification is not prescriptive and does not aim at forcing the community into one direction, rather it strives at providing a common vocabulary that new practitioners can easily make sense of.

It is necessary to appreciate that this document does not specify what tools, such as the Chaos Monkey or similar, should look like. Instead, this document specifies how Chaos Engineering Experiment could be described, shared and conducted collaboratively.

"},{"location":"reference/api/experiment/#conventions-used-in-this-document","title":"Conventions Used in This Document","text":"

The key words \u201cMUST\u201d, \u201cMUST NOT\u201d, \u201cREQUIRED\u201d, \u201cSHALL\u201d, \u201cSHALL NOT\u201d, \u201cSHOULD\u201d, \u201cSHOULD NOT\u201d, \u201cRECOMMENDED\u201d, \u201cMAY\u201d, and \u201cOPTIONAL\u201d in this document are to be interpreted as described in RFC 2119.

The terms \u201cJSON\u201d, \u201cJSON text\u201d, \u201cJSON value\u201d, \u201cmember\u201d, \u201celement\u201d, \u201cobject\u201d, \u201carray\u201d, \u201cnumber\u201d, \u201cstring\u201d, \u201cboolean\u201d, \u201ctrue\u201d, \u201cfalse\u201d, and \u201cnull\u201d in this document are to be interpreted as defined in RFC 7159.

"},{"location":"reference/api/experiment/#other-formats","title":"Other formats","text":"

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

"},{"location":"reference/api/experiment/#chaos-engineering-elements","title":"Chaos Engineering Elements","text":""},{"location":"reference/api/experiment/#overview","title":"Overview","text":"

An Experiment is one possible description of the principles of the Chaos Engineering. The intention of such a description is to provide shared understanding around a hypothesis on how to discover system\u2019s behavior under certain conditions.

An Experiment declares a steady state hypothesis, alongside probes to validate this steady state is met, and a method as a sequence actions and probes, to interact and query the system respectively.

By using a variety of probes, experiments should gather information to sense behaviors in the system, potentially leading to systemic patterns that can be stabilized.

"},{"location":"reference/api/experiment/#experiment","title":"Experiment","text":"

A Chaos Engineering experiment, or simply an experiment, describes both the elements and the order in which they should be applied.

An experiment is a JSON object.

An experiment MUST declare:

The experiment\u2019s title and description are meant for humans and therefore should be as descriptive as possible to clarify the experiment\u2019s rationale.

Title and description are JSON strings with no maximum length.

An experiment SHOULD also declare:

An experiment MAY finally declare:

Tags provide a way of categorizing experiments. It is a sequence of JSON strings.

Extensions define opaque payloads for vendors to carry valuable information.

Contribution describes valuable properties of the target system, such as \u201creliability\u201d or \u201cdurability\u201d, that an experiment contribute to. This information can be aggregated together with other experiments\u2019 contributions to better appreciate where the focus is put and where it is not.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#steady-state-hypothesis","title":"Steady State Hypothesis","text":"

The Steady State Hypothesis element describes what normal looks like in your system before the Method element is applied. If the steady state is not met, the Method element is not applied and the experiment MUST bail out.

The Steady State Hypothesis element is a JSON object.

Steady State Hypothesis element MUST declare:

The title is meant for humans and therefore should clarify the rationale for this hypothesis.

Each Probe MUST define a tolerance property that acting as a gate mechanism for the experiment to carry on or bail. Any Probe that does not fall into the tolerance zone MUST fail the experiment.

Steady State Hypothesis element MAY declare:

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#steady-state-probe-tolerance","title":"Steady State Probe Tolerance","text":"

Probes of the Steady State Hypothesis MUST declare an additional property named tolerance.

The tolerance property\u2019s value MUST be one of:

In the case of a scalar or the sequence, the tolerance validation MUST be strict. The value returned by the Probe MUST be checked against the scalar value. The experiment MUST bail when both fail to match.

When the tolerance is a sequence. If it has only two values, those two values represent a lower and upper bound within which the Probe returned value must fall (inclusive).

When the sequence has more than two elements, the Probe returned value must be contained in that sequence.

When the tolerance is an object, it MUST have a type property which MUST be one of the followings: \"probe\", \"regex\", \"jsonpath\" or \"range\".

When the type property is \"probe\", the object MUST be a Probe that is applied. The probe should take two arguments, value and secrets where the value is the Probe returned value and secrets a Secret object or null. Its returned status MUST be successful for the tolerance to be considered valid.

When the type property is \"regex\", the object MUST have a pattern property which MUST be a valid regular expression. The tolerance succeeds if the Probe returned value is matched against the pattern. Object MAY have a target property which MUST be a valid value returned for a given provider.

When the type property is \"jsonpath\", the object MUST have a path property which MUST be a valid JSON Path. In addition, the object MAY have a expect property which is used to compare each value matched by the JSON Path to that value. The expect property value MUST be a scalar. When the expect property is not present, the tolerance succeeds if the JSON Path matched at least one item.

When the type property is \"range\", the object MUST have a range property which MUST be a sequence of length two. The first entry of the sequence MUST be the lower bound and the second entry MUST be the upper bound. Both entries MUST be JSON numbers.

In addition, when the Probe returned value is an object with a status property, the tested value is the value of that property.

Some examples of tolerance properties.

A boolean tolerance:

JSONYAML
\"tolerance\": true\n
tolerance: true\n

A integer tolerance:

JSONYAML
\"tolerance\": 8\n
tolerance: 8\n

A string tolerance:

JSONYAML
\"tolerance\": \"OK\"\n
tolerance: \"OK\"\n

A sequence tolerance with lower and upper bounds:

JSONYAML
\"tolerance\": [4, 9]\n
tolerance:\n- 4\n- 9\n

A sequence tolerance, the value must be contained in that sequence:

JSONYAML
\"tolerance\": [4, 9, 78]\n
tolerance:\n- 4\n- 9\n- 78\n

A Probe tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"probe\",\n\"name\": \"should-exist\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n}\n}\n
tolerance:\ntype: probe\nname: should-exist\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: some/file\n

A regex tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"regex\",\n\"pattern\": \"[0-9]{3}\"\n}\n
tolerance:\ntype: regex\npattern: '[0-9]{3}'\n

A regex tolerance with a non default target:

JSONYAML
\"tolerance\": {\n\"type\": \"regex\",\n\"target\": \"stdout\",\n\"pattern\": \"[0-9]{2}\"\n}\n
tolerance:\ntype: regex\ntarget: stdout\npattern: '[0-9]{2}'\n

A jsonpath tolerance:

JSONYAML
\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"foo[*].baz\"\n}\n
tolerance:\ntype: jsonpath\npath: 'foo[*].baz'\n

A jsonpath tolerance with an expected value to match:

JSONYAML
\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"foo[*].baz\",\n\"expect\": 4\n}\n
tolerance:\ntype: jsonpath\npath: 'foo[*].baz'\nexpect: 4\n

Two range tolerances:

JSONYAMLJSONYAML
\"tolerance\": {\n\"type\": \"range\",\n\"range\": [4, 8]\n}\n
tolerance:\ntype: range\nrange:\n- 4\n- 8\n
\"tolerance\": {\n\"type\": \"range\",\n\"range\": [4.6, 8.9]\n}\n
tolerance:\ntype: range\nrange:\n- 4.6\n- 8.9\n
"},{"location":"reference/api/experiment/#contributions","title":"Contributions","text":"

Contributions describe the valuable system properties an experiment targets as well as how much they contributes to it. Those properties usually refer to aspects stakeholders care about. Aggregated they offer a powerful metric about the effort and focus on building confidence across the system.

Contributions are declared under the top-level contributions property as an object. Properties of that object MUST be JSON strings representing the name of a contribution. The values MUST be the weight of a given contribution and MUST be one of \"high\", \"medium\", \"low\" or \"none\". The \"none\" value is not the same as a missing contribution from the contributions object. That value marks explicitly that a given contribution is not addressed by an experiment. A missing contribution means impact via this experiment is unknown for this contribution.

Here is a contribution example:

JSONYAML
\"contributions\": {  \"reliability\": \"high\",\n\"security\": \"none\",\n\"scalability\": \"medium\"\n}\n
contributions:\nreliability: high\nsecurity: none\nscalability: medium\n

This sample tells us that the experiment contributes mainly to exploring reliability of the system and moderately to its scalability. However, it is explicit here this experiment does not address security.

On the other hand:

JSONYAML
\"contributions\": {  \"reliability\": \"high\",\n\"scalability\": \"medium\"\n}\n
contributions:\nreliability: high\nscalability: medium\n

This tells us the same about reliability and scalability but we can\u2019t presume anything about security.

"},{"location":"reference/api/experiment/#method","title":"Method","text":"

The Method describes the sequence of Probe and Action elements to apply. The Method is declared under method property at the top-level of the experiment.

The method MAY have at least one element which can be either a Probe or an Action.

The elements MUST be applied in the order they are declared.

An empty method is allowed for running experiments with Steady States Hypothesis only.

"},{"location":"reference/api/experiment/#probe","title":"Probe","text":"

A Probe collects information from the system during the experiment.

A Probe is a JSON object. A Probe is declared fully or reference another Probe through the ref property.

When declared fully, a Probe MUST declare:

The type property MUST be the JSON string \"probe\".

The name property is a free-form JSON string that MAY be considered as an identifier within the experiment.

It MAY also declare:

The configuration property MUST be a JSON string referencing an identifier declared in the top-level configuration property. It is assumed that when not declared, the Probe requires no configuration.

The background property MUST be a JSON boolean value either true or false. It is assumed that, when that property is not declared, it is set to false. When that property is set to true it indicates the Probe MUST not block and the next Action or Probe should immediately be applied.

When a Probe references another Probe in the Experiment, the Probe MUST declare a single property called ref.

The ref property MUST be a JSON string which MUST be the name of a declared Probe.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#action","title":"Action","text":"

An Action performs an operation against the system.

An Action collects information from the system during the experiment.

An Action is a JSON object. An Action is declared fully or reference another Action through the ref property.

When declared fully, a Action MUST declare:

The type property MUST be the JSON string \"action\".

The name property is a free-form JSON string that MAY be considered as an identifier within the experiment.

It MAY also declare:

The configuration property MUST be a JSON string referencing an identifier declared in the top-level configuration property. It is assumed that when not declared, the Action requires no configuration.

The background property MUST be a JSON boolean value either true or false. It is assumed that, when that property is not declared, it is set to false. When that property is set to true it indicates the Action MUST not block and the next Action or Probe should immediately be applied.

The pauses property MUST be a JSON object which MAY have one or the two following properties:

In both cases, the value MUST be JSON number indicating the number of seconds to wait before continuing. The before pause MUST be performed before the Action while the after MUST be performed afterwards.

When a Action references another Action in the Experiment, the Action MUST declare a single property called ref.

The ref property MUST be a JSON string which MUST be the name of a declared Action.

Controls describe out-of-band capabilities applied during the experiment\u2019s execution.

"},{"location":"reference/api/experiment/#action-or-probe-provider","title":"Action or Probe Provider","text":"

A provider MUST be a JSON object which MUST declare a type property that decides the other expected properties.

The type property MUST be one of \"python\", \"http\" or \"process\".

Info

This specification only mentions those three providers but it could grow to support more, such as \"go\", \"rust\" or \"grpc\"\u2026

"},{"location":"reference/api/experiment/#python-provider","title":"Python Provider","text":"

A Python Provider declares a Python function to be applied.

A Python Provider MUST declare the following:

It SHOULD also declare an arguments property when the function expects them.

The module property is the fully qualified module exposing the function. It MUST be a JSON string.

The func property is the name of the function to apply. It MUST be a JSON string.

When provided, the arguments property MUST be a JSON object which properties are the names of the function\u2019s arguments. When a function\u2019s signature has default values for some of its arguments, those MAY be omitted from the arguments object. In that case, those default values will be used.

Argument values MUST be valid JSON entities.

In addition, the provider object MAY declare a secrets property. This secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

"},{"location":"reference/api/experiment/#http-provider","title":"HTTP Provider","text":"

A HTTP Provider declares a URL to be called.

A HTTP Provider MUST declare the following:

The url property MUST be a JSON string representing a URL as per RFC 3986.

In addition, the provider object MAY declare any of the followings:

The method property MUST be a JSON string, such as \"POST\", as per RFC 7231. It defaults to \"GET\".

The headers property MUST be a JSON object which properties are header names and values are header values, as per RFC 7231.

When provided, the arguments property MUST be a JSON object which properties are parameters of the HTTP request.

When method is \"GET\", the arguments are mapped as a query-string of the URL. Otherwise, the arguments are passed as the request body\u2019s data and the encoding depends on the \"Content-Type\" provided in the headers object.

The timeout property MUST be either a JSON number specifying how long the request should take to complete. Or a JSON array that MUST made of two JSON numbers, the first one indicating the connection timeout, the second the request timeout to respond.

The secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

The HTTP provider MUST return an object with the following properties:

"},{"location":"reference/api/experiment/#process-provider","title":"Process Provider","text":"

A Process Provider declares a process to be called.

A Process Provider MUST declare the following:

The path property MUST be a JSON string of a path to an executable.

In addition, the provider object MAY declare any of the followings:

The arguments property MUST be a JSON array or a JSON string which defines the process arguments. Those arguments are passed in order to the process arguments.

The timeout property MUST be a JSON number specifying how long the process should take to complete.

The secrets property MUST be a JSON array of JSON strings referencing identifiers declared in the top-level secrets property. It is assumed that when not declared, the Action requires no secrets.

The Process provider MUST return an object with the following properties:

"},{"location":"reference/api/experiment/#rollbacks","title":"Rollbacks","text":"

Rollbacks declare the sequence of actions that attempt to put the system back to its initial state.

The experiment MAY declare a single rollbacks property which is a JSON array consisting of Actions.

A failed rollback MUST not bail the sequence of rollbacks.

"},{"location":"reference/api/experiment/#secrets","title":"Secrets","text":"

Secrets declare values that need to be passed on to Actions or Probes in a secure manner.

The secrets property MUST be a JSON object. Its properties are identifiers referenced by Actions and Probes.

The value of each identifier is a JSON object which properties are the secrets keys and the properties values are the secrets values.

Referenced secrets MUST be injected into probes and actions when they are applied. Probes and actions MUST NOT modify the secrets.

Secrets MUST be passed a mapping of keys and values to probes and actions.

An example of a secrets element at the top-level:

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": \"XYZ\"\n}\n}\n}\n
secrets:\nkubernetes:\ntoken: XYZ\n

This can then referenced from probes or actions:

JSONYAML
{\n\"type\": \"probe\",\n\"secrets\": \"kubernetes\"\n}\n
type: probe\nsecrets: kubernetes\n
"},{"location":"reference/api/experiment/#inline-secrets","title":"Inline Secrets","text":"

Secrets MAY be inlined in the Experiment directly.

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": \"ABCDEF-1234-XYZ\"\n}\n}\n}\n
secrets:\nkubernetes:\ntoken: ABCDEF-1234-XYZ\n
"},{"location":"reference/api/experiment/#environment-secrets","title":"Environment Secrets","text":"

Secrets MAY be retrieved from the environment. In that case, they must be declared as a JSON object with a type property set to \"env\". The environment variable MUST be declared in the key property as a JSON string.

JSONYAML
{\n\"secrets\": {\n\"kubernetes\": {\n\"token\": {\n\"type\": \"env\",\n\"key\": \"KUBERNETES_TOKEN\"\n}\n}\n}\n}\n
secrets:\nkubernetes:\ntoken:\ntype: env\nkey: KUBERNETES_TOKEN\n
"},{"location":"reference/api/experiment/#vault-secrets","title":"Vault Secrets","text":"

Secrets MAY be retrieved from a HashiCorp vault instance. In that case, they must be declared as a JSON object with a type property set to \"vault\". The path to the key MUST be declared in the path property as a JSON string.

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\n

When only the path property is set, the whole secrets payload at the given path MUST be set to the Chaos Toolkit secret key.

A key property MAY be set to select a specific value from the Vault secret payload.

The Vault url MUST be provided in the Configuration section via the \"vault_addr\" property.

Vault authentication MUST at least support:

The Vault KV secrets version MAY be provided via the \"vault_kv_version\" Configuration key. If not provided, it MUST default to \"2\".

Examples:

Vault secret at path secret/something:

JSONYAML
{\n\"foo\": \"bar\",\n\"baz\": \"hello\"\n}\n
foo: bar\nbaz: hello\n

Then in your Chaos Toolkit experiment:

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\n

means the secrets will become:

JSONYAML
\"token\": {\n\"foo\": \"bar\",\n\"baz\": \"hello\"\n}\n
token:\nfoo: bar\nbaz: hello\n

However:

JSONYAML
{\n\"secrets\": {\n\"myapp\": {\n\"token\": {\n\"type\": \"vault\",\n\"path\": \"secrets/something\",\n\"key\": \"foo\"\n}\n}\n}\n}\n
secrets:\nmyapp:\ntoken:\ntype: vault\npath: secrets/something\nkey: foo\n

means the secrets will become:

JSONYAML
\"token\": \"bar\"\n
token: bar\n
"},{"location":"reference/api/experiment/#configuration","title":"Configuration","text":"

Configuration is meant to provide runtime values to actions and probes.

The configuration element MUST be a JSON object. The value of each property MUST be a JSON string, number, or object whose properties are considered the configuration lookup. Configuration must be passed to all Probes and actions requiring it. Probes and actions MUST NOT modify the configuration.

Configurations MUST be passed a mapping of keys and values to probes and actions.

An example of a configuration element at the top level:

JSONYAML
{\n\"configuration\": {\n\"some_service\": \"http://127.0.0.1:8080\",\n\"vault_addr\": {\n\"type\": \"env\",\n\"key\": \"VAULT_ADDR\"\n}\n}\n}\n
configuration:\nsome_service: 'http://127.0.0.1:8080'\nvault_addr:\ntype: env\nkey: VAULT_ADDR\n
"},{"location":"reference/api/experiment/#inline-configurations","title":"Inline Configurations","text":"

Configurations MAY be inlined in the Experiment directly.

JSONYAML
{\n\"configuration\": {\n\"some-service\": \"http://127.0.0.1:8080\"\n}\n}\n
configuration:\nsome-service: 'http://127.0.0.1:8080'\n
"},{"location":"reference/api/experiment/#environment-configurations","title":"Environment Configurations","text":"

Configurations MAY be retrieved from the environment. In that case, they must be declared as a JSON object with a type property set to \"env\". The environment variable MUST be declared in the key property as a JSON string.

The default key is OPTIONAL and MAY be used when the environment variable can be undefined and fallback to a default value for the experiment.

JSONYAML
{\n\"configuration\": {\n\"vault_addr\": {\n\"type\": \"env\",\n\"key\": \"VAULT_ADDR\",\n\"default\": \"https://127.0.0.1:8200\"\n}\n}\n}\n
configuration:\nvault_addr:\ntype: env\nkey: VAULT_ADDR\ndefault: 'https://127.0.0.1:8200'\n
"},{"location":"reference/api/experiment/#variable-substitution","title":"Variable Substitution","text":"

Probes and Actions argument values MAY be dynamically resolved at runtime.

Dynamic values MUST follow the syntax ${name} where name is an identifier declared in either the Configuration or Secrets sections. When name is declared in both sections, the Configuration section MUST take precedence.

Dynamic values MUST be substituted before being passed to Probes or Actions.

Other values, such as the HTTP Probe url, MAY be substituted as well.

"},{"location":"reference/api/experiment/#controls","title":"Controls","text":"

Controls describe out-of-band capabilities applied when the experiment is executed. Controls are used to declare operations that should be carried by external tools.

Controls MAY be declared at each of the following levels:

Controls MUST be applied before and after each of those levels. Schematically, this looks like this:

apply experiment control before experiment starts\nstart experiment\n    apply steady state control before steady-state probes are started\n        start steady-state processing\n            apply activity control before each probe is applied\n            run each probe\n            apply activity control after each probe is applied\n    apply steady state control after steady-state probes have completed\n    apply steady state control before method activities are started\n        start method processing\n            apply activity control before each activity is applied\n            run each activity\n            apply activity control after each activity is applied\n    apply steady state control after method activities have completed\n    apply steady state control before rollback activities are started\n        start rollback processing\n            apply activity control before each activity is applied\n            run each activity\n            apply activity control after each activity is applied\n    apply steady state control after rollback activities have completed\napply experiment control after experiment completes\n

Controls MAY be omitted anywhere and MUST NOT be applied at a level they are not declared.

Controls MUST NOT fail the experiment\u2019s execution due to unforeseen conditions.

Controls are declared with the controls property which is set to a JSON array.

Controls MAY modify Configuration and Secrets. In that case changes MUST be made visible to the experiment.

An item of that array MUST be a control, which is a JSON object which MUST have the following properties:

The provider object indicates which implementation of the control to use. It MUST declare the following properties:

A control object MAY also declare the following property:

The scope value MUST be one of \"before\" or \"after\". When the scope property is omitted, the control MUST be applied before and after. When the scope property is set, the control MUST be applied only on that scope.

When the automatic property is set to false, it MUST be understood that the control cannot be applied anywhere but where it is declared.

Examples of Controls:

Just a generic declaration of a control at the top-level of the experiment:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nprovider:\ntype: python\nmodule: chaostracing.control\n

Another control by applied only as post-control:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"scope\": \"post\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nscope: post\nprovider:\ntype: python\nmodule: chaostracing.control\n

Finally, a top-level level control not applied anywhere else down the tree:

JSONYAML
\"controls\": [\n{\n\"name\": \"tracing\",\n\"automatic\": false,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n]\n
controls:\n- name: tracing\nautomatic: false\nprovider:\ntype: python\nmodule: chaostracing.control\n
"},{"location":"reference/api/experiment/#extensions","title":"Extensions","text":"

An Experiment MAY declare an extensions property which MUST be an array of objects. Each object MUST declare a non-empty name property.

Extensions are used in two scenarios:

In both cases, their actual usage is runtime dependent, this specification does not declare any meaning to an extension.

Below is an example of an Extension:

JSONYAML
{\n\"extensions\": [{\n\"name\": \"vendorX\",\n\"data\": \"...\"\n}]\n}\n
extensions:\n- name: vendorX\ndata: ...\n
"},{"location":"reference/api/experiment/#examples","title":"Examples","text":"

The following examples MUST NOT be considered normative.

"},{"location":"reference/api/experiment/#minimal-experiment","title":"Minimal Experiment","text":"

Here is an example of the most minimal experiment:

JSONYAML
{\n\"title\": \"Moving a file from under our feet is forgivable\",\n\"description\": \"Our application should re-create a file that was removed\",\n\"contributions\": {\n\"reliability\": \"high\",\n\"availability\": \"high\"\n},\n\"steady-state-hypothesis\": {\n\"title\": \"The file must be around first\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"file-must-exist\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"file-be-gone\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os\",\n\"func\": \"remove\",\n\"arguments\": {\n\"path\": \"some/file\"\n}\n},\n\"pauses\": {\n\"after\": 5\n}\n},\n{\n\"ref\": \"file-must-exist\"\n}\n]\n}\n
title: Moving a file from under our feet is forgivable\ndescription: Our application should re-create a file that was removed\ncontributions:\nreliability: high\navailability: high\nsteady-state-hypothesis:\ntitle: The file must be around first\nprobes:\n- type: probe\nname: file-must-exist\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: some/file\nmethod:\n- type: action\nname: file-be-gone\nprovider:\ntype: python\nmodule: os\nfunc: remove\narguments:\npath: some/file\npauses:\nafter: 5\n- ref: file-must-exist\n
"},{"location":"reference/api/experiment/#more-complex-experiment","title":"More Complex Experiment","text":"

Below is an example of a fully featured experiment that uses various extensions to perform actions, probing and steady-state hypothesis validation.

JSONYAML
{\n\"title\": \"Are our users impacted by the loss of a function?\",\n\"description\": \"While users query the Astre function, they should not be impacted if one instance goes down.\",\n\"contributions\": {\n\"reliability\": \"high\",\n\"availability\": \"high\",\n\"performance\": \"medium\",\n\"security\": \"none\"\n},\n\"tags\": [\n\"kubernetes\",\n\"openfaas\",\n\"cloudnative\"\n],\n\"configuration\": {\n\"prometheus_base_url\": \"http://demo.foo.bar\"\n},\n\"secrets\": {\n\"global\": {\n\"auth\": \"Basic XYZ\"\n}\n},\n\"controls\": [\n{\n\"name\": \"tracing\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaostracing.control\"\n}\n}\n],\n\"steady-state-hypothesis\": {\n\"title\": \"Function is available\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"function-must-exist\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"secrets\": [\"global\"],\n\"url\": \"http://demo.foo.bar/system/function/astre\",\n\"headers\": {\n\"Authorization\": \"${auth}\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"function-must-respond\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": [3, 5],\n\"secrets\": [\"global\"],\n\"url\": \"http://demo.foo.bar/function/astre\",\n\"method\": \"POST\",\n\"headers\": {\n\"Content-Type\": \"application/json\",\n\"Authorization\": \"${auth}\"\n},\n\"arguments\": {\n\"city\": \"Paris\"\n}\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"simulate-user-traffic\",\n\"background\": true,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"vegeta\",\n\"arguments\": \"-cpus 2 attack -targets=data/scenario.txt -workers=2 -connections=1 -rate=3 -timeout=3s -duration=30s -output=result.bin\"\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"terminate-one-function\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.actions\",\n\"func\": \"terminate_pods\",\n\"arguments\": {\n\"ns\": \"openfaas-fn\",\n\"label_selector\": \"faas_function=astre\",\n\"rand\": true\n}\n},\n\"pauses\": {\n\"before\": 5\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"fetch-openfaas-gateway-logs\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosk8s.pod.probes\",\n\"func\": \"read_pod_logs\",\n\"arguments\": {\n\"label_selector\": \"app=gateway\",\n\"last\": \"35s\",\n\"ns\": \"openfaas\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"query-total-function-invocation\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosprometheus.probes\",\n\"func\": \"query_interval\",\n\"secrets\": [\"global\"],\n\"arguments\": {\n\"query\": \"gateway_function_invocation_total{function_name='astre'}\",\n\"start\": \"1 minute ago\",\n\"end\": \"now\",\n\"step\": 1\n}\n}\n}\n],\n\"rollbacks\": []\n}\n
---\ntitle: Are our users impacted by the loss of a function?\ndescription: While users query the Astre function, they should not be impacted if one instance goes down.\ncontributions:\nreliability: high\navailability: high\nperformance: medium\nsecurity: none\ntags:\n- kubernetes\n- openfaas\n- cloudnative\nconfiguration:\nprometheus_base_url: http://demo.foo.bar\nsecrets:\nglobal:\nauth: Basic XYZ\ncontrols:\n- name: tracing\nprovider:\ntype: python\nmodule: chaostracing.control\nsteady-state-hypothesis:\ntitle: Function is available\nprobes:\n- type: probe\nname: function-must-exist\ntolerance: 200\nprovider:\ntype: http\nsecrets:\n- global\nurl: http://demo.foo.bar/system/function/astre\nheaders:\nAuthorization: \"${auth}\"\n- type: probe\nname: function-must-respond\ntolerance: 200\nprovider:\ntype: http\ntimeout:\n- 3\n- 5\nsecrets:\n- global\nurl: http://demo.foo.bar/function/astre\nmethod: POST\nheaders:\nContent-Type: application/json\nAuthorization: \"${auth}\"\narguments:\ncity: Paris\nmethod:\n- type: action\nname: simulate-user-traffic\nbackground: true\nprovider:\ntype: process\npath: vegeta\narguments: \"-cpus 2 attack -targets=data/scenario.txt -workers=2 -connections=1 -rate=3 -timeout=3s -duration=30s -output=result.bin\"\n- type: action\nname: terminate-one-function\nprovider:\ntype: python\nmodule: chaosk8s.pod.actions\nfunc: terminate_pods\narguments:\nns: openfaas-fn\nlabel_selector: faas_function=astre\nrand: true\npauses:\nbefore: 5\n- type: probe\nname: fetch-openfaas-gateway-logs\nprovider:\ntype: python\nmodule: chaosk8s.pod.probes\nfunc: read_pod_logs\narguments:\nlabel_selector: app=gateway\nlast: 35s\nns: openfaas\n- type: probe\nname: query-total-function-invocation\nprovider:\ntype: python\nmodule: chaosprometheus.probes\nfunc: query_interval\nsecrets:\n- global\narguments:\nquery: gateway_function_invocation_total{function_name='astre'}\nstart: 1 minute ago\nend: now\nstep: 1\nrollbacks: []\n
"},{"location":"reference/api/journal/","title":"Experiment Journal","text":""},{"location":"reference/api/journal/#introduction","title":"Introduction","text":"

This document describes the syntax and grammar of a Chaos Engineering experiment\u2019s output, called a journal. One should be able to walkthrough the experiment\u2019s run through its journal alone.

This specification makes sense in regards to the Experiment specification itself. It is indeed a mirror to that document.

"},{"location":"reference/api/journal/#conventions-used-in-this-document","title":"Conventions Used in This Document","text":"

The key words \u201cMUST\u201d, \u201cMUST NOT\u201d, \u201cREQUIRED\u201d, \u201cSHALL\u201d, \u201cSHALL NOT\u201d, \u201cSHOULD\u201d, \u201cSHOULD NOT\u201d, \u201cRECOMMENDED\u201d, \u201cMAY\u201d, and \u201cOPTIONAL\u201d in this document are to be interpreted as described in RFC 2119.

The terms \u201cJSON\u201d, \u201cJSON text\u201d, \u201cJSON value\u201d, \u201cmember\u201d, \u201celement\u201d, \u201cobject\u201d, \u201carray\u201d, \u201cnumber\u201d, \u201cstring\u201d, \u201cboolean\u201d, \u201ctrue\u201d, \u201cfalse\u201d, and \u201cnull\u201d in this document are to be interpreted as defined in RFC 7159.

"},{"location":"reference/api/journal/#other-formats","title":"Other formats","text":"

While this specification uses JSON to define its elements, implementations may allow loading from other formats, such as YAML. As long as the output of such format respects the specification herein.

"},{"location":"reference/api/journal/#journal-elements","title":"Journal Elements","text":""},{"location":"reference/api/journal/#overview","title":"Overview","text":"

A Journal is one potential output of a Chaos Engineering experiment. The objective of such journal is to collect all events that took place during the experiment\u2019s run.

The journal contains static information, such as the experiment that was run, as well as runtime entries.

"},{"location":"reference/api/journal/#format","title":"Format","text":"

A journal is a JSON object.

"},{"location":"reference/api/journal/#required-properties","title":"Required Properties","text":"

A journal MUST declare:

The experiment property MUST be a copy of the run experiment as-is and is therefore a JSON object. It MUST follow the Experiment definition.

The \u0300status property MUST be a JSON string, one of:

Note

It is important to understand the \"completed\" status expresses that everything ran all the way. An action may not have resulted in what the operator wanted but it did not fail. Always review the entire journal to fully appreciate the actual outcome of the experiment.

There are two reasons it could be marked as \"failed\". Either a tolerance failed or if an extension made a check for a condition. So, for instance, let\u2019s say the extension made a HTTP call to your service, that call returned a 400 rather than 200. If the extension was not designed to care for this difference, then the status will be marked as \"completed\". However, if the extension validated the HTTP response, it may have decided to fail the action which would lead to a \u0300 \u201cfailed\u201d` status.

The \"aborted\" and \"interrupted\" are different, the former means of a crash somehow (say, because of a bug). The latter indicates a signal was received. Both MUST bail the entire process.

The deviated property MUST be a boolean flag that MUST be set to true when the steady-state was executed after the experimental method but reported that, at least, one of its probes failed to match the expected tolerance.

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

"},{"location":"reference/api/journal/#recommended-properties","title":"Recommended Properties","text":"

In addition to those required properties, the journal SHOULD also declare the followings:

The steady_states property MUST be a JSON object defining the result of the steady state hypothesis outcome.

The run property MUST be a JSON array defining the result of each activity in the method element of the experiment.

The rollbacks property MUST be a JSON array defining the result of each action in the rollbacks element of the experiment.

"},{"location":"reference/api/journal/#optional-properties","title":"Optional Properties","text":"

In addition to those required properties, the journal MAY also declare the followings:

The platform property MUST be a JSON string defining the machine on which the experiment was executed. The content is free form but may be similar to the output of the uname -a command.

The node property MUST be a JSON string representing the name of the machine where the experiment was run. The content is free form.

"},{"location":"reference/api/journal/#steady-state","title":"Steady State","text":"

The steady_states property holds the outcomes of the steady state hypothesis.

The steady_states property MAY declare the following properties:

The before property MUST be a JSON object describing the outcome of the hypothesis run before the method is executed.

The after property MUST be a JSON object describing the outcome of the hypothesis run after the method is executed.

Notice that either of those properties MAY be missing if they were not run.

"},{"location":"reference/api/journal/#steady-state-outcomes","title":"Steady State Outcomes","text":"

Both the before and after properties follow the same definition.

The steady_state_met property MUST be a JSON boolean. It MUST be true if the steady state hypothesis was met, false otherwise.

A steady state is met when all its probes matched their tolerance. A steady state is not met at the first non-matching tolerance probe.

The probes property MUST be a JSON array of probes results.

Each probe result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed probe.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The tolerance_met MUST be a JSON boolean indicating if the probe matched its tolerance or not.

The output MUST be a JSON string or null.

In addition, the probe result MAY contain an additional property:

This property is set when the probe failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

"},{"location":"reference/api/journal/#run","title":"Run","text":"

The run property holds the outcomes of the method element.

The run property MUST be a JSON array of activity results.

Each activity result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed probe or action.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

This property is set when the activity failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

"},{"location":"reference/api/journal/#rollbacks","title":"Rollbacks","text":"

The rollbacks property holds the outcomes of the rollbacks element.

The rollbacks property MUST be a JSON array of action results.

Each action result MUST declare the following properties:

The activity property MUST be a JSON object, a raw copy of the executed action.

The status property MUST be a JSON string, one of \"succeeded\" or \"failed\".

The start property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The end property MUST be a JSON string formatted as per RFC 3339 in UTC timezone.

The duration MUST be a JSON number of difference between the end datetime and the start datetime.

The output MUST be a JSON string or null.

In addition, the activity result MAY contain an additional property:

This property is set when the action failed in an unforeseeable way and MUST be a JSON array or JSON string of the error trace.

Rollbacks MUST NOT to be applied when the experiment status is \"interrupted\".

"},{"location":"reference/developing/core/","title":"Core Projects","text":"

The Chaos Toolkit is made of several projects that work together to provide its service.

"},{"location":"reference/developing/core/#chaostoolkit","title":"chaostoolkit","text":"

The chaostoolkit project is the command-line interface (CLI), in other words the command executed by users to run their experiments.

That project tries to remain as shallow as possible, only providing the user interface commands by gluing other projects together.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-lib","title":"chaostoolkit-lib","text":"

The chaostoolkit-lib project is the core library which implements the core concepts of the Chaos Toolkit.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-documentation","title":"chaostoolkit-documentation","text":"

The chaostoolkit-documentation is the documentation source and renderer of the Chaos Toolkit. Namely, that project generates the website you are currently reading.

This project is implemented in Python 3 by generating HTML from Markdown documents.

"},{"location":"reference/developing/core/#chaostoolkit-kubernetes","title":"chaostoolkit-kubernetes","text":"

The chaostoolkit-kubernetes project is the Kubernetes extension.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-addons","title":"chaostoolkit-addons","text":"

The chaostoolkit-addons project is a set of addons for Chaos Toolkit: useful controls, probes, actions and tolerances.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-reporting","title":"chaostoolkit-reporting","text":"

The chaostoolkit-reporting project is a plugin for Chaos Toolkit to create PDF/HTMl reports from executions.

This project is implemented in Python 3.

"},{"location":"reference/developing/core/#chaostoolkit-bundler","title":"chaostoolkit-bundler","text":"

The chaostoolkit-bundler project is a binary package of Chaos Toolkit and its most common extensions. In case you want a drop in Chaos Toolkit for your system.

This project is implemented in Python 3.

"},{"location":"reference/developing/extensions/","title":"Extension Projects","text":"

In addition to the core projects, the Chaos Toolkit manages some extension projects which provide probes and/or actions for experiments.

Extensions can be found on the incubator GitHub organisation.

"},{"location":"reference/developing/guidelines/","title":"Developer Guidelines","text":"

Contributors to the Chaos Toolkit are always welcome. This guide describes the general elements you probably need to know to get started. Once past those elements, you should dive into the code of each project and come discuss on our Slack.

"},{"location":"reference/developing/guidelines/#overview","title":"Overview","text":""},{"location":"reference/developing/guidelines/#programming-environment","title":"Programming Environment","text":"

The programming environment really is up to you. However, since the Chaos Toolkit is implemented in Python so make sure to have the right tooling for it.

The most basics are:

If you\u2019re not familiar with Python, you will find a few helpful books online, such The Hitchhiker\u2019s Guide to Python.

"},{"location":"reference/developing/guidelines/#the-ultimate-trick","title":"The Ultimate Trick","text":"

Whenever you code on one of the projects, you should run the following command so that the project you are hacking on is part of your virtual environment without being installed:

cd <project-name>\npython setup.py develop\n

Sometimes, your virtual env may be borked and not point to your development directory. In that case, make sure to remove any previously installed version of the project:

pip uninstall <project-name>\n

Then make sure your virtual environment point at your local directory with:

pip freeze\n
"},{"location":"reference/developing/guidelines/#github","title":"GitHub","text":"

The Chaos Toolkit projects are hosted on GitHub. If you wish to contribute, you will need to have an account there.

The general workflow is to fork the project you wish to contribute to, make your changes in a dedicated branch, rebase against the original master and finally submit a pull-request to the project with a clear description of the what and why.

"},{"location":"reference/developing/guidelines/#chaos-toolkit-projects-at-a-glance","title":"Chaos Toolkit Projects At A Glance","text":"

The Chaos Toolkit is made of several projects. The core ones are:

Basically, those projects represent the Chaos Toolkit itself. However, the toolkit is naked without extensions. The currently core extensions are:

In addition, there are a bunch of incubating projects.

"},{"location":"reference/developing/guidelines/#creating-an-extension","title":"Creating an Extension","text":"

Please review the various approaches to extend the toolkit.

"},{"location":"reference/developing/guidelines/#creating-a-notification-plugin","title":"Creating a Notification Plugin","text":"

The Chaos Toolkit triggers events while it runs. Those events may be forwarded to any endpoint that you care for through HTTP or, when you need more control, a full Python project.

There is no template for such a project yet but it is very close to an extension project except it doesn\u2019t have probes and actions. You can therefore start by cloning the extension template project and start from there.

Instead, it should define a function in a module. That function takes two parameters:

The event has a payload key which is the content associated to the event. It can be one of:

Three kind of events can be triggered: started, completed and failed for each phase of the flow. Those events are defined here.

A typical notification callback function will look like this:

from typing import Any, Dict\n\nfrom chaoslib.notification import RunFlowEvent\nfrom chaoslib.types import EventPayload\nimport logzero\n\ndef notify(settings: Dict[str, Any], event: EventPayload):\n    if event[\"name\"] == RunFlowEvent.RunStarted.value:\n        logzero.info(\"Event phase \" + event[\"phase\"])\n        logzero.info(\"Event timestamp \" + event[\"ts\"])\n        logzero.info(\"Event payload \" + event[\"payload\"])\n        logzero.info(\"Event error \" + event.get(\"error\", \"N/A\"))\n

logzero is a third-party package that the Chaos Toolkit uses to log when it runs.

"},{"location":"reference/developing/technologies/","title":"Technology Choices","text":""},{"location":"reference/developing/technologies/#python-3","title":"Python 3","text":"

The Chaos Toolkit is implemented in Python 3. A high-level language with a long successfully story for writing great software. It\u2019s a common choice for tooling purpose.

The language supports readability well and has a large ecosystem of libraries. It is also well-spread and easy to install. The choice to not support Python 2 is a look at Python\u2019s present and future.

The choice for a dynamic language was also motivated because the Chaos Toolkit manipulates a lot of strings and that task is made straightforward with Python.

Although Python natively does not generate (though it can be done) standalone binaries like golang would. We do not believe this will harm the project and hope that package managers will eventually provide native installers.

"},{"location":"reference/developing/technologies/#functional","title":"Functional","text":"

Well, this project is not truly a functional piece of code but the code relies as little as possible on stateful constructions as provided by classes.

Mutable data structures are used but mostly created and returned from functions rather than modified.

Generally speaking, the project draws inspirations from certain ideas of functional paradigms but does not enforce them strictly. One notable area where the code strays away from these principles is the use of exceptions rather than returning error codes. This may change if the community expresses such an intention.

"},{"location":"reference/developing/values/","title":"Key Project Values","text":"

The following key values of the Chaos Toolkit reflect the mindset the community has when engineering the Chaos Toolkit project. Refer to our Code of Conduct as well.

"},{"location":"reference/developing/values/#simplicity","title":"Simplicity","text":"

The Chaos Toolkit aims at being a simple piece of technology both from a user and developer perspective.

To achieve simplicity, the Chaos Toolkit comes as a command line interface driven by a description file. As a user, this means no code and no need to learn a programming language. As a developer, this reduces the functional surface area to consider.

"},{"location":"reference/developing/values/#extensibility","title":"Extensibility","text":"

The Chaos Toolkit does not wish to be a monolith and strives to be extended to fully reach its goal through community driven efforts.

By using a description file, the implementation is not prescribed by the Chaos Toolkit project. Although we fully expect the community to eventually settle on certain implementations of probes and actions.

"},{"location":"reference/developing/values/#readability","title":"Readability","text":"

We believe code readability is a factor for positive maintenance and evolutivity.

Readable code never goes out of fashion. As the code of the Chaos Toolkit is mostly written in Python, best practices such as defined in PEP8.

"},{"location":"reference/developing/values/#diversity","title":"Diversity","text":"

Although not strictly speaking referring to the technological aspect of the project, having diversity in the community will contribute to a better project overall.

"},{"location":"reference/extending/approaches/","title":"Extending the Chaos Toolkit","text":"

The Chaos Toolkit is designed to be extended with new probes and actions so that you can work with any failure injection and system observability systems that you choose. The toolkit has a growing number of open source extensions for just this purpose, but the intention is that you may also want to extend the Chaos Toolkit for your own unique, possible closed, systems as well.

The ChaosToolkit currently supports three extension approaches:

You can extend your actions and probes by implementing them using one of these approaches.

Tip

The Chaos Toolkit maintains a set of open-source extensions ready to be integrated into your Chaos experiments.

"},{"location":"reference/extending/create-control-extension/","title":"Create a Control Extension","text":"

A control extension implements the interface defined by the Chaos Toolkit to support the Controls element of the specification.

Controls are good for changing the experiment or its environment during execution. They have the power to impact the experiment, configuration, secrets on the fly, which is unlike probes and actions.

"},{"location":"reference/extending/create-control-extension/#controls-interface","title":"Controls Interface","text":"

When implementing a control module, you must simply define a set of functions that are called by the Chaos Toolkit when executing the experiment.

Tip

All of these functions are optional, only implement the one you need.

from typing import Any, Dict, List\n\nfrom chaoslib.types import Activity, Configuration, \\\n    Experiment, Hypothesis, Journal, Run, Secrets, Settings\n\n\ndef configure_control(configuration: Configuration = None,\n                      secrets: Secrets = None, settings: Settings = None,\n                      experiment: Experiment = None):\n\"\"\"\n    Configure the control's global state\n\n    This is called once only per Chaos Toolkit's run and should be used to\n    initialize any state your control may require.\n\n    The `settings` are only passed when the control is declared in the\n    settings file of the Chaos Toolkit.\n    \"\"\"\n    pass\n\n\ndef cleanup_control():\n\"\"\"\n    Cleanup the control's global state\n\n    Called once only during the experiment's execution.\n    \"\"\"\n    pass\n\n\ndef before_loading_experiment_control(context: str, **kwargs):\n\"\"\"\n    before loading the experiment from its source.\n\n    The context is the file path or URL given to the loader. Use this loader\n    if you want to interact with that source before it is loaded.\n    \"\"\"\n    pass\n\n\ndef after_loading_experiment_control(context: str, state: Experiment, **kwargs):\n\"\"\"\n    after loading the experiment from its source.\n\n    Use this loader if you want to interact with the experiment once it's been\n    loaded and parsed but before the validation or execution take place.\n    \"\"\"\n    pass\n\n\ndef before_experiment_control(context: Experiment,\n                              configuration: Configuration = None,\n                              secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the experiment's execution\n\n    Called by the Chaos Toolkit before the experiment's begin but after the\n    configuration and secrets have been loaded.\n    \"\"\"\n    pass\n\n\ndef after_experiment_control(context: Experiment, state: Journal, \n                             configuration: Configuration = None,\n                             secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the experiment's execution\n\n    Called by the Chaos Toolkit after the experiment's completed. It passes the\n    journal of the execution. At that stage, the after control has no influence\n    over the execution however. Please see\n    https://docs.chaostoolkit.org/reference/api/journal/#journal-elements\n    for more information about the journal.\n    \"\"\"\n    pass\n\n\ndef before_hypothesis_control(context: Hypothesis,\n                              configuration: Configuration = None,\n                              secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the hypothesis's execution\n\n    Called by the Chaos Toolkit before the steady-state hypothesis is\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_hypothesis_control(context: Hypothesis, state: Dict[str, Any],\n                             configuration: Configuration = None,\n                             secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the hypothesis's execution\n\n    Called by the Chaos Toolkit after the steady-state hypothesis is\n    complete. The `state` contains the result of the hypothesis. Refer to\n    https://docs.chaostoolkit.org/reference/api/journal/#steady-state-outcomes\n    for the description of that state.\n    \"\"\"\n    pass\n\n\ndef before_method_control(context: Experiment, \n                          configuration: Configuration = None,\n                          secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the method's execution\n\n    Called by the Chaos Toolkit before the activities of the method are\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_method_control(context: Experiment, state: List[Run], \n                         configuration: Configuration = None,\n                         secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the method's execution\n\n    Called by the Chaos Toolkit after the activities of the method have been\n    applied. The `state` is the list of activity results. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n\n\ndef before_rollback_control(context: Experiment, \n                            configuration: Configuration = None,\n                            secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the rollback's execution\n\n    Called by the Chaos Toolkit before the actions of the rollback are\n    applied.\n    \"\"\"\n    pass\n\n\ndef after_rollback_control(context: Experiment, state: List[Run], \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the rollback's execution\n\n    Called by the Chaos Toolkit after the actions of the rollback have been\n    applied. The `state` is the list of actions results. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n\n\ndef before_activity_control(context: Activity, \n                            configuration: Configuration = None,\n                            secrets: Secrets = None, **kwargs):\n\"\"\"\n    before-control of the activity's execution\n\n    Called by the Chaos Toolkit before the activity is applied.\n    \"\"\"\n    pass\n\n\ndef after_activity_control(context: Activity, state: Run,  \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n\"\"\"\n    after-control of the activity's execution\n\n    Called by the Chaos Toolkit before the activity is applied. The result of\n    the execution is passed as `state`. See\n    https://docs.chaostoolkit.org/reference/api/journal/#run for more\n    information.\n    \"\"\"\n    pass\n
"},{"location":"reference/extending/create-control-extension/#use-your-control","title":"Use your control","text":"

Define those functions into a module that is used as a provider. For instance, assume the above definition is stored into a module chaosstuff.control, in other words a control.py module of the chaosstuff package.

The package must obviously be available to the PYTHONPATH in which the chaos runs.

"},{"location":"reference/extending/create-control-extension/#declare-it-in-the-experiment","title":"Declare it in the experiment","text":"

Controls can be applied per-experiment only:

JSONYAML
\"controls\": [\n{\n\"name\": \"my-stuff\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosstuff.control\"\n}\n}\n]\n
controls:\n- name: my-stuff\nprovider:\ntype: python\nmodule: chaosstuff.control\n
"},{"location":"reference/extending/create-control-extension/#declare-it-in-your-settings","title":"Declare it in your settings","text":"

Controls can be also applied globally to all runs by declaring them in the Chaos Toolkit settings file:

controls:\nmy-stuff:\nprovider:\ntype: python\nmodule: chaosstuff.control\n
"},{"location":"reference/extending/create-control-extension/#things-to-note","title":"Things to note","text":""},{"location":"reference/extending/create-control-extension/#unforeseen-errors","title":"Unforeseen errors","text":"

The Chaos Toolkit will not let a control abort the execution of the experiment. So if an exception is raised, it will be caught by the Chaos Toolkit, logged and the execution will carry on.

"},{"location":"reference/extending/create-control-extension/#interrupting-the-execution","title":"Interrupting the execution","text":"

While unforeseen errors in your controls cannot stop the execution, you can interrupt the execution by raising chaoslib.exceptions.InterruptExecution from any of your control functions.

Note however, this is a harsh way to terminate the execution since, none of the rollbacks will be applied.

Here is an example:

from chaoslib.exceptions import InterruptExecution\n\n\ndef after_activity_control(context: Activity, state: Run,  \n                           configuration: Configuration = None,\n                           secrets: Secrets = None, **kwargs):\n    if check_stuff(state[\"output\"]):\n        raise InterruptExecution(\"Well things went really bad!\")\n

In that case, the experiment\u2019s execution will have its status set to \"interrupted\" as described here.

"},{"location":"reference/extending/extending-with-python/","title":"Extending Chaos Toolkit with Python","text":""},{"location":"reference/extending/extending-with-python/#create-your-new-chaos-toolkit-extension-project","title":"Create your new Chaos Toolkit extension project","text":"

All Chaos Toolkit extensions follow the same structure and you can benefit from a project template. You can create a repository using that template from the GitHub UI or using the gh.

$ gh repo create mytest --private -p chaostoolkit/chaostoolkit-extension-template\n
"},{"location":"reference/extending/extending-with-python/#where-to-put-your-code","title":"Where to put your code","text":"

There are two extension points for a Chaos Toolkit Python extension, and they are captured in two files: actions.py and probes.py.

It is conventional to use the actions.py module as the place where you expose the actions that you would like to conduct as part of your Chaos Toolkit experimental method against the environment you want to inject failure into.

It\u2019s also conventional to use the probes.py module as the place where you can integrate with your system\u2019s existing observability so that those values can be used either for an experiment\u2019s Steady State Hypothesis, or as simple additional data-gathering probes that can be declared throughout an experiment\u2019s method.

"},{"location":"reference/extending/extending-with-python/#running-discover-on-a-new-extension","title":"Running Discover on a New Extension","text":"

Chaos Toolkit extensions often implement functionality that assists in discovering what a system, and the extension against that system, supports. This is executed using the chaos discover command.

When writing your own implementation of discovery you will often want to test the new functionality locally. To do this you should first execute from your extension workspace:

$ python setup.py develop

Then you can exercise your discovery functionality using the --no-install flag on the chaos discover command, for example:

chaos discover --no-install ext-name

"},{"location":"reference/extending/extending-with-python/#log-from-your-extension","title":"Log From Your Extension","text":"

You can write to the Chaos Toolkit log by using the logzero package.

from logzero import logger\n\nlogger.info(\"Hello!\")\n

Make sure to add logzero as an entry of the requirements.txt file of your extension.

"},{"location":"reference/tutorials/authoring_operating/","title":"Authoring vs Operating","text":"

The Chaos Toolkit specifies an experimental protocol and format for your chaos engineering capabilities. It is often interesting to distinguish, at least in your mind, two roles.

"},{"location":"reference/tutorials/authoring_operating/#author","title":"Author","text":"

The author of an experiment is responsible for defining the structure of the experiment and its objective. The author does not have to be the one who comes with the question the experiment tries to produce evidence for. Rather, the author knows how to structure the experiment and ensures the outcome of an experiment\u2019s execution can be interpreted in an objective way.

An author manipulates the following elements: steady-state hypothesis, method, rollbacks.

"},{"location":"reference/tutorials/authoring_operating/#operator","title":"Operator","text":"

The operator of an experiment executes it. This role is not as clear cut as the author\u2019s role and, quite often, both are the same person. However, it is useful to keep in mind what an experiment requires to be operated. Since you may end up with a fleet of Chaos Toolkit experiments running concurrently, the operator should work to ensure the executions happen in a safe and controlled manner.

An operator manipulates the following elements: controls, settings

"},{"location":"reference/tutorials/batch/","title":"Running Chaos Toolkit experiments as AWS Batch Jobs","text":"

It is common when using AWS for hosting your infrastructure that you\u2019ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we\u2019re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

"},{"location":"reference/tutorials/batch/#why-batch","title":"Why Batch?","text":"

You may have followed our Running Chaos Toolkit from an EC2 instance guide and wonder why we would write a guide for Batch - Batch has some benefits over EC2:

"},{"location":"reference/tutorials/batch/#why-not-ecs-and-fargate","title":"Why not ECS and Fargate?","text":"

We sometimes get asked about how to run Chaos Toolkit on ECS with Fargate, whilst we understand why you might want to do this, Chaos Toolkit experiments aren\u2019t analogous to something like a microservice. We don\u2019t run Chaos Toolkit continuously and request it to run jobs, rather we invoke Chaos Toolkit when we want to use it.

Because of this difference in thinking, we recommend you use Batch (With Fargate as the compute provider) to invoke Chaos Toolkit experiments.

"},{"location":"reference/tutorials/batch/#the-steps","title":"The Steps","text":"

For the purposes of this guide, we\u2019ll run you through setting up your Chaos Toolkit experiments manually. If however, you\u2019re familiar with the AWS Cloud Development Kit (CDK), we have an example repository deploying the same infrastructure using CDK here.

There are a few pre-requisites required to be able to follow this guide:

"},{"location":"reference/tutorials/batch/#1-create-your-system-an-ec2-instance","title":"1. Create your system (an EC2 instance)","text":"

Similar to our Running Chaos Toolkit from an EC2 instance guide, we\u2019ll be using an EC2 instance as our \u2018system\u2019 to run our experiment against. We\u2019ll setup our SSH to ensure that the EC2 instance is in a running state.

AWS ConsoleAWS CLI

You can leave this instance up for the duration of this guide.

"},{"location":"reference/tutorials/batch/#2-create-your-experiment","title":"2. Create your experiment","text":"

In an empty directory, create a folder named experiments:

mkdir experiments\n

Create a file named experiment-1.json inside experiments/ with the following contents:

{\n\"title\": \"Running Chaos Toolkit from AWS Batch\",\n\"description\": \"N/A\",\n\"tags\": [],\n\"steady-state-hypothesis\": {\n\"title\": \"EC2 is RUNNING\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"instance_state\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"running\",\n\"instance_ids\": [\n\"<INSTANCE_ID>\"\n],\n\"filters\": []\n}\n},\n\"tolerance\": true\n}\n]\n},\n\"method\": [],\n\"configuration\": {\n\"aws_region\": \"<REGION>\"\n}\n}\n

Replace the value of <INSTANCE_ID> with the value of the id of the deployed instance. Replace <REGION> with the name of the region the instance is deployed in.

"},{"location":"reference/tutorials/batch/#3-setup-your-docker-image","title":"3. Setup your Docker image","text":"

AWS Batch requires us to have a Docker image within the Job definition, this container will be what does the work for our Batch Job.

Make a file named Dockerfile alongside experiments/ with the following contents:

FROM chaostoolkit/chaostoolkit:latest\n\nRUN pip install chaostoolkit-aws\n\nRUN mkdir /home/svc/experiments\n\nCOPY experiments /home/svc/experiments\n\nWORKDIR /home/svc/experiments\n
"},{"location":"reference/tutorials/batch/#4-create-your-ecr-repository-and-push-the-image","title":"4. Create your ECR repository and push the image","text":"AWS ConsoleAWS CLI

Logging in to ECR with Docker

aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com\n

Login Succeeded\n

Building the image

docker build -t ctk-batch .\n

[+] Building 1.8s (10/10) FINISHED\n => [internal] load build definition from Dockerfile        0.0s\n => => transferring dockerfile: 220B                        0.0s\n => [internal] load .dockerignore                           0.0s\n => => transferring context: 2B                             0.0s\n => [internal] load metadata for docker.io/chaostoolkit/chaostoolkit:latest                                                         1.5s\n => [1/5] FROM docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => => resolve docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => [internal] load build context                           0.0s\n => => transferring context: 959B                           0.0s\n => CACHED [2/5] RUN pip install chaostoolkit-aws           0.0s\n => CACHED [3/5] RUN mkdir /home/svc/experiments            0.0s\n => [4/5] COPY experiments /home/svc/experiments            0.0s\n => [5/5] WORKDIR /home/svc/experiments                     0.0s\n => exporting to image                                      0.1s\n => => exporting layers                                     0.0s\n => => writing image sha256:4a3ce8f2824518bffa47ff3d293488f18f83e25711bedc32e13611a5c7e7e0af                                        0.0s\n => => naming to docker.io/library/ctk-batch                0.0s\n

Tagging the image

docker tag ctk-batch:latest <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch:latest\n

Pushing the image

docker push <your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch:latest\n

The push refers to repository [<your-aws-account-id>.dkr.ecr.eu-west-2.amazonaws.com/ctk-batch]\n5f70bf18a086: Pushed\ned804ed04ee1: Pushed\n8ac8250b5bff: Pushed\n65bb6a66824b: Pushed\n381a8a9c329b: Pushed\n7a767cefe1f5: Pushed\n011386fb6049: Pushed\nac4086fc0a4e: Pushed\n065eb9ef9cc4: Pushed\n93ee5bc36b87: Pushed\n9cc956b239dd: Pushed\nbc276c40b172: Pushed\nlatest: digest: sha256:9702b9cf63a6e4961689a661340fc0573d28d0e7f506b90fa5d080e4e7c9d275 size: 2826\n
"},{"location":"reference/tutorials/batch/#5-create-your-batch-compute-environment","title":"5. Create your Batch Compute environment","text":"

To actually run your Jobs, Batch needs a Compute environment configured. This is where you tell AWS what runs the jobs (i.e EC2 instances/Fargate/etc.).

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#6-create-your-batch-job-queue","title":"6. Create your Batch Job queue","text":"

When you submit Jobs, Batch uses a Job queue to manage what is and needs to be running and where it needs to run.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#7-create-your-batch-job-execution-role","title":"7. Create your Batch Job execution role","text":"

Because you\u2019ve set up an ECR repository with your Docker image in, you need to provide Batch with an execution role that will allow it to pull the image from ECR. It will also enable Batch to output the logs of the container to CloudWatch.

Don\u2019t be confused when we refer to Elastic Container Service, Batch is using it under the hood.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#8-create-your-batch-job-job-role","title":"8. Create your Batch Job job role","text":"

The nature of chaostoolkit-aws means that we use boto3 to make AWS requests within our experiment. To be able to make these calls, the container that is running our experiment needs credentials and permissions to do so.

By creating a job role for our Job, we can:

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#9-create-your-batch-job-definition","title":"9. Create your Batch Job definition","text":"

This is where we tell AWS what our Job is and needs.

AWS ConsoleAWS CLI "},{"location":"reference/tutorials/batch/#10-run-your-experiment","title":"10. Run your experiment","text":"

Now that you have:

It\u2019s a great time to try and run it!

AWS ConsoleAWS CLI

Here you\u2019ll find the CloudWatch logs of the experiment:

No older events at this moment. Retry\n[2021-08-19 14:02:42 INFO] Validating the experiment's syntax\n[2021-08-19 14:02:42 INFO] Experiment looks valid\n[2021-08-19 14:02:42 INFO] Running experiment: Running Chaos Toolkit from AWS Batch\n[2021-08-19 14:02:42 INFO] Steady-state strategy: default\n[2021-08-19 14:02:42 INFO] Rollbacks strategy: default\n[2021-08-19 14:02:42 INFO] Steady state hypothesis: EC2 is RUNNING\n[2021-08-19 14:02:42 INFO] Probe: instance_state\n[2021-08-19 14:02:43 INFO] Steady state hypothesis is met!\n[2021-08-19 14:02:43 INFO] Playing your experiment's method now...\n[2021-08-19 14:02:43 INFO] No declared activities, let's move on.\n[2021-08-19 14:02:43 INFO] Steady state hypothesis: EC2 is RUNNING\n[2021-08-19 14:02:43 INFO] Probe: instance_state\n[2021-08-19 14:02:43 INFO] Steady state hypothesis is met!\n[2021-08-19 14:02:43 INFO] Let's rollback...\n[2021-08-19 14:02:43 INFO] No declared rollbacks, let's move on.\n[2021-08-19 14:02:43 INFO] Experiment ended with status: completed\nNo newer events at this moment. Auto retry paused. Resume\n

You\u2019ll then see the CloudWatch logs of the experiment:

b/36345990587319449028074048616721581140117476148622393344      f/36345990607367818961553078820962191867228353142498787343\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Validating the experiment's syntax   1629810585420\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Experiment looks valid       1629810585571\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Running experiment: Running Chaos Toolkit from AWS Batch     1629810585572\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Steady-state strategy: default       1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Rollbacks strategy: default  1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Steady state hypothesis: EC2 is RUNNING      1629810585577\nEVENTS  1629810588018   [2021-08-24 13:09:45 INFO] Probe: instance_state        1629810585578\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis is met!      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Playing your experiment's method now...      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] No declared activities, let's move on.       1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis: EC2 is RUNNING      1629810586238\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Probe: instance_state        1629810586239\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Steady state hypothesis is met!      1629810586318\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Let's rollback...    1629810586319\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] No declared rollbacks, let's move on.        1629810586319\nEVENTS  1629810588018   [2021-08-24 13:09:46 INFO] Experiment ended with status: completed      1629810586319\n

"},{"location":"reference/tutorials/batch/#summary","title":"Summary","text":"

Like our Running Chaos Toolkit from an EC2 instance guide, our experiment was extremely simple. Again, this guide was not meant to teach you to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure, in a more reactive process.

Rather than having an EC2 instance running and not doing any work, you have the ability now to fire off Chaos Toolkit experiments and only use the compute you need.

You should now have an appreciation and the ability to:

"},{"location":"reference/tutorials/batch/#extras","title":"Extras","text":"

Whilst the above guide will tell you all you need to know to get started with AWS Batch and running Chaos Toolkit experiments with jobs, it is very manual and has a few shortcomings that are easily fixed with some more work.

"},{"location":"reference/tutorials/batch/#aws-cloud-development-kit-cdk","title":"AWS Cloud Development Kit (CDK)","text":"

As mentioned near the start of this guide, we have this repository which contains an AWS CDK project which deploys almost the same infrastructure as this guide.

The infrastructure differs slightly in:

We also modify the experiment-1.json file to accept an environment variable for the EC2 instance ID as this will be provided by CDK.

If you wish to try this project out, clone the repository and ensure you install all of the requirements first.

Once you\u2019re setup with the requirements, you can check what infrastructure will be deployed with:

make diff\n
...\nResources\n[+] AWS::S3::Bucket journal-bucket-your-name-dev journalbucketyour-namedev58D204DE\n[+] AWS::S3::BucketPolicy journal-bucket-your-name-dev/Policy journalbucketyour-namedevPolicyDFBFADE1\n[+] Custom::S3AutoDeleteObjects journal-bucket-your-name-dev/AutoDeleteObjectsCustomResource journalbucketyour-namedevAutoDeleteObjectsCustomResourceB5FE1104\n[+] AWS::IAM::Role Custom::S3AutoDeleteObjectsCustomResourceProvider/Role CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092\n[+] AWS::Lambda::Function Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F\n[+] AWS::EC2::VPC vpc-your-name-dev vpcyour-namedev8A672852\n[+] AWS::EC2::Subnet vpc-your-name-dev/PublicSubnet1/Subnet vpcyour-namedevPublicSubnet1Subnet4E80B3F7\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PublicSubnet1/RouteTable vpcyour-namedevPublicSubnet1RouteTable3BA26768\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PublicSubnet1/RouteTableAssociation vpcyour-namedevPublicSubnet1RouteTableAssociationF3D844E7\n[+] AWS::EC2::Route vpc-your-name-dev/PublicSubnet1/DefaultRoute vpcyour-namedevPublicSubnet1DefaultRouteD7E793DD\n[+] AWS::EC2::EIP vpc-your-name-dev/PublicSubnet1/EIP vpcyour-namedevPublicSubnet1EIP712EAA5B\n[+] AWS::EC2::NatGateway vpc-your-name-dev/PublicSubnet1/NATGateway vpcyour-namedevPublicSubnet1NATGatewayCC6D84C6\n[+] AWS::EC2::Subnet vpc-your-name-dev/PublicSubnet2/Subnet vpcyour-namedevPublicSubnet2Subnet3E3E0046\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PublicSubnet2/RouteTable vpcyour-namedevPublicSubnet2RouteTable1AB520E0\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PublicSubnet2/RouteTableAssociation vpcyour-namedevPublicSubnet2RouteTableAssociation2FEAAF25\n[+] AWS::EC2::Route vpc-your-name-dev/PublicSubnet2/DefaultRoute vpcyour-namedevPublicSubnet2DefaultRouteC103C9D2\n[+] AWS::EC2::EIP vpc-your-name-dev/PublicSubnet2/EIP vpcyour-namedevPublicSubnet2EIP6AD92B60\n[+] AWS::EC2::NatGateway vpc-your-name-dev/PublicSubnet2/NATGateway vpcyour-namedevPublicSubnet2NATGatewayA09AEBA1\n[+] AWS::EC2::Subnet vpc-your-name-dev/PrivateSubnet1/Subnet vpcyour-namedevPrivateSubnet1SubnetB315A65A\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PrivateSubnet1/RouteTable vpcyour-namedevPrivateSubnet1RouteTableA5FAAF1C\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PrivateSubnet1/RouteTableAssociation vpcyour-namedevPrivateSubnet1RouteTableAssociationE3B5D7DD\n[+] AWS::EC2::Route vpc-your-name-dev/PrivateSubnet1/DefaultRoute vpcyour-namedevPrivateSubnet1DefaultRoute9152FB24\n[+] AWS::EC2::Subnet vpc-your-name-dev/PrivateSubnet2/Subnet vpcyour-namedevPrivateSubnet2Subnet414716F0\n[+] AWS::EC2::RouteTable vpc-your-name-dev/PrivateSubnet2/RouteTable vpcyour-namedevPrivateSubnet2RouteTable225072CD\n[+] AWS::EC2::SubnetRouteTableAssociation vpc-your-name-dev/PrivateSubnet2/RouteTableAssociation vpcyour-namedevPrivateSubnet2RouteTableAssociationF9EA82A2\n[+] AWS::EC2::Route vpc-your-name-dev/PrivateSubnet2/DefaultRoute vpcyour-namedevPrivateSubnet2DefaultRoute7BE0AFBF\n[+] AWS::EC2::InternetGateway vpc-your-name-dev/IGW vpcyour-namedevIGW70FB840E\n[+] AWS::EC2::VPCGatewayAttachment vpc-your-name-dev/VPCGW vpcyour-namedevVPCGWB8F53F81\n[+] AWS::EC2::SecurityGroup instance-your-name-dev/InstanceSecurityGroup instanceyour-namedevInstanceSecurityGroup50C02701\n[+] AWS::IAM::Role instance-your-name-dev/InstanceRole instanceyour-namedevInstanceRoleF653EE93\n[+] AWS::IAM::InstanceProfile instance-your-name-dev/InstanceProfile instanceyour-namedevInstanceProfile6799F951\n[+] AWS::EC2::Instance instance-your-name-dev instanceyour-namedev8DD0F85A\n[+] AWS::IAM::Role batch-service-role-your-name-dev batchserviceroleyour-namedevB064BF84\n[+] AWS::IAM::Role batch-execution-role-your-name-dev batchexecutionroleyour-namedev39DE3188\n[+] AWS::IAM::Policy batch-execution-policy-your-name-dev batchexecutionpolicyyour-namedev8BCEF321\n[+] AWS::IAM::Role batch-job-role-your-name-dev batchjobroleyour-namedevAC17F802\n[+] AWS::IAM::Policy batch-job-role-your-name-dev/DefaultPolicy batchjobroleyour-namedevDefaultPolicy44B9665C\n[+] AWS::IAM::Policy batch-job-policy-your-name-dev batchjobpolicyyour-namedev9C329AAB\n[+] AWS::Batch::ComputeEnvironment compute-env-your-name-dev computeenvyour-namedev\n[+] AWS::Batch::JobQueue job-queue-your-name-dev jobqueueyour-namedev\n[+] AWS::Batch::JobDefinition job-def-your-name-dev jobdefyour-namedev\n

To deploy the infrastructure, run:

make deploy\n
...\nChaosToolkitBatchExampleStack-your-name-dev: creating CloudFormation changeset...\n[\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258f\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7] (35/43)\n09:24:07 | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack            | ChaosToolkitBatchExampleStack-your-name-dev\n09:24:52 | CREATE_IN_PROGRESS   | AWS::IAM::InstanceProfile             | instance-your-name-dev/InstanceProfile\n09:25:13 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                  | vpc-your-name-dev/PublicSubnet2/NATGateway\n09:25:13 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                  | vpc-your-name-dev/PublicSubnet1/NATGateway\n...\n

You can then navigate to the Batch console and run jobs as previously outlined in the guide above.

"},{"location":"reference/tutorials/batch/#storing-your-journal","title":"Storing your journal","text":"

You might have noticed that being able to view the Chaos Toolkit experiment journal presents a pickle of a situation. As Batch Job containers are ephemeral, once the Job has run and terminated (either successfully or not), the place your experiment just ran in is destroyed for good.

There are likely several ways you could get around this issue, you could implement an extension to upload journals somewhere, you could extend chaostoolkit-aws to upload journal runs to S3 or to an EBS volume (if you\u2019d deployed that too).

In the CDK example, we actually snuck in a way to store journals; we use a wrapper script which calls chaostoolkit and then uses boto3 in a Python script to upload the journal to S3, into a bucket we also deploy in the stack.

Take a look at our Dockerfile compared to the one in the guide above:

FROM chaostoolkit/chaostoolkit:latest\n\nRUN pip install chaostoolkit-aws\n\nRUN mkdir /home/svc/experiments\n\nCOPY experiments /home/svc/experiments\nCOPY run_experiment.sh /home/svc/experiments/\nCOPY upload_journal.py /home/svc/experiments/\n\nWORKDIR /home/svc/experiments\n\nENTRYPOINT [ \"sh\", \"run_experiment.sh\" ]\n

We\u2019ve added two new COPY statements, moving our wrapper script and our upload script into the container. We\u2019ve also added an override to the containers ENTRYPOINT value, which in chaostoolkit/chaostoolkit:latest is chaos.

The wrapper script is very simple, it just looks like:

#!/bin/bash\n\nchaos run $1 --journal-path=/home/svc/experiments/journal.json\n\npython3 upload_journal.py\n

Our upload script is also very basic:

import os\nfrom datetime import datetime\n\nimport boto3\n\n\ndef upload_journal():\n    s3 = boto3.client(\"s3\")\n    with open(\"/home/svc/experiments/journal.json\", \"rb\") as journal:\n        s3.upload_fileobj(\n            journal,\n            os.environ[\"JOURNAL_BUCKET\"],\n            f\"{datetime.now().strftime('%Y%m%d-%H%M%S')}.json\",\n        )\n\n\nif __name__ == \"__main__\":\n    upload_journal()\n

With these changes and a small modification to the command of our Job definition, we can now invoke our experiment, specify a location for our journal, and then upload the journal with a suitable name - we set our journal name to the current datetime. You could also include your experiment name if you have many of them.

"},{"location":"reference/tutorials/blockchain/","title":"Chaos Engineering experiments against a blockchain","text":"

Credits

This article has been authored by Yolanne Lee and you can find the original article code on Yolanne\u2019s repository

Blockchains are interesting concepts to test using chaos engineering principles. This is because they operate based on user usage, taking advantage of a network of participants and internal algorithms to create a distributed, decentralized ledger.

This tutorial will not focus on teaching core blockchain concepts. While the setup may be done by simply pulling from my github repository, you may alternatively invest some time reading through the great tutorial here!

If you choose to proceed with the tutorial, you will need to ensure that your HTTP requests match logically with those in this tutorial.

Ready? Great! Let\u2019s get started.

"},{"location":"reference/tutorials/blockchain/#setup","title":"Setup","text":"

First, clone the code using the command below in your command line. This fetches an up-to-date version of all files required to run the experiment.

$ git clone https://github.com/yolannel/CTKBlockchain

Assuming you are running Python 3.6 or higher, you can install all required dependencies via the following command in your command line. Please note that it is highly recommended that you work inside of a virtual environment. A simple explanation of virtual environments may be found here; if you\u2019re running PyCharm or another editor which has in-built venv support then check your project settings!

$ pip install -U -r requirements.txt

Now you\u2019re all set up to dive into the experiments!

"},{"location":"reference/tutorials/blockchain/#chaos-toolkit-and-blockchain","title":"Chaos Toolkit and Blockchain","text":""},{"location":"reference/tutorials/blockchain/#looking-forward","title":"Looking forward","text":"

Blockchains are inherently user dependent which is why it presents a unique case to test with Chaos Toolkit. This tutorial will guide you through the thought process of creating two experiments:

  1. Testing a simple transaction
  2. Testing the consensus mechanism

We will follow the above order because the consensus mechanism naturally builds off of the transaction model. If you require additional help at any point regarding the CTK, you can view the documentation.

You can consider an experiment as an automator for the process you\u2019d normally do to test your program: you preset a full task flow so that your testing is repeatable and easy to run. The results of your experiment are also automatically recorded, so you can continuously expose your system to stressors and understand its strengths and weaknesses from reading the records which are automatically recorded in your journal file.

"},{"location":"reference/tutorials/blockchain/#transaction-experiment","title":"Transaction Experiment","text":"

We\u2019ll use this as an introduction to the CTK experiment as well. An experiment is a single json file which tests a functionality of your program. It has several components that must be declared:

When we start to think about creating an experiment, we need to have a well-defined goal of testing. For example, the blockchain should support making a simple transaction which can be mined; before and after mining, the chain should exist and be callable. No rollbacks should be supported since a blockchain should be immutable.

This is the beginning of my experiment:

{\n\"title\": \"Can we make a new transaction?\",\n\"description\": \"The system should respond to a transaction request.\",\n\"tags\": [\"tx\"],\n...\n

The format of the json file is quite simple. Similarly to a dictionary, there is a property, and a value assigned to the property. In the case of a property which can take multiple values, such as \"tags\", square brackets are put around the values. Try adding an additional tag to the experiment by adding a comma after the first value and adding a second tag!

Below, we see the \"steady-state-hypothesis\". We previously mentioned what the blockchain should be capable of both before and after the experiment. The steady state hypothesis tests for this condition - in this case, the condition is simply that the chain should exist.

We also introduce a probe! This is the workhorse of any experiment. Probes are able to carry out tests and listen for responses. They have the following properties:

    \"steady-state-hypothesis\": {\n\"title\": \"Chain exists\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"chain-exists\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 5,\n\"url\": \"http://127.0.0.1:5000/chain\"\n}\n}\n]\n},\n

Now we reach the main body of the json file, the method. The basic structure is simply a list of probes and actions. Actions are very similar to probes, but should introduce new information or a change to the system being tested rather than simply checking its state.

As an example, checking that the chain exists is a probe but creating a new transaction is an action.

We have to POST a request, which differs from the previous check-chain probe which used a simple \u2018GET\u2019, so we define the \"method\" to be POST.

The \"header\" is a property which defines header names. These provide information/context about the type of information being sent - in our case, the content should be read as a json request so the header defines the content-type.

Certain arguments must be included (see line 173 in blockchain.py) in the json for the request to be valid according to our blockchain.py file:

We can include arguments in our action by simply including \"arguments\" and listing them in name-value pairs.

\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"make-new-transaction\",\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 1,\n\"url\": \"http://127.0.0.1:5000/transactions/new\",\n\"method\": \"POST\",\n\"headers\": {\n\"Content-Type\": \"application/json\"\n},\n\"arguments\": {\n\"sender\": \"me\",\n\"recipient\": \"new-other-address\",\n\"amount\": 20\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"check-chain\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n},\n{\n\"type\": \"action\",\n\"name\": \"mine-block\",\n\"provider\": {\n\"type\": \"http\",\n\"timeout\": 3,\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"check-chain\",\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"http://127.0.0.1:5000/mine\"\n}\n}\n],\n

Finally, we reach the rollbacks! When designing an experiment, you should be aware of the capabilities of your system and also what it should be able to do. For example, I could include code in my blockchain.py file that allows a user to delete a transaction which hasn\u2019t been mined yet; however, this would violate the operation of a blockchain because blockchains derive trust from immutability (as mentioned before). So, you can see below that no rollbacks are included because a user should not be able to delete changes nor does my blockchain.py file include an option to.

\"rollbacks\": [\n]\n}\n
"},{"location":"reference/tutorials/blockchain/#running-the-experiment","title":"Running the experiment","text":"

In your command line, you should create the blockchain before running the experiment by running the blockchain.py file:

$ python blockchain.py

Then, you can run the experiment by using the command:

$ chaos run testTransaction.json

That\u2019s your first experiment!

"},{"location":"reference/tutorials/blockchain/#consensus-experiment","title":"Consensus Experiment","text":"

While our blockchain is a very simple one, it should be able to demonstrate arguably the key reason why we can call it \u2018decentralized\u2019 and \u2018distributed\u2019: the consensus mechanism. As before, see the brilliant tutorial linked above if you really want to get into the details!

On a topical level, the consensus mechanism is how you determine the global truth. If one person posts a transaction on a block that was mined at the exact same time, it could accidentally branch off of the original chain. Additionally, there must be a verifiable task involved in mining that is unbiased and sufficiently difficult, but still easy to check. Both of these requirements are addressed by the consensus mechanism, which is the task required to mine a block.

We will demo a simple Proof of Work, which essentially is an extremely difficult computation to solve a math puzzle. We will then start a second chain as an example of the branching that may occasionally occur; this blockchain resolves itself by taking the longest chain.

We will not walk through the entire experiment this time, but the procedure planned out is as follows.

  1. Like before, we should ensure that the chain exist on two separate nodes.
  2. Simulate activity.
  3. Check the chains exist still.
  4. Resolve the chains to identify the global truth.

Steps 1 and 3 should be familiar to you and I invite you to try coding them yourself! Step 2 brings an opportunity to show another use case for CTK. So far we have used the http provider, but we may also use a python provider.

{\n\"type\": \"action\",\n\"name\": \"simulate activity\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os\",\n\"func\": \"system\",\n\"arguments\": {\n\"command\": \"python -c \\\"import activity; activity.run(100)\\\"\"\n}\n}\n}\n

The activity.py file run by simulate activity randomly posts transactions from either of the two nodes and occasionally mines a block. For reference, the approximate probability of posting a transaction to any of the two chains is 75% and accordingly, the probability of mining from either of the two chains is 25%.

Finally, we want to resolve the chains. This is an http request which we\u2019ve learned earlier, and I again invite you to try your hand at it!

"},{"location":"reference/tutorials/blockchain/#running-the-experiment_1","title":"Running the experiment","text":"

In your command line, you should create the blockchain and start both nodes (here we use 127.0.0.1:5000 and 127.0.0.1:5001) before running the experiment:

$ python blockchain.py --port 5000

.. and on a new terminal,

$ python blockchain.py --port 5001

Then, you can run the experiment by using the command:

$ chaos run testConsensus.json

You\u2019ve completed the tutorial!

"},{"location":"reference/tutorials/blockchain/#some-key-takeaways","title":"Some key takeaways","text":""},{"location":"reference/tutorials/blockchain/#thanks","title":"Thanks","text":"

Chaos Toolkit is an open source project hosted on Github. If you have any issues then raise them on the Github, and if you\u2019d like to contribute, start here!

The blockchain tutorial linked in the beginning is completely external to this tutorial and all credits go to Daniel van Flymen.

"},{"location":"reference/tutorials/containerising/","title":"Containerising Chaos Toolkit","text":"

You may find yourself in a situation that requires you to run your Chaos Toolkit Experiments from within a container. This may be to encapsulate the dependencies required or to run CTK in a different environment, for whichever reason you have, containerising CTK is straightforward.

Chaos Toolkit provides three images you can use as bases for your own needs:

"},{"location":"reference/tutorials/containerising/#using-the-vanilla-chaostoolkit-image","title":"Using the vanilla chaostoolkit image","text":"

Chaos Toolkit builds and pushes a Docker Image upon every release of a new version of the chaostoolkit package. This can then be used out of the box by referring to it locally on the command line with:

docker run chaostoolkit/chaostoolkit:latest info core\n
Unable to find image 'chaostoolkit/chaostoolkit:latest' locally\nlatest: Pulling from chaostoolkit/chaostoolkit\nDigest: sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3\nStatus: Downloaded newer image for chaostoolkit/chaostoolkit:latest\nNAME                VERSION   \nCLI                 1.9.2     \nCore library        1.19.0\n

It should be noted that this only contains vanilla chaostoolkit.

You could then mount a directory containing your experiments (if they are only using vanilla chaostoolkit) and run them:

docker run \\\n-v $PWD/experiments:/experiments \\\nchaostoolkit/chaostoolkit:latest \\\n--log-file /experiments/chaostoolkit.log \\\nrun /experiments/experiment.json \\\n--journal-path /experiments/journal.json\n

You\u2019d then find in $PWD/experiments:

ls $PWD/experiments\n
chaostoolkit.log experiment.json  journal.json\n
"},{"location":"reference/tutorials/containerising/#containerising-with-extensions","title":"Containerising with extensions","text":"

You can obviously use the chaostoolkit/chaostoolkit:full image which contains the most commonly used extensions. But you can also tailor to your need as follows. We will be using the chaostoolkit/chaostoolkit:basic image as base so we build using a Debian image.

"},{"location":"reference/tutorials/containerising/#chaostoolkit-aws-example","title":"chaostoolkit-aws example","text":"

If for example, you needed certain AWS activities for your chaos experiments, you could create a Dockerfile like so:

FROM chaostoolkit/chaostoolkit:basic\n\nRUN pip install chaostoolkit-aws\n

To then use this, you\u2019d first build the image:

docker build -t ctk-aws .\n
[+] Building 2.1s (6/6) FINISHED                                                                                                                                                            \n => [internal] load build definition from Dockerfile                                                                                0.0s\n => => transferring dockerfile: 114B                                                                                                0.0s\n => [internal] load .dockerignore                                                                                                   0.0s\n => => transferring context: 2B                                                                                                     0.0s\n => [internal] load metadata for docker.io/chaostoolkit/chaostoolkit:latest                                                         2.0s\n => [1/2] FROM docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => => resolve docker.io/chaostoolkit/chaostoolkit:latest@sha256:3801eda37de7e8f00fb556220fff7935fea45d248881f4253cd9c29b4d3023f3   0.0s\n => CACHED [2/2] RUN pip install chaostoolkit-aws                                                                                   0.0s\n => exporting to image                                                                                                              0.0s\n => => exporting layers                                                                                                             0.0s\n => => writing image sha256:84f4579bee5ff42881a226643dbe37c8bc1e0ecb60e153c46395f9dc62a8f256                                        0.0s\n => => naming to docker.io/library/ctk-aws                                                                                          0.0s\n

Then you\u2019d confirm chaostoolkit-aws is available with:

docker run ctk-aws info extensions\n
NAME                                    VERSION   LICENSE                       DESCRIPTION\nchaostoolkit-aws                        0.16.0    Apache License Version 2.0    AWS\n
"},{"location":"reference/tutorials/ec2/","title":"Running Chaos Toolkit from an EC2 instance","text":"

It is common when using AWS for hosting your infrastructure that you\u2019ll have strict security policies in place. These policies will usually only allow for internal traffic within AWS, amongst various other things. A question we\u2019re asked a lot is can I run Chaos Toolkit from AWS, to run against AWS?. The answer is simply, yes, you can.

"},{"location":"reference/tutorials/ec2/#why-ec2","title":"Why EC2?","text":"

The reasons for providing a guide on running Chaos Toolkit from an EC2 instance are simple enough:

"},{"location":"reference/tutorials/ec2/#the-steps","title":"The Steps","text":"

There are a few pre-requisites required to be able to follow this guide:

"},{"location":"reference/tutorials/ec2/#1-create-your-instance","title":"1. Create your instance","text":"AWS ConsoleAWS CLI

To be able to connect to your instance via Session Manager, you\u2019ll first need to create a few IAM components.

Now that your instances IAM entities are sorted, you can create your instance.

"},{"location":"reference/tutorials/ec2/#2-connect-to-your-instance","title":"2. Connect to your instance","text":""},{"location":"reference/tutorials/ec2/#3-setup-chaos-toolkit","title":"3. Setup Chaos Toolkit","text":"

You\u2019ll see a prompt like:

sh-4.2$\n

Change to the home directory with:

cd ~\n

Create a new directory for your experimentation and navigate inside:

mkdir my-experiments && cd my-experiments\n

Create a virtual environment for the Chaos Toolkit dependencies:

python3 -m venv .venv && source .venv/bin/activate && python3 -m pip install --upgrade pip\n

Install chaostoolkit and its AWS extension chaostoolkit-aws:

pip3 install chaostoolkit chaostoolkit-aws\n
"},{"location":"reference/tutorials/ec2/#4-create-an-experiment","title":"4. Create an experiment","text":"

For the purpose of this guide, we will just create an experiment with a Steady State Hypothesis that interrogates EC2 and checks that our current instance, is in the running state. We don\u2019t have a method, we\u2019re merely showing that we can talk to AWS from within AWS.

Create a file named experiment.json with the following contents:

{\n\"title\": \"Running Chaos Toolkit from an EC2 instance\",\n\"description\": \"N/A\",\n\"tags\": [],\n\"steady-state-hypothesis\": {\n\"title\": \"Current EC2 is RUNNING\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"instance_state\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"chaosaws.ec2.probes\",\n\"func\": \"instance_state\",\n\"arguments\": {\n\"state\": \"running\",\n\"instance_ids\": [\n\"<INSTANCE_ID>\"\n],\n\"filters\": []\n}\n},\n\"tolerance\": true\n}\n]\n},\n\"method\": [],\n\"configuration\": {\n\"aws_region\": \"<REGION>\"\n}\n}\n

Replace the value of <INSTANCE_ID> with the value of the id of the current instance. Replace <REGION> with the name of the region the instance is deployed in.

You can then run the experiment with:

chaos run ./experiment.json\n
[2021-08-18 10:12:29 INFO] Validating the experiment's syntax\n[2021-08-18 10:12:29 INFO] Experiment looks valid\n[2021-08-18 10:12:29 INFO] Running experiment: Running Chaos Toolkit from an EC2 instance\n[2021-08-18 10:12:29 INFO] Steady-state strategy: default\n[2021-08-18 10:12:29 INFO] Rollbacks strategy: default\n[2021-08-18 10:12:29 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:12:29 INFO] Probe: instance_state\n[2021-08-18 10:12:29 ERROR]   => failed: botocore.exceptions.ClientError: An error occurred\n(UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to\nperform this operation.\n[2021-08-18 10:12:29 WARNING] Probe terminated unexpectedly, so its tolerance could not be validated\n[2021-08-18 10:12:29 CRITICAL] Steady state probe 'instance_state' is not in the given tolerance so\nfailing this experiment\n[2021-08-18 10:12:29 INFO] Experiment ended with status: failed\n

You\u2019ll notice the error you just received:

failed: botocore.exceptions.ClientError: An error occurred\n(UnauthorizedOperation) when calling the DescribeInstances operation: You are not\nauthorized to perform this operation.\n

This is because your instance profile role you created earlier doesn\u2019t have a suitable policy statement allowing you to describe EC2 instances.

Navigate to the IAM console and find the Policy you created earlier, add the following statement to it:

{\n\"Effect\": \"Allow\",\n\"Action\": [\n\"ec2:DescribeInstance*\"\n],\n\"Resource\": \"*\"\n}\n

Run your experiment again:

chaos run ./experiment.json\n
[2021-08-18 10:24:56 INFO] Validating the experiment's syntax\n[2021-08-18 10:24:56 INFO] Experiment looks valid\n[2021-08-18 10:24:56 INFO] Running experiment: Running Chaos Toolkit from an EC2\ninstance\n[2021-08-18 10:24:56 INFO] Steady-state strategy: default\n[2021-08-18 10:24:56 INFO] Rollbacks strategy: default\n[2021-08-18 10:24:56 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:24:56 INFO] Probe: instance_state\n[2021-08-18 10:24:56 INFO] Steady state hypothesis is met!\n[2021-08-18 10:24:56 INFO] Playing your experiment's method now...\n[2021-08-18 10:24:56 INFO] No declared activities, let's move on.\n[2021-08-18 10:24:56 INFO] Steady state hypothesis: Current EC2 is RUNNING\n[2021-08-18 10:24:56 INFO] Probe: instance_state\n[2021-08-18 10:24:56 INFO] Steady state hypothesis is met!\n[2021-08-18 10:24:56 INFO] Let's rollback...\n[2021-08-18 10:24:56 INFO] No declared rollbacks, let's move on.\n[2021-08-18 10:24:56 INFO] Experiment ended with status: completed\n

As you\u2019ll notice, your EC2 profile now has the suitable permissions. This should ultimately give you a good sense on how IAM allows you to give specific permissions to the instances running your Chaos Toolkit experiments.

"},{"location":"reference/tutorials/ec2/#summary","title":"Summary","text":"

Whilst the experiment within this guide was simple, the guide was not meant to teach you how to write experiments. The purpose of the guide was to show you how you might run Chaos Toolkit from AWS to interact with your AWS infrastructure.

You should now have an appreciation and the ability to:

"},{"location":"reference/tutorials/ec2/#notes","title":"Notes","text":"

It should be noted that several things could be done differently in this guide to suit your own setup, they could be as follows:

"},{"location":"reference/tutorials/extend/","title":"Learn the basic of extending the Chaos Toolkit","text":"

The Chaos Toolkit comes with a rich catalog of extensions. Sometimes however, this library is not enough. So, how do you go about extending the Chaos Toolkit?

It turns out there are a variety of ways.

"},{"location":"reference/tutorials/extend/#generate-a-binary-and-execute-it-from-the-experiment","title":"Generate a binary and execute it from the experiment","text":"

The Chaos Toolkit is written in Python 3, but you may not have the Python skills or willingness to develop it. One quick solution is to write your own small binary (say you are a rust or golang shop) and call it as a process action. Keep in mind that the binary may be used as a probe in the steady-state so ensure its returned value is easily processed via regex or jsonpath tolerance types. At the very least, the process should signal through its exit code if it completed normally (with 0).

For example, let\u2019s create a simple binary with rust. In a file named echo.rs:

use std::env;\n\nfn main() {\nlet args: Vec<String> = env::args().collect();\nprintln!(&args[1..]);\n}\n
rustc echo.rs\n
./echo hello world\n
[\"hello\", \"world\"]\n
echo $?\n
0\n

An action using this binary would look like this:

JSONYAML
{\n\"name\": \"echo-my-message\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"echo\",\n\"arguments\": \"hello world\"\n}\n}\n
name: echo-my-message\ntype: action\nprovider:\ntype: process\npath: echo\narguments: hello world\n

This assumes the binary is on the chaos PATH and the user has permissions.

"},{"location":"reference/tutorials/extend/#call-a-http-endpoint","title":"Call a HTTP endpoint","text":"

Sometimes, you have HTTP endpoints that are used internally for specific operational tasks. They are internals and crafted for your unique needs. This can be enough to create the bespoke condition for your probes and actions to call via a http provider.

"},{"location":"reference/tutorials/extend/#create-a-simple-python-function","title":"Create a simple Python function","text":"

While extending with a piece of Python code may sound more work, it does not have to be. Indeed, you can create a simple Python module and have a set of functions that are called from your experiment directly. THe trick is to ensure the module can be found in the PYTHONPATH.

Let\u2019s see an example:

Assuming a Python module called kettle.py:

from chaoslib.types import Configuration, Secrets\n\n__all__ = [\"put_on\"]\n\n\ndef put_on(temperature: int = 90, configuration: Configuration = None,\n           secrets: Secrets = None) -> None:\n\"\"\"\n    Sets the kettle to the expected temperature (celsius) and put it on.\n\n    Will return when the kettle has reached it.\n    \"\"\"\n    # do something here\n    pass\n

If kettle.py lives next to experiment.json then the action could be:

{\n\"name\": \"put-kettle-on\",\n\"type\": \"action\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"kettle\",\n\"func\": \"put_on\",\n\"arguments\": {\n\"temperature\": 80\n}\n}\n}\n

You could finally make it available as follows:

ls\n
kettle.py experiment.json\n
export PYTHONPATH=`pwd`\nchaos run experiment.json\n

The Python module does not have to live next to the experiment. It can also contain more than one function of course.

"},{"location":"reference/tutorials/run-flow/","title":"Learn all about the experiment execution\u2019s flow","text":""},{"location":"reference/tutorials/run-flow/#execution-flow-diagram","title":"Execution Flow Diagram","text":"

The diagram below shows the flow used by Chaos Toolkit when running an experiment:

"},{"location":"reference/tutorials/run-flow/#whats-happening-when-running-an-experiment","title":"What\u2019s happening when running an experiment?","text":"

Chaos Toolkit runs an experiment as given in the experiment\u2019s file. The default behavior is straightforward, it runs the activities from the file sequentially in the order they are declared.

The first block executed, if found, is the steady-state hypothesis block. In this particular instances, it acts as a sort of a gateway to say \u201cthe system is normal and meeting its baseline, you can carry on\u201d. By doing so, we notify the world is in a state which we can comprehend and make sense of.

Then, the method is applied. Usually the method consists of at least an action but can also contain probes and other actions. The first action defines the turbulence we want to introduce into the system and see if it impacts our initial baseline. Other actions should be few in numbers or they may render the reading of the results challenging. Probes are merely data collectors of what is happening in your system as the turbulence is happening. It helps the analysis.

Next, the steady state hypothesis is executed again but, this time, it tells us if our baseline has deviated considering the perturbation.

Finally, rollbacks are applied. They serve to usually undo the condition but should not be misunderstood as a way to put the system back to a normal state when the deviation really triggered a dire chain of events for your system.

"},{"location":"reference/tutorials/run-flow/#one-experiment-but-a-variety-of-execution-strategies","title":"One experiment but a variety of execution strategies","text":"

Schematically, the execution flow runs the hypothesis, the method, the hypothesis again and finally the rollbacks. However, this flow can somewhat controlled via the Chaos Toolkit runtime flags.

"},{"location":"reference/tutorials/run-flow/#hypothesis-strategies","title":"Hypothesis strategies","text":"

The default behavior is to execute the hypothesis before and after the method. Unless, the hypothesis fails during the \u201cbefore\u201d phase. In that case, the execution terminates as \"failed\" to signal the system wasn\u2019t in an appropriate baseline state for the experiment to make sense.

The chaos run command provides the --hypothesis-strategy flag to change the default behavior.

Sometimes, you have an experiment where you know the state is not appropriate but you want to see if a specific condition could bring it back and make the hypothesis valid after the method was applied. In that case, you should use --hypothesis-strategy=after-method-only.

On the contrary, if you don\u2019t want to assert any deviation, you can decide to run the hypothesis only before with --hypothesis-strategy=before-method-only.

More interesting use cases can then be applied. What if you have a long method and wish to not wait until it finishes to verify the hypothesis. Well, then you can use `--hypothesis-strategy=continuously to indicate that, on top of the default behavior, you want the hypothesis block to be applied during the method periodically. You can change the period, which defaults to every second, with --hypothesis-frequency=10. Notice that, in that case, Chaos Toolkit will not interrupt as soon as a deviation is found. To do that, you need to pass the additional --fail-fast flag.

Finally, you can also use --hypothesis-strategy=during-method-only to have the same behavior as continuously but removing the default verification before and after the method.

"},{"location":"reference/tutorials/run-flow/#rollback-strategies","title":"Rollback strategies","text":"

Rollbacks are always executed save for three conditions:

You may change that behavior with a chaos run flag.

Pass --rollback-strategy=always to apply rollbacks no matter the state of the execution.

Use --rollback-strategy=never to never play them. This can be useful during authoring of the experiment sometimes.

Use --rollback-strategy=deviated to play rollbacks only if a deviation was found.

"},{"location":"reference/tutorials/run-flow/#terminating-the-execution-gracefully","title":"Terminating the execution gracefully","text":"

Chaos Engineering is a powerful practice that may lead to undesirable side effects in your system. Sometimes, it is expected that an operator, or an automated service, terminates an experiment much earlier to prevent further difficulties.

"},{"location":"reference/tutorials/run-flow/#lets-start-with-the-default-behavior","title":"Let\u2019s start with the default behavior","text":"

When an experiment runs to its end it means that, even if a deviation was found, the Chaos Toolkit should leave nothing hanging around, such as zombie processes. Also, if rollbacks were declared and requested to be applied, they will be played. In other words, if your experiment is properly constructed, you should not have to do anything else.

Chaos Toolkit makes no promises that your system will be back to its normal however. The discovery you make along the way usually resolves in impacts that cannot be anticipated.

This means that when an experiment finishes, your system may well be in a very strange state but it does not mean Chaos Toolkit failed at doing its job. In fact, it\u2019s quite the exact nature of the beast: Chaos Engineering is making those pain points very clear to all.

Experiments can be interrupted. In that case, Chaos Toolkit tries its best to abide by the runtime condition that you set. For instance, if you decided to always play the rollbacks, Chaos Toolkit will execute them. The default behavior is not to play them however for the simple reason that if you interrupted an experiment, you may well want to investigate the system and if rollbacks were executed, you may lose some important traces or state.

"},{"location":"reference/tutorials/run-flow/#digging-into-the-interruptions-flow","title":"Digging into the interruption\u2019s flow","text":"

When the Chaos Toolkit receives a signal, it starts the termination flow of the experiment:

"},{"location":"reference/tutorials/run-flow/#reacting-to-signals-aka-being-a-good-citizen","title":"Reacting to signals, aka being a good citizen","text":"

The Chaos Toolkit knows it makes operators confident it will act appropriately upon receiving a variety of signals. It supports therefore the following signals:

In all cases, the termination flow is triggered. The only different one is SIGUSR2 which will always ignore rollbacks and will not wait for background activities to terminate normally. In other words, SIGUSR2 is the only way you can terminate harshly an experiment.

Otherwise, there are no visible difference between SIGINT, SIGTERM and SIGUSR1.

"},{"location":"reference/tutorials/tolerance/","title":"Learn all about Steady-State Hypothesis Tolerances","text":"

A Chaos Engineering experiment starts and ends with a steady-state hypothesis.

The objective is initially to act as a validation gateway whereby, if the steady-state is not met before we execute the method, then the experiment bails out. What can you learn from an unknown state already?

Then, once the method has been applied, the goal is understand if the system coped with the turbulence or if it deviated, implying a weakness may have been uncovered.

To achieve this, the Chaos Toolkit experiment expects you use probes to query your system\u2019s state during the steady-state hypothesis. The validation of the probes\u2019 output is performed by what we call tolerances.

"},{"location":"reference/tutorials/tolerance/#lets-get-started-with-a-basic-example","title":"Let\u2019s get started with a basic example","text":"

Let\u2019s take the simple experiment below:

JSONYAML
{\n\"title\": \"Our default language is English\",\n\"description\": \"We find the expected English language in the file\",\n\"steady-state-hypothesis\": {\n\"title\": \"Our hypothesis is that lang file is in English\",\n\"probes\": [\n{\n\"type\": \"probe\",\n\"name\": \"lookup-lang-file\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"default.locale.txt\"\n}\n}\n},\n{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n]\n},\n\"method\": [\n{\n\"type\": \"action\",\n\"name\": \"switch-language-to-french\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"sed\",\n\"arguments\": \"-i s/hello/bonjour/ default.locale.txt\"\n}\n}\n],\n\"rollbacks\": [\n{\n\"type\": \"action\",\n\"name\": \"switch-language-back-to-english\",\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"sed\",\n\"arguments\": \"-i s/bonjour/hello/ default.locale.txt\"\n}\n}\n]\n}\n
title: Our default language is English\ndescription: We find the expected English language in the file\nsteady-state-hypothesis:\ntitle: Our hypothesis is that lang file is in English\nprobes:\n- type: probe\nname: lookup-lang-file\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: default.locale.txt\n- type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\nmethod:\n- type: action\nname: switch-language-to-french\nprovider:\ntype: process\npath: sed\narguments: '-i s/hello/bonjour/ default.locale.txt'\nrollbacks:\n- type: action\nname: switch-language-back-to-english\nprovider:\ntype: process\npath: sed\narguments: '-i s/bonjour/hello/ default.locale.txt'\n

This experiment looks for the welcome message in the default locale file and expected \"hello\".

Here is an example of it running:

chaos run experiment.json\n
[2019-06-25 21:37:59 INFO] Validating the experiment's syntax\n[2019-06-25 21:37:59 INFO] Experiment looks valid\n[2019-06-25 21:37:59 INFO] Running experiment: Our default language is English\n[2019-06-25 21:37:59 INFO] Steady state hypothesis: Our hypothesis is that lang file is in English\n[2019-06-25 21:37:59 INFO] Probe: lookup-lang-file\n[2019-06-25 21:37:59 INFO] Probe: lookup-text-in-lang-file\n[2019-06-25 21:37:59 INFO] Steady state hypothesis is met!\n[2019-06-25 21:37:59 INFO] Action: switch-language-to-french\n[2019-06-25 21:37:59 INFO] Steady state hypothesis: Our hypothesis is that lang file is in English\n[2019-06-25 21:37:59 INFO] Probe: lookup-lang-file\n[2019-06-25 21:37:59 INFO] Probe: lookup-text-in-lang-file\n[2019-06-25 21:37:59 INFO] Steady state hypothesis is met!\n[2019-06-25 21:37:59 INFO] Let's rollback...\n[2019-06-25 21:37:59 INFO] Rollback: switch-language-back-to-english\n[2019-06-25 21:37:59 INFO] Action: switch-language-back-to-english\n[2019-06-25 21:37:59 INFO] Experiment ended with status: completed\n

In this experiment, we have two probes checking two basic facets of our system. First, we ensure the locale file exists and then we validate the file contains our expected value.

Let\u2019s now analyse the two tolerances we used.

First, we use a Python provider which calls the os.path.exists(path) standard library function. This function returns a boolean and that is what the tolerance checks for.

The second probe calls a process which sets its exit code to 0 when the command succeeds. Again, this is the value that the tolerance validates.

Now that we know the basics, let\u2019s move on to see what are the supported tolerances.

"},{"location":"reference/tutorials/tolerance/#built-in-supported-tolerances","title":"Built-in supported tolerances","text":"

The experiment specification describes the supported tolerances but let\u2019s review them more pragmatically here.

Chaos Toolkit aims at being easy for simple tasks whenever it can. In this case, for the general use-cases, we support the following tolerances:

In these three cases, the probe\u2019s output must equal the given tolerance.

On top of this native types, we support also more advance cases such as:

JSONYAML
{\n\"type\": \"range\",\n\"range\": [6.4, 7.5]\n}\n
type: range\nrange:\n- 6.4\n- 7.5\n

The range is an inclusive min-max range made of numerical values. This is handy when validating a gauge for instance.

JSONYAML
{\n\"type\": \"regex\",\n\"target\": \"stdout\",\n\"pattern\": \"^welcome=hello$\"\n}\n
type: regex\ntarget: stdout\npattern: \"^welcome=hello$\"\n

Currently supported targets per provider are as follows:

Provider Default Values process \"status\" \"stdout\", \"stderr\" http \"status\" \"headers\", \"body\" python Undefined Undefined JSONYAML
{\n\"type\": \"jsonpath\",\n\"path\": \"...\"\n}\n
type: jsonpath\npath: ...\n

The path must be a valid JSONPath supported by the jsonpath2 library. This is handy when looking for a value in a mapping output.

JSONYAML
{\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n...\n}\n}\n
type: probe\nprovider:\ntype: python\n

In that case the tolerance is run as yet another probe which must return a boolean. The probe must accept an argument called value that is set to the output of the steady-state probe. In essence, a probe validating the output of another probe. This is advanced stuff only used when the builtin probes won\u2019t cut it.

"},{"location":"reference/tutorials/tolerance/#common-scenarios","title":"Common scenarios","text":"

Let\u2019s now review how to apply these tolerances to most common scenarios.

"},{"location":"reference/tutorials/tolerance/#validate-the-return-code-of-a-boolean-python-probe","title":"Validate the return code of a boolean Python probe","text":"

In this case, the simple boolean tolerance will do.

For instance:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-lang-file\",\n\"tolerance\": true,\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"os.path\",\n\"func\": \"exists\",\n\"arguments\": {\n\"path\": \"default.locale.txt\"\n}\n}\n}\n
type: probe\nname: lookup-lang-file\ntolerance: true\nprovider:\ntype: python\nmodule: os.path\nfunc: exists\narguments:\npath: default.locale.txt\n
"},{"location":"reference/tutorials/tolerance/#validate-the-exit-code-of-a-process","title":"Validate the exit code of a process","text":"

In this case, the simple integer tolerance will do. Indeed, the Chaos Toolkit will look by default to the exit code of the process for validation.

In the above example:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\n

Assuming, we would be expecting an error, which commonly translates to an exit code 1, we would switch to \"tolerance\": 1.

"},{"location":"reference/tutorials/tolerance/#validate-the-status-code-of-a-http-probe","title":"Validate the status code of a HTTP probe","text":"

In this case, the simple integer tolerance will do. Indeed, the Chaos Toolkit will look by default to the status code of the HTTP response for validation.

For instance:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": 200,\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entity\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance: 200\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entity'\n
"},{"location":"reference/tutorials/tolerance/#specific-scenarios","title":"Specific scenarios","text":""},{"location":"reference/tutorials/tolerance/#validate-the-stdoutstderr-of-a-process","title":"Validate the stdout/stderr of a process","text":"

Assuming you want to validate the actual standard output of a process, you need to got a regular expression approach, as follows:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": {\n\"type\": \"regex\",\n\"pattern\": \"welcome=hello\",\n\"target\": \"stdout\"\n},\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"cat\",\n\"arguments\": \"default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance:\ntype: regex\npattern: welcome=hello\ntarget: stdout\nprovider:\ntype: process\npath: cat\narguments: default.locale.txt\n

The important extra property to set here is target which tells the Chaos Toolkit where to locate the value to apply the pattern against. The reason we set stdout here is because a process probe returns an object made of three properties: \"status\", \"stdout\" and \"stderr\".

"},{"location":"reference/tutorials/tolerance/#validate-the-json-body-of-a-http-probe","title":"Validate the JSON body of a HTTP probe","text":"

In this case, use a jsonpath tolerance.

For instance, let\u2019s assume you receive the following JSON payload:

{\n\"foo\": [{\"baz\": \"hello\"}, {\"baz\": \"bonjour\"}]\n}\n
JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"expect\": [\"hello\", \"bonjour\"],\n\"target\": \"body\"\n},\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entities\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\nexpect:\n- hello\n- bonjour\ntarget: body\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entities'\n

The expect property tells the Chaos Toolkit what are the values to match against once the JSON Path has been applied against the body of the response of the HTTP probe\u2019s output.

You may also validate against a number of extracted values instead:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"count\": 2,\n\"target\": \"body\"\n},\n\"provider\": {\n\"type\": \"http\",\n\"url\": \"https://example.com/api/v1/entities\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\ncount: 2\ntarget: body\nprovider:\ntype: http\nurl: 'https://example.com/api/v1/entities'\n
"},{"location":"reference/tutorials/tolerance/#validate-the-output-of-a-python-probe-returning-a-mapping","title":"Validate the output of a Python probe returning a mapping","text":"

In this case, use a jsonpath tolerance.

For instance, let\u2019s assume you receive the following payload:

{\n\"foo\": [{\"baz\": \"hello\"}, {\"baz\": \"bonjour\"}]\n}\n
JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"expect\": [\"hello\", \"bonjour\"]\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"...\",\n\"func\": \"...\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\nexpect:\n- hello\n- bonjour\nprovider:\ntype: python\nmodule: ...\nfunc: ...\n

The expect property tells the Chaos Toolkit what are the values to match against once the JSON Path has been applied against the probe\u2019s output.

You may also validate against a number of extracted values instead:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"resource-must-exist\",\n\"tolerance\": {\n\"type\": \"jsonpath\",\n\"path\": \"$.foo.*[?(@.baz)].baz\",\n\"count\": 2\n},\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"...\",\n\"func\": \"...\"\n}\n}\n
type: probe\nname: resource-must-exist\ntolerance:\ntype: jsonpath\npath: '$.foo.*[?(@.baz)].baz'\ncount: 2\nprovider:\ntype: python\nmodule: ...\nfunc: ...\n
"},{"location":"reference/tutorials/tolerance/#advanced-scenarios","title":"Advanced Scenarios","text":"

The last case you may be reviewing now is when the default tolerances cannot support your use case. Then, you want to create your own tolerance by writing a new probe that takes the output, of the tolerance under validation, as an argument. Usually, this tolerance probe is implemented in Python to have more power but this isn\u2019t compulsory.

For instance, the following:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": 0,\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"grep\",\n\"arguments\": \"welcome=hello default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance: 0\nprovider:\ntype: process\npath: grep\narguments: welcome=hello default.locale.txt\n

could be written as follows:

JSONYAML
{\n\"type\": \"probe\",\n\"name\": \"lookup-text-in-lang-file\",\n\"tolerance\": {\n\"name\": \"search-text\",\n\"type\": \"probe\",\n\"provider\": {\n\"type\": \"python\",\n\"module\": \"my.package\",\n\"func\": \"search_text\",\n\"arguments\": {\n\"path\": \"default.local.txt\",\n\"search_for\": \"welcome=hello\"\n}\n}\n},\n\"provider\": {\n\"type\": \"process\",\n\"path\": \"cat\",\n\"arguments\": \"default.locale.txt\"\n}\n}\n
type: probe\nname: lookup-text-in-lang-file\ntolerance:\nname: search-text\ntype: probe\nprovider:\ntype: python\nmodule: my.package\nfunc: search_text\narguments:\npath: default.local.txt\nsearch_for: welcome=hello\nprovider:\ntype: process\npath: cat\narguments: default.locale.txt\n

In that case, implement the search_text(path: str, search_for: str, value: dict) -> bool function in the my.package Python module.

import re\n\n\ndef search_text(path: str, search_for: str, value: dict = None) -> bool:\n    with open(path) as f:\n        content = f.read()\n        return re.compile(search_for).match(value[\"stdout\"]) is not None\n

As you can see, the value argument is not declared but must exist in the signature of the function. It is injected by the Chaos Toolkit and is set to the probe\u2019s output.

"},{"location":"reference/usage/cli/","title":"Overview","text":"

The heart of the Chaos Toolkit is the chaos command line.

Activate the Python virtual environment

If you run the Chaos Toolkit directly, rather than using a container, always ensure you have activated the virtual environment so that it can be found along its dependencies:

source ~/.venvs/chaostk/bin/activate\n

Once installed, the Chaos Toolkit CLI will display the commands it supports by executing:

chaos --help\n
Usage: chaos [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --version                   Show the version and exit.\n  --verbose                   Display debug level traces.\n  --no-version-check          Do not search for an updated version of the\n                              chaostoolkit.\n  --change-dir TEXT           Change directory before running experiment.\n  --no-log-file               Disable logging to file entirely.\n  --log-file TEXT             File path where to write the command's log.\n                              [default: chaostoolkit.log]\n  --log-format [string|json]  Console logging format: string, json.\n  --settings TEXT             Path to the settings file.  [default:\n                              /Users/ciaran/.chaostoolkit/settings.yaml]\n  --help                      Show this message and exit.\n\nCommands:\n  discover  Discover capabilities and experiments.\n  info      Display information about the Chaos Toolkit environment.\n  init      Initialize a new experiment from discovered capabilities.\n  run       Run the experiment loaded from SOURCE, either a local file or...\n  settings  Read, write or remove from your settings file.\n  validate  Validate the experiment at SOURCE.\n

"},{"location":"reference/usage/cli/#configure-the-chaos-toolkit","title":"Configure the Chaos Toolkit","text":"

For the most part, the Chaos Toolkit does not need to be configured. However, if it does, the settings are stored in a YAML file on your local machine.

Tip

Unless you enable one of the features requiring extra configuration, you don\u2019t need to create that file. If a feature requires extra configuration, its documentation will say so.

"},{"location":"reference/usage/cli/#create-the-settings-file","title":"Create the settings file","text":"

The settings file for the Chaos Toolkit should be located under the following path:

$HOME/.chaostoolkit/settings.yaml\n

As this file may hold sensitive data, it is advised to make it readable only for your own user:

chmod 600 $HOME/.chaostoolkit/settings.yaml\n
"},{"location":"reference/usage/cli/#how-to-investigate-issues","title":"How to Investigate Issues","text":"

When your experiment fails to work as you would expect, you should start looking at the chaostoolkit.log file written to by the chaos command.

This file contains a lot of traces from the Chaos Toolkit core but also any extensions that used the toolkit\u2019s logger.

As new logs are appended to that file, it may grow big. Do not hesitate to wipe it out from time to time.

Please, do make sure to visit our Slack or GitHub when you have a question around how the toolkit does things. The community will be pleased to help you out.

"},{"location":"reference/usage/discover/","title":"The chaos discover command","text":"

You use the chaos discover command to specify a Chaos Toolkit integration extension and, if supported by the integration, to then explore your target environment in order to build a discovery report that can be used by the chaos init command to help you bootstrap your own chaos engineering experiments.

You can see the options available to you by executing:

chaos discover --help\n
Usage: chaos discover [OPTIONS] PACKAGE\n\n  Discover capabilities and experiments.\n\nOptions:\n  --no-system-info       Do not discover system information.\n  --no-install           Assume package already in PYTHONPATH.\n  --discovery-path TEXT  Path where to save the the discovery outcome.\n                         [default: ./discovery.json]\n  --help                 Show this message and exit.\n

A tutorial on how to use the chaos discover command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/discover/#discovering-capabilities-and-experiments","title":"Discovering capabilities and experiments","text":"

To execute discover all you need to do is specify the Chaos Toolkit integration extension that you\u2019d like to use, for example to use Kubernetes:

chaos discover chaostoolkit-kubernetes\n
[2021-07-30 11:43:38 INFO] Attempting to download and install package 'chaostoolkit-kubernetes'\n[2021-07-30 11:43:45 INFO] Package downloaded and installed in current environment\n[2021-07-30 11:43:45 INFO] Discovering capabilities from chaostoolkit-kubernetes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.deployment.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.deployment.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.node.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.node.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.pod.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.pod.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.replicaset.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.service.actions\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.service.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.statefulset.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.statefulset.probes\n[2021-07-30 11:43:45 INFO] Searching for actions in chaosk8s.crd.actions\n[2021-07-30 11:43:45 INFO] Searching for probes in chaosk8s.crd.probes\n[2021-07-30 11:43:45 INFO] Discovery outcome saved in ./discovery.json\n

The chaos discover command will produce a report saved in ./discovery.json by default, although you can specify where this report is produced by supplying the --discovery-report-path option.

"},{"location":"reference/usage/discover/#discovery-without-system-information","title":"Discovery without System Information","text":"

To not probe the target system during the discovery process you can supply the --no-system-info option.

"},{"location":"reference/usage/discover/#discovery-without-installation-of-an-integration-extension","title":"Discovery without Installation of an Integration Extension","text":"

If you already have the integration extension installed and available you can speed up the discovery process by specifying the --no-install option.

"},{"location":"reference/usage/init/","title":"The chaos init command","text":"

You use the chaos init command to take a discovery report, usually created by the chaos discover command, to then create an experiment based upon what has been discovered about the integration extension and, if applicable, the target environment.

You can see the options available to you by executing:

chaos init --help\n
Usage: chaos init [OPTIONS]\n\n  Initialize a new experiment from discovered capabilities.\n\nOptions:\n  --discovery-path PATH   Path to the discovery outcome.  [default:\n                          ./discovery.json]\n  --experiment-path PATH  Path where to save the experiment (.yaml or .json)\n                          [default: ./experiment.json]\n  --help                  Show this message and exit.\n

A tutorial on how to use the chaos init command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/init/#initialise-a-new-experiment","title":"Initialise a new experiment","text":"

To initialise a new experiment based on what has been discovered you simply need to execute the chaos init command:

chaos init\n
The following is a capture of the output after running chaos init and following the interactive prompts: [2018-01-30 15:54:50 INFO] Let's build a new experiment Experiment's title: My new experiment Add an activity to your method Activity (0 to escape): 1 Kill a microservice by `name` in the namespace `ns`. The microservice is killed by deleting the deployment for it without a graceful period to trigger an abrupt termination. The selected resources are matched by the given `label_selector`. Do you want to use this action? [y/N]: y Argument's value for 'name': Argument's value for 'ns' [default]: Argument's value for 'label_selector' [name in ({name})]: app=webapp-app Do you want to select another activity? [y/N]: N [2018-01-30 15:55:21 INFO] Experiment created and saved in './experiment.json'

By default, the chaos init command will look for a ./discovery.json file and use that as the basis of a new experiment\u2019s initialisation.

You can specify another file to be used by suppling the --discovery-report-path option.

In addition the default output from the init command will be a new Chaos Toolkit experiment definition in a ./experiment.json file. If you would prefer a different filename then this can be specified using the --experiment-path option.

"},{"location":"reference/usage/install/","title":"How to Install the Chaos Toolkit","text":""},{"location":"reference/usage/install/#python-requirements","title":"Python Requirements","text":"

The chaostoolkit CLI is implemented in Python 3 and this requires a working Python installation to run. It officially supports Python 3.7+. It has only been tested against CPython.

"},{"location":"reference/usage/install/#install-python","title":"Install Python","text":"

Install Python for your system:

On MacOS X:

brew install python3\n

On Debian/Ubuntu:

sudo apt-get install python3 python3-venv\n

On Windows:

Download the latest binary installer from the Python website.

"},{"location":"reference/usage/install/#create-a-virtual-environment","title":"Create a virtual environment","text":"

Dependencies can be installed for your system via its package management but, more likely, you will want to install them yourself in a local virtual environment.

python3 -m venv ~/.venvs/chaostk\n

Make sure to always activate your virtual environment before using it:

source  ~/.venvs/chaostk/bin/activate\n

Tip

You may want to use virtualenvwrapper to make this process much nicer.

"},{"location":"reference/usage/install/#install-the-cli","title":"Install the CLI","text":"

Install chaostoolkit in the virtual environment as follows:

pip install -U chaostoolkit\n

You can verify the command was installed by running:

chaos --version\n
"},{"location":"reference/usage/install/#install-extensions","title":"Install Extensions","text":"

At this stage, you have installed the chaos command line and its core library. To fully enjoy the Chaos Toolkit, you will also want to install extensions for the various facets of your journey into Chaos Engineering.

"},{"location":"reference/usage/notification/","title":"Get Notifications From The Chaos Toolkit Flow","text":"

The Chaos Toolkit generates events when it is executed. You may benefit from those events to get notified via your chosen notification channels.

"},{"location":"reference/usage/notification/#chaos-toolkit-flow-events","title":"Chaos Toolkit Flow Events","text":"

The Chaos Toolkit defines the following events:

Discovery flow

Init flow

Run flow

Validate flow

"},{"location":"reference/usage/notification/#notification-event-structure","title":"Notification Event Structure","text":"

The events structure is as follows:

{\n\"name\": \"run-started|...\",\n\"payload\": \"the payload for the given event\",\n\"phase\": \"run|discovery|init|validate\",\n\"error\": \"only set when an error was triggered. Set to the actual raw error\",\n\"ts\": \"<now>\"\n}\n

Note, the error is not a failure of the experiment\u2019s steady-state but an error during the processing of the flow (for instance, the experiment\u2019s file has a mistake somewhere in its syntax, or an exception is raised somehow).

"},{"location":"reference/usage/notification/#declare-notification-channels","title":"Declare Notification Channels","text":"

Notification channels are declared in the Chaos Toolkit settings file under the notifications: section.

Here is an example:

notifications:\n- type: http\nurl: https://mystuff.com/api\nverify_tls: false\nheaders:\nAuthorization: \"Bearer 1234\"\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

As you can see, channels are items in a list. Each channel is a mapping describing the kind of channel and its required information.

For instance, here we have two channels. The first one is a call to the HTTPS endpoint while the other one uses the Chaos Toolkit Extension for Slack to send messages to Slack channels.

Warning

Notification channels are run sequential to the whole chaos flow, so the more you declare, the bigger the impact they could have on the readability of the experiment results.

"},{"location":"reference/usage/notification/#filter-events","title":"Filter Events","text":"

By default, all events are sent to the channels. However, you may decide, on a per channel basis, which events you want to be sent. This is done by adding the events field to a channel:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\nevents:\n- run-failed\n

The Slack channel will only receive events when a run experiment fails. This is a list so declare as many events as you need.

"},{"location":"reference/usage/notification/#http-notification-channel","title":"HTTP Notification Channel","text":"

A HTTP notification channel tells the Chaos Toolkit it must send the event over HTTP (or HTTPS) to the given endpoint. Here is the description of its fields:

"},{"location":"reference/usage/notification/#plugin-notification-channel","title":"Plugin Notification Channel","text":"

A plugin notification channel is an integration between an external system and the Chaos Toolkit event notification flow. It is more capable than basic HTTP channels as they are fully fledged Python functions.

Warning

A plugin channel could also be understood as a hook point into the Chaos Toolkit flow. Nothing prevents you from writing a plugin that performs operations based on those hook events. Please note however that they run sequentially to the whole flow, so the longer your operation takes, the longer it takes for your chaos experiment to carry on. This may invalidate certain experiments when timing is critical.

Here are the fields to declare one:

Any other fields will be passed on as-is to the function for its internal usage. For instance:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

The token and channel fields will be provided directly to the notify function of the chaosslack.notification module.

"},{"location":"reference/usage/notification/#send-notifications-to-slack","title":"Send Notifications To Slack","text":"

Notifying about Chaos Experiment runs in a Slack channel is so common that we will describe this integration here.

First, you must install the Chaos Toolkit Integration for Slack:

pip install -U chaostoolkit-slack\n

Then, you should declare your notification channels as follows in the Chaos Toolkit settings file:

notifications:\n- type: plugin\nmodule: chaosslack.notification\ntoken: xop-1235\nchannel: general\n

You may define as many channels as you need, for instance for different kind of events.

The token and channel fields are mandatory in this case. The token field must be set to a valid Slack token. You may start with a legacy token before moving on to a Slack App as per Slack guidelines.

The Chaos Toolkit itself does not provide a Slack App at this moment.

The channel must be a name of an existing channel. The payload message sent to Slack is defined in the plugin. If you need to amend it, please open an issue there.

"},{"location":"reference/usage/notification/#debugging-notifications","title":"Debugging Notifications","text":"

The Chaos Toolkit does its best to not break the experiment when an event could not be pushed. If you do not see the notification you were expecting, you should start investigating in the chaostoolkit.log file. If Chaos Toolkit could handle the issue gracefully, it will log the error at the DEBUG level.

If the error occurs inside the core Chaos Toolkit library, please raise an issue there. Otherwise, raise an issue with the appropriate plugin.

"},{"location":"reference/usage/report/","title":"The chaos report command","text":"

You use the chaos report command to take the journal produced by the chaos run command and produce a report in a specified format.

Due to the many operating system-dependent features that the chaos report command relies upon, the chaos report command is not installed with the Chaos Toolkit CLI. To install the chaos report command you need to install the chaostoolkit-reporting plugin and the dependencies appropriate to your own operating system.

Once the plugin is installed you can see the options available to you by executing:

chaos report --help\n
Usage: chaos report [OPTIONS] [JOURNAL]... REPORT\n\n  Generate a report from the run journal(s).\n\nOptions:\n  --export-format TEXT  Format to export the report to: html, markdown, pdf.\n  --help                Show this message and exit.\n

A tutorial on how to use the chaos report command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/report/#generating-a-report","title":"Generating a report","text":"

When an experiment completes after using the chaos run command a journal is generated and stored in the chaos-report.json file. A PDF or HTML report may be generated from this journal using the chaostoolkit-reporting library.

The chaos report command expects the path to the chaos-report.json file and a path to the actual report file that you require.

You can export various formats of report by specifying what you want using the --export-format option.

For example, to generate a PDF report you can run the following command:

chaos report --export-format=pdf chaos-report.json report.pdf\n

An HTML report can be produced using:

chaos report --export-format=html5 chaos-report.json report.html\n
"},{"location":"reference/usage/run/","title":"The chaos run command","text":"

You use the chaos run command to execute your declarative chaos engineering experiments. To see the options that can be passed to the chaos run command, execute:

chaos run --help\n
Usage: chaos run [OPTIONS] SOURCE\n\n  Run the experiment loaded from SOURCE, either a local file or a HTTP\n  resource. SOURCE can be formatted as JSON or YAML.\n\nOptions:\n  --journal-path TEXT             Path where to save the journal from the\n                                  execution.\n  --dry                           Run the experiment without executing\n                                  activities.\n  --no-validation                 Do not validate the experiment before\n                                  running.\n  --no-verify-tls                 Do not verify TLS certificate.\n  --rollback-strategy [default|always|never|deviated]\n                                  Rollback runtime strategy. Default is to\n                                  never play them on interruption or failed\n                                  hypothesis.\n  --var TEXT                      Specify substitution values for\n                                  configuration only. Can be provided multiple\n                                  times. The pattern must be key=value or\n                                  key:type=value. In that latter case, the\n                                  value will be casted as the specified type.\n                                  Supported types are: int, float, bytes. No\n                                  type specified means a utf-8 decoded string.\n  --var-file PATH                 Specify files that contain configuration and\n                                  secret substitution values. Either as a\n                                  json/yaml payload where each key has a value\n                                  mapping to a configuration entry. Or a .env\n                                  file defining environment variables. Can be\n                                  provided multiple times.\n  --hypothesis-strategy [default|before-method-only|after-method-only|during-method-only|continuously]\n                                  Strategy to execute the hypothesis during\n                                  the run.\n  --hypothesis-frequency FLOAT    Pace at which running the hypothesis. Only\n                                  applies when strategy is either: during-\n                                  method-only or continuously\n  --fail-fast                     When running in the during-method-only or\n                                  continuous strategies, indicate the\n                                  hypothesis can fail the experiment as soon\n                                  as it deviates once. Otherwise, keeps\n                                  running until the end of the experiment.\n  --help                          Show this message and exit.\n

A tutorial on how to use the chaos run command is available as part of the Chaos Toolkit\u2019s Getting Started tutorials.

"},{"location":"reference/usage/run/#executing-an-experiment-plan","title":"Executing an Experiment Plan","text":"

To execute an experiment plan you simply pass it to the chaos run command:

chaos run experiment.json\n
[2018-01-30 16:35:04 INFO] Validating experiment's syntax\n[2018-01-30 16:35:04 INFO] Experiment looks valid\n[2018-01-30 16:35:04 INFO] Running experiment: My new experiment\n[2018-01-30 16:35:04 INFO] No steady state hypothesis defined. That's ok, just exploring.\n[2018-01-30 16:35:04 INFO] Action: kill_microservice\n[2018-01-30 16:35:04 INFO] No steady state hypothesis defined. That's ok, just exploring.\n[2018-01-30 16:35:04 INFO] Let's rollback...\n[2018-01-30 16:35:04 INFO] No declared rollbacks, let's move on.\n[2018-01-30 16:35:04 INFO] Experiment ended with status: completed\n

Chaos Toolkit will log all the steps it follows from your plan in a journal which by default is called journal.json. You can specify the name of this journal output file using the --journal-path option.

"},{"location":"reference/usage/run/#rehearsing-an-experiment-execution","title":"Rehearsing an experiment execution","text":"

To test that you have a valid experiment you can pass the --dry option.

"},{"location":"reference/usage/run/#run-an-experiment-without-validation","title":"Run an experiment without validation","text":"

You can run an experiment and skip the experiment\u2019s validation using the --no-validation option.

"},{"location":"reference/usage/run/#run-an-experiment-with-different-steady-state-strategies","title":"Run an experiment with different steady state strategies","text":"

By default, the steady state will be tested before and after an experiment runs. However, you can specify a different strategy through the --hypothesis-strategy parameter. The options are:

For example:

chaos run ./experiment.json --hypothesis-strategy continuously\n

"},{"location":"reference/usage/run/#run-an-experiment-with-different-rollback-strategies","title":"Run an experiment with different rollback strategies","text":"

In Chaos Toolkit, rollbacks are always played unless one of the two followings is true:

The Chaos Toolkit provides a mechanism (since v1.5.0) that gives the operator a chance to change that behavior.

"},{"location":"reference/usage/run/#always-run-rollbacks","title":"Always run rollbacks","text":"

Ensure rollbacks are always applied

chaos run --rollback-strategy=always experiment.json\n
"},{"location":"reference/usage/run/#run-rollbacks-only-on-deviation","title":"Run rollbacks only on deviation","text":"

Run the rollbacks only if your experiment deviated.

chaos run --rollback-strategy=deviated experiment.json\n
"},{"location":"reference/usage/run/#never-run-rollbacks-strategy","title":"Never run rollbacks strategy","text":"

Never run any rollbacks, for instance when you want to explore the system after a successful experiment without undoing what the experiment changed:

chaos run --rollback-strategy=never experiment.json\n
"},{"location":"reference/usage/run/#override-configuration-and-secrets-at-runtime","title":"Override configuration and secrets at runtime","text":"

While configuration and secrets are declared in the experiment itself, you may sometimes need to override the values at runtime. This can be achieved through the --var KEY[:TYPE]=VALUE or --var-file filepath.json|yaml|.env flags.

The --var KEY[:TYPE]=VALUE can only override configuration values to prevent laking secrets on the command line. The KEY is the final key used in the experiment, for instance:

{\n\"configuration\": {\n\"message\": \"hello world\"\n}\n}\n

or

{\n\"configuration\": {\n\"message\": {\n\"type\": \"env\",\n\"key\": \"MY_MESSAGE\"\n}\n}\n}\n

In both cases, the override key is message.

If you specify the TYPE it must be one of str, int, float, bytes with str the default so not required. Chaos Toolkit will try to convert the given VALUE to the specified type and fail if it cannot.

The --var-file filepath.json|yaml|.env gives you the opportunity to override the configuration and secrets blocks. the format of the json and yaml files are as follows:

{\n\"configuration\": {\n\"KEY\": VALUE\n},\n\"secrets\": {\n\"scope\": {\n\"KEY\": VALUE\n}\n}\n}\n
---\nconfiguration:\nKEY: VALUE\nsecrets:\nscope:\nKEY: VALUE\n

The secrets block follows the same format as the experiment so the scope is the scope given in the experiment. For example:

{\n\"configuration\": {\n\"service_name\": \"ec2\"\n},\n\"secrets\": {\n\"aws\": {\n\"api_token\": \"1234\",\n\"something\": \"whatever\"\n}\n}\n}\n

would turn as the following var file:

{\n\"secrets\": {\n\"aws\": {\n\"api_token\": \"56787\"\n}\n}\n}\n

We are not overridding the configuration section and only part of the secrets section.

Finally, should you keep your variables in a .env file, it will only be able to override the configuration.

"},{"location":"reference/usage/scheduling/","title":"Scheduling your Experiments","text":"

Scheduling is not built into the Chaos Toolkit itself. However it is common to want to run an experiment periodically when you may not be at the keyboard.

In these cases we recommend using a system such as cron to schedule your experiment executions. You can also use a Kubernetes job to give you full control over the lifecycle of that job using the common Kubernetes features.

"},{"location":"reference/usage/upgrade/","title":"How to Upgrade the Chaos Toolkit","text":"

You can update your Chaos Toolkit installation by executing:

pip install -U chaostoolkit\n
"},{"location":"resources/logos/","title":"Chaos Toolkit Resources: Logos","text":"

The following resources are licensed under the CC BY 4.0 license so you can use them wherever you (presentations, web sites etc) like as long as you attribute back to the Chaos Toolkit project:

"},{"location":"resources/slides/","title":"Chaos Toolkit Resources: Slides","text":"

The following is a growing collection of slides that can be used by anyone in the community when speaking about the Chaos Toolkit. These resources are licensed under the CC BY 4.0 license so you can use them wherever you like (presentations, web sites etc) as long as you attribute back to the Chaos Toolkit project:

"},{"location":"shared/code/","title":"Chaos Toolkit Documentation Support Code","text":"

Support code for the documentation.

You may want to clone this repository to play with the code used in the tutorials.

"}]} \ No newline at end of file diff --git a/shared/code/index.html b/shared/code/index.html index 82789188..22191227 100644 --- a/shared/code/index.html +++ b/shared/code/index.html @@ -1 +1 @@ - Chaos Toolkit Documentation Support Code -
Skip to content

Chaos Toolkit Documentation Support Code

Support code for the documentation.

You may want to clone this repository to play with the code used in the tutorials.

\ No newline at end of file + Chaos Toolkit Documentation Support Code -
Skip to content

Chaos Toolkit Documentation Support Code

Support code for the documentation.

You may want to clone this repository to play with the code used in the tutorials.

\ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 642ea18e..e371a346 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,307 +2,307 @@ https://chaostoolkit.org/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/deployment/k8s/operator/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/addons/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/ansible/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/aws/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/azure/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/cloudfoundry/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/datadog/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/dynatrace/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/gandi/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/gcp/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/grafana/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/humio/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/istio/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/k6/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/kubernetes/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/opentracing/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/overview/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/pixie/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/prometheus/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/reliably/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/service-fabric/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/slack/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/spring/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/terraform/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/toxiproxy/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/drivers/wiremock/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/concepts/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/contributing/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorial/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/walkthrough/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/api/experiment/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/api/journal/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/developing/core/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/developing/extensions/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/developing/guidelines/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/developing/technologies/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/developing/values/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/extending/approaches/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/extending/create-control-extension/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/extending/extending-with-python/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/authoring_operating/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/batch/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/blockchain/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/containerising/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/ec2/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/extend/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/run-flow/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/tutorials/tolerance/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/cli/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/discover/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/init/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/install/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/notification/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/report/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/run/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/scheduling/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/reference/usage/upgrade/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/resources/logos/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/resources/slides/ - 2023-08-22 + 2023-08-28 daily https://chaostoolkit.org/shared/code/ - 2023-08-22 + 2023-08-28 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 703a0f3f..b1d178ac 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ