This is extended version of Chaos Toolkit Kubernetes Support
Created to provide more flexibility with experiments
This project contains activities, such as probes and actions, you can call from your experiment through 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-k8s-wix
Usage
To use the probes and actions from this package, add the following to your experiment file:
{
"name": "all-our-microservices-should-be-healthy",
"provider": {
"type": "python",
"module": chaosk8s_wix,
"func": "microservice_available_and_healthy",
"arguments": {
"name": "myapp",
"ns": "myns"
}
}
},
{
"type": "action",
"name": "terminate-db-pod",
"provider": {
"type": "python",
"module": chaosk8s_wix,
"func": "terminate_pods",
"arguments": {
"label_selector": "app=my-app",
"name_pattern": "my-app-[0-9]$",
"rand": true,
"ns": "default"
}
},
"pauses": {
"after": 5
}
}
That's it! Notice how the action gives you the way to kill one pod randomly.
Please explore the code to see existing probes and actions.
Discovery
You may use the Chaos Toolkit to discover the capabilities of this extension:
$ chaos discover chaostoolkit-k8s-wix --no-install
Configuration
This extension to the Chaos Toolkit can use the Kubernetes configuration
found at the usual place in your HOME directory under ~/.kube/, or, when
run from a Pod in a Kubernetes cluster, it will use the local service account.
In that case, make sure to set the CHAOSTOOLKIT_IN_POD environment variable
to "true".
You can also pass the credentials via secrets as follows:
{
"secrets": {
"kubernetes": {
"KUBERNETES_HOST": "http://somehost",
"KUBERNETES_API_KEY": {
"type": "env",
"key": "SOME_ENV_VAR"
}
}
}
}
Then in your probe or action:
{
"name": "all-our-microservices-should-be-healthy",
"provider": {
"type": "python",
"module": chaosk8s_wix,
"func": "microservice_available_and_healthy",
"secrets": ["kubernetes"],
"arguments": {
"name": "myapp",
"ns": "myns"
}
}
}
You may specify the Kubernetes context you want to use as follows:
{
"secrets": {
"kubernetes": {
"KUBERNETES_CONTEXT": "minikube"
}
}
}
Or via the environment:
$ export KUBERNETES_CONTEXT=minikube
In the same spirit, you can specify where to find your Kubernetes configuration with:
$ export KUBECONFIG=some/path/config
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, 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.
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
Metadata
Release files for chaostoolkit-k8s-wix 1.4.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chaostoolkit-k8s-wix-1.4.8.tar.gz | 31.2 kB | Without provenance | Details for chaostoolkit-k8s-wix-1.4.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chaostoolkit_k8s_wix-1.4.8-py3-none-any.whl | Python 3 | none | any | Details for chaostoolkit_k8s_wix-1.4.8-py3-none-any.whl |
Total release size: 66.1 kB
Release files / chaostoolkit-k8s-wix-1.4.8.tar.gz
| Download URL | chaostoolkit-k8s-wix-1.4.8.tar.gz |
|---|---|
| Size | 31.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ae0720976be55277ebd3f86df6d804da66120a9e1eef87ad337914a9b749e82
|
|
BLAKE2b-256 checksum How to use checksums |
ef2317d7336ace1bfd542f3e44eb6035350a41f4e9c76b465849623eb8c34521
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.1
|
Release files / chaostoolkit_k8s_wix-1.4.8-py3-none-any.whl
| Download URL | chaostoolkit_k8s_wix-1.4.8-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25d809228091fb2bcd296f6eb5370f291e9932f937aa7de12e40dc5d7ebba70f
|
|
BLAKE2b-256 checksum How to use checksums |
1dd082dbc85999acfb2e7211f0fa09e81fd8d946d9e8d2b7adec95f71992c7d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.1
|
Security for chaostoolkit-k8s-wix 1.4.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.