Package: chaostoolkit-k8s-wix
This is extended version of Chaos Toolkit Kubernetes SupportCreated to provide more flexibility with experimentsThis project contains activities, such as probes and actions, you can call from
your experiment through theChaos Toolkit.InstallTo be used from your experiment, this package must be installed in the Python
environment wherechaostoolkitalready lives.$ pip install chaostoolkit-k8s-wixUsageTo 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.DiscoveryYou may use the Chaos Toolkit to discover the capabilities of this extension:$ chaos discover chaostoolkit-k8s-wix --no-installConfigurationThis 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 theCHAOSTOOLKIT_IN_PODenvironment 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=minikubeIn the same spirit, you can specify where to find your Kubernetes configuration
with:$ export KUBECONFIG=some/path/configContributeIf 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
usualPEP 8code style, add appropriate tests and submit a PR for
review.The Chaos Toolkit projects require all contributors must sign aDeveloper Certificate of Originon 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.DevelopIf you wish to develop on this project, make sure to install the development
dependencies. But first,create a virtual environmentand then install
those dependencies.$pipinstall-rrequirements-dev.txt-rrequirements.txtThen, point your environment to this directory:$pythonsetup.pydevelopNow, you can edit the files and they will be automatically be seen by your
environment, even when running from thechaoscommand locally.TestTo run the tests for the project execute the following:$ pytest