ChaosMonkey is losely based on Netflix's project with same name. Its purpose is to bring chaos in kubernetes eco-system by randomly terminating one of the pods. This ensures that application developers are writing code that is resilient enough to recover from such random mishaps.
In order to deploy chaosmonkey, you'll need helm CLI installed. To install helm, run:
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
You'll also need access to a kubernetes cluster. If you don't have one, you can create it locally using kind and docker.
# install kind binary
go install sigs.k8s.io/kind@v0.14.0
# create kind cluster of 2 nodes using the config file
kind create cluster --config hack/kindConfig.yaml
or
Use setup script that creates a local registry accessible at localhost:5001 and a kind cluster that can pull images from this local registry
./hack/setupKindCluster.sh
To remove this local registry and kind cluster, run:
./hack/cleanupKindCluster.sh
If you have make
utility installed then run:
make install
or
In case you don't have make
utility, use shell script install.sh
./install.sh
To provide custom image and tag name, you can provider IMAGE_NAME and IMAGE_TAG variables. e.g. if you have pushed image to you local registry:
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" install
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./install.sh
Default image tag is the latest git commit id and the default image name is rpsingh/chaosmonkey
.
The installation happens via helm CLI and this values.yaml
file.
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" uninstall
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./uninstall.sh
In order to contribute to this repo, you need to setup local dev environment.
To develop and test locally, you must install
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" build
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./build.sh
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" release
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./release.sh
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" install
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./install.sh
# You can provide your own image name and tag
make IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" uninstall
or
# You can provide your own image name and tag
IMAGE_NAME="localhost:5001/chaosmonkey" IMAGE_TAG="v0.0.1" ./uninstall.sh
go build -o chaosmonkey cmd/chaosmonkey/main.go
For flag details
go run cmd/chaosmonkey/main.go --help
go test -v -cover ./...
or
go test -v -cover chaosmonkey.monke/chaos/...
- Make Kubernetes client package testable
- Add more unit tests
- Refactor function in main package