Skip to main content

Chaos Toolkit Extension for Istio Fault Injection

Project description

Chaos Toolkit Extension for Istio Fault Injection

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-istio

Usage

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

{
    "secrets": {
        "istio": {
            "KUBERNETES_CONTEXT": {
                "type": "env",
                "key": "KUBERNETES_CONTEXT"
            }
        }
    },
    "method": [
        {
            "type": "action",
            "name": "inject-fault-for-jason-only",
            "provider": {
                "type": "python",
                "module": "chaosistio.fault.actions",
                "func": "add_delay_fault",
                "secrets": ["istio"],
                "arguments": {
                    "virtual_service_name": "reviews",
                    "fixed_delay": "5s",
                    "percent": 100,
                    "routes": [
                        {
                            "destination": {
                                "host": "reviews",
                                "subset": "v2"
                            }
                        }
                    ]
                }
            },
            "pauses": {
                "after": 1
            }
        }
    ],
    "rollbacks": [
        {
            "type": "action",
            "name": "remove-fault-for-jason-only",
            "provider": {
                "type": "python",
                "module": "chaosistio.fault.actions",
                "func": "remove_delay_fault",
                "secrets": ["istio"],
                "arguments": {
                    "virtual_service_name": "reviews",
                    "routes": [
                        {
                            "destination": {
                                "host": "reviews",
                                "subset": "v2"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

That's it!

Please explore the code to see existing probes and actions.

Configuration

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.

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.

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.

Develop

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

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

Test

To run the tests for the project execute the following:

$ pytest

Project details


Release history Release notifications

This version
History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
chaostoolkit_istio-0.1.0-py3-none-any.whl (7.4 kB) Copy SHA256 hash SHA256 Wheel py3
chaostoolkit-istio-0.1.0.tar.gz (11.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page