All Projects → chaostoolkit-incubator → chaostoolkit-azure

chaostoolkit-incubator / chaostoolkit-azure

Licence: Apache-2.0 License
Chaos Toolkit Extension for Azure

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to chaostoolkit-azure

chaostoolkit-spring
Spring Chaos Monkey driver for the Chaos Toolkit
Stars: ✭ 12 (-42.86%)
Mutual labels:  chaos-engineering, chaostoolkit, chaostoolkit-extension
experiment-catalog
A public and open source chaos engineering experiment catalog.
Stars: ✭ 54 (+157.14%)
Mutual labels:  chaos-engineering, chaostoolkit
chaostoolkit-prometheus
Prometheus Extension for the Chaos Toolkit
Stars: ✭ 13 (-38.1%)
Mutual labels:  chaos-engineering, chaostoolkit-extension
cli
Reliably CLI - Optimise your operations
Stars: ✭ 2 (-90.48%)
Mutual labels:  chaos-engineering, chaostoolkit
monarch
App-level Chaos Engineering
Stars: ✭ 26 (+23.81%)
Mutual labels:  chaos-engineering, chaostoolkit-extension
chaoshub-archive
[ARCHIVED] ChaosHub - Your Chaos Engineering Control Plane
Stars: ✭ 16 (-23.81%)
Mutual labels:  chaos-engineering, chaostoolkit
awesome-chaos-engineering
Awesome chaos engineering page
Stars: ✭ 18 (-14.29%)
Mutual labels:  chaos-engineering
litmus-on-okteto
Use Litmus and Okteto Cloud to show you how to start Chaos testing your Kubernetes applications.
Stars: ✭ 32 (+52.38%)
Mutual labels:  chaos-engineering
sample-spring-chaosmonkey
sample applications illustrating usage of codecentric's chaos monkey library for microservices created using spring boot and spring cloud
Stars: ✭ 19 (-9.52%)
Mutual labels:  chaos-engineering
aws-lambda-chaos-injection
Chaos Injection library for AWS Lambda
Stars: ✭ 82 (+290.48%)
Mutual labels:  chaos-engineering
chaos-operator
chaos engineering via kubernetes operator
Stars: ✭ 90 (+328.57%)
Mutual labels:  chaos-engineering
platform-chaos
A node sdk for building services capable of injecting chaos into PaaS offerings. ⚙️ 🌩
Stars: ✭ 18 (-14.29%)
Mutual labels:  chaos-engineering
xk6-chaos
xk6 extension for running chaos experiments with k6 💣
Stars: ✭ 18 (-14.29%)
Mutual labels:  chaos-engineering
Performance-Engineers-DevOps
This repository helps performance testers and engineers who wants to dive into DevOps and SRE world.
Stars: ✭ 35 (+66.67%)
Mutual labels:  chaos-engineering
bounded-disturbances
A k6/.NET red/green load testing workshop
Stars: ✭ 39 (+85.71%)
Mutual labels:  chaos-engineering
availability-calculator
Calculate how much downtime should be permitted in your Service Level Agreement or Objective
Stars: ✭ 60 (+185.71%)
Mutual labels:  chaos-engineering
common-disaster-recovery-scenarios
A list of common Disaster Recovery (DR) scenarios for software companies
Stars: ✭ 29 (+38.1%)
Mutual labels:  chaos-engineering
chaos-exporter
Prometheus Exporter for Litmus Chaos Metrics
Stars: ✭ 25 (+19.05%)
Mutual labels:  chaos-engineering
aws-chaos-scripts
DEPRECATED Collection of python scripts to run failure injection on AWS infrastructure
Stars: ✭ 91 (+333.33%)
Mutual labels:  chaos-engineering
kaos
Kinda Chaos Monkey for Kubernetes
Stars: ✭ 18 (-14.29%)
Mutual labels:  chaos-engineering

Chaos Toolkit Extension for Azure

Build Status 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",
  "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

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:

  • Experiment file
  • Azure credential file

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.

Credentials

  • Secrets in the Experiment file

    {
      "secrets": {
        "azure": {
          "client_id": "your-super-secret-client-id",
          "client_secret": "your-even-more-super-secret-client-secret",
          "tenant_id": "your-tenant-id"
        }
      }
    }

    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.

    {
      "client_id": "your-super-secret-client-id",
      "client_secret": "your-even-more-super-secret-client-secret",
      "tenant_id": "your-tenant-id",
      "azure_cloud": "AZURE_CHINA_CLOUD"
    }

    Available cloud names:

    • AZURE_CHINA_CLOUD
    • AZURE_GERMAN_CLOUD
    • AZURE_PUBLIC_CLOUD
    • AZURE_US_GOV_CLOUD
  • Secrets in 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
    az ad sp create-for-rbac --sdk-auth > credentials.json

    credentials.json:

    {
      "subscriptionId": "<azure_aubscription_id>",
      "tenantId": "<tenant_id>",
      "clientId": "<application_id>",
      "clientSecret": "<application_secret>",
      "activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
      "resourceManagerEndpointUrl": "https://management.azure.com/",
      "activeDirectoryGraphResourceId": "https://graph.windows.net/",
      "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
      "galleryEndpointUrl": "https://gallery.azure.com/",
      "managementEndpointUrl": "https://management.core.windows.net/"
    }

    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.

Subscription

Additionally you need to provide the Azure subscription id.

  • Subscription id in the experiment file

    {
      "configuration": {
        "azure_subscription_id": "your-azure-subscription-id"
      }
    }

    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's not the Chaos Toolkit way to pass structured configurations.

    {
      "configuration": {
        "azure": {
          "subscription_id": "your-azure-subscription-id"
        }
      }
    }
  • Subscription id in the Azure credential file

    Credential file described in the previous "Credential" 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.

Putting it all together

Here is a full example for an experiment containing secrets and configuration:

{
  "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_subscription_id"]
      }
    }
  ],
  "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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].