Chaos Toolkit Extension for Microsoft Azure
Project description
Chaos Toolkit Extension for Azure
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",
"provider": {
"type": "python",
"module": "chaosazure.vm.actions",
"func": "stop_machines",
"secrets": ["azure"],
"arguments": {
"parameters": {
"TimeToRunInSeconds": 45
}
}
}
}
That's it!
Please explore the code to see existing probes and actions.
Configuration
Credentials
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.
There are two ways of doing this:
-
you can either pass the name of the environment variables to the experiment definition as follows (recommended):
{ "azure": { "client_id": "AZURE_CLIENT_ID", "client_secret": "AZURE_CLIENT_SECRET", "tenant_id": "AZURE_TENANT_ID" } }
-
or you inject the secrets explicitly to the experiment definition:
{ "azure": { "client_id": "your-super-secret-client-id", "client_secret": "your-even-more-super-secret-client-secret", "tenant_id": "your-tenant-id" } }
Additionally you need to provide the Azure subscription id.
{ "azure": { "subscription_id": "your-azure-subscription-id" } }
Putting it all together
Here is a full example:
{
"version": "1.0.0",
"title": "...",
"description": "...",
"tags": [
"azure",
"kubernetes",
"aks",
"node"
],
"configuration": {
"azure": {
"subscription_id": "xxx"
}
},
"secrets": {
"azure": {
"client_id": "xxx",
"client_secret": "xxx",
"tenant_id": "xxx"
}
},
"steady-state-hypothesis": {
"title": "Services are all available and healthy",
"probes": [
{
"type": "probe",
"name": "consumer-service-must-still-respond",
"tolerance": 200,
"provider": {
"type": "http",
"url": "https://some-url/"
}
}
]
},
"method": [
{
"type": "action",
"name": "restart-node-at-random",
"provider": {
"type": "python",
"module": "chaosazure.machine.actions",
"func": "restart_machines",
"secrets": [
"azure"
],
"config": [
"azure"
]
}
}
],
"rollbacks": [
]
}
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 | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for chaostoolkit_azure-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50203e5eb8086d1a2c029d1c099f5168e0330ad2cfbfbaf9be431b0c100194c6 |
|
MD5 | 9291597a7392f64514a50174271bbbe4 |
|
BLAKE2b-256 | b1d4189c34680942a0e602e9c532a17b0ff962db87af35a4cfd4d1967672aa78 |