Package: chaostoolkit-google-cloud
Chaos Toolkit Extension for Google Cloud EngineTHIS PACKAGE IS NOW DEPRECATED.Please use thegoogle-cloud-platformextension instead.This project is a collection ofactionsandprobes, gathered as an
extension to theChaos Toolkit. It targets theGoogle Cloud Engineplatform.InstallThis package requires Python 3.5+To be used from your experiment, this package must be installed in the Python
environment wherechaostoolkitalready lives.$ pip install -U chaostoolkit-google-cloudUsageTo use the probes and actions from this package, add the following to your
experiment file:{"type":"action","name":"swap-nodepool-for-a-new-one","provider":{"type":"python","module":"chaosgce.nodepool.actions","func":"swap_nodepool","secrets":["gce"],"arguments":{"body":{"nodePool":{"config":{"oauthScopes":["gke-version-default","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/trace.append"]},"initialNodeCount":3,"name":"new-default-pool"}}}}}That's it!Please explore the code to see existing probes and actions.ConfigurationProject and Cluster InformationYou can pass the context via theconfigurationsection of your experiment:{"configuration":{"gce_project_id":"...","gce_cluster_name":"...","gce_region":"...","gce_zone":"..."}}Note that most functions exposed in this package also take those values
directly when you want specific values for them.CredentialsThis extension expects aservice accountwith enough permissions to
perform its operations. Please create such a service account manually (do not
use the default one for your cluster if you can, so you'll be able to delete
that service account if need be).Once you have created your service account, either keep the file on the same
machine where you will be running the experiment from. Or, pass its content
as part of thesecretssection, although this is not recommended because your
sensitive data will be quite visible.Here is the first way:{"secrets":{"gce":{"service_account_file":"/path/to/sa.json"}}}While the embedded way looks like this:{"secrets":{"gce":{"service_account_info":{"type":"service_account","project_id":"...","private_key_id":"...","private_key":"...","client_email":"...","client_id":"...","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/...."}}}}Putting it all togetherHere is a full example:{"version":"1.0.0","title":"...","description":"...","configuration":{"gce_project_id":"...","gce_cluster_name":"...","gce_region":"...","gce_zone":"..."},"secrets":{"gce":{"service_account_file":"/path/to/sa.json"}},"method":[{"type":"action","name":"swap-nodepool-for-a-new-one","provider":{"type":"python","module":"chaosgce.nodepool.actions","func":"swap_nodepool","secrets":["gce"],"arguments":{"body":{"nodePool":{"config":{"oauthScopes":["gke-version-default","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/trace.append"]},"initialNodeCount":3,"name":"new-default-pool"}}}}}]}ContributeIf 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, sprinkling with 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