Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chaostoolkit-incubator/chaostoolkit-gremlin
Gremlin attack support for the Chaos Toolkit
https://github.com/chaostoolkit-incubator/chaostoolkit-gremlin
chaos-engineering chaostoolkit-extension chaostoolkit-gremlin gremlin
Last synced: 2 months ago
JSON representation
Gremlin attack support for the Chaos Toolkit
- Host: GitHub
- URL: https://github.com/chaostoolkit-incubator/chaostoolkit-gremlin
- Owner: chaostoolkit-incubator
- License: apache-2.0
- Created: 2017-10-10T13:05:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T12:54:50.000Z (almost 3 years ago)
- Last Synced: 2023-02-27T17:51:57.319Z (almost 2 years ago)
- Topics: chaos-engineering, chaostoolkit-extension, chaostoolkit-gremlin, gremlin
- Language: Python
- Homepage: http://chaostoolkit.org/
- Size: 21.5 KB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# chaostoolkit-gremlin
[![Build Status](https://travis-ci.org/chaostoolkit/chaostoolkit-gremlin.svg?branch=master)](https://travis-ci.org/chaostoolkit/chaostoolkit-gremlin)
[Gremlin, Inc][gremlin] support for the [Chaos Toolkit][chaostoolkit].
[gremlin]: https://www.gremlin.com/
[chaostoolkit]: http://chaostoolkit.org/## Install
To be used from your experiment, this package must be installed in the Python
environment where [chaostoolkit][] already lives.[chaostoolkit]: https://github.com/chaostoolkit/chaostoolkit
```
$ pip install chaostoolkit-gremlin
```## Usage
To use this package, you must create an account with [Gremlin, Inc][gremlin].
Once registered, create a new organisation (formerly known as team). You may
have to ask your Gremlin administrator to do this for you.Once this is done, you must set the following environmental variables
so the Chaos Toolkit can pick up them:* `GREMLIN_EMAIL`: the email used to register to Gremlin and associated to that
organisation
* `GREMLIN_PWD`: your password
* `GREMLIN_ORG_NAME`: the organisation's name you createdNote that 2FA is not yet implemented in this package.
Next you need to specify to load those
variables and inject them into this package's activities. At the top of the
experiment file, add the following object:```json
{
"secrets": {
"gremlin": {
"email": {
"type": "env",
"key": "GREMLIN_EMAIL"
},
"password": {
"type": "env",
"key": "GREMLIN_PWD"
},
"org_name": {
"type": "env",
"key": "GREMLIN_ORG_NAME"
}
}
}
}
```Finally, in all activities where you call a function from this package, make
sure to add the following property:```json
"secrets": ["gremlin"]
```Here is a full example of running a CPU attack experiment:
```json
{
"title": "Can our system handle a node being CPU-busy?",
"description": "CPU-usage may be impactful on our response time",
"secrets": {
"gremlin": {
"email": {
"type": "env",
"key": "GREMLIN_EMAIL"
},
"password": {
"type": "env",
"key": "GREMLIN_PWD"
},
"org_name": {
"type": "env",
"key": "GREMLIN_ORG_NAME"
}
}
},
"method": [
{
"name": "attack-on-cpu",
"type": "action",
"background": true,
"provider": {
"type": "python",
"module": "chaosgremlin.actions",
"func": "attack",
"secrets": ["gremlin"],
"arguments": {
"command": {
"type": "cpu"
},
"target": {
"type": "Random"
}
}
}
}
]
}
```### API Key Authentication
In order to use an API Key as your method of authentication, you'll have to set it as an environment variable: `$GREMLIN_API_KEY`.
You can construct your experiments the same as before, but with the `secrets` section omitted. When `secrets` is not present, chaostoolkit-gremlin will grab your pre-registered Gremlin API Key and bundle it with your experiment at runtime.
Here's an example of the above CPU attack, with API Key authentication:
```json
{
"title": "Can our system handle a node being CPU-busy?",
"description": "CPU-usage may be impactful on our response time",
"method": [
{
"name": "attack-on-cpu",
"type": "action",
"background": true,
"provider": {
"type": "python",
"module": "chaosgremlin.actions",
"func": "attack",
"arguments": {
"command": {
"type": "cpu"
},
"target": {
"type": "Random"
}
}
}
}
]
}
```
**Note:** When using API Key authentication, your Team ID must also be set as an environment variable: `$GREMLIN_TEAM_ID`. When using email/password authentication and you do not set a specific Team ID, the first Team ID associated with your authenticated `session` will be used.## 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][pep8] code style, sprinkling with tests and submit a PR for
review.[pep8]: https://pycodestyle.readthedocs.io/en/latest/