google云引擎的混沌工具包扩展
chaostoolkit-google-cloud的Python项目详细描述
#google云引擎的chaos工具包扩展
[![构建状态](https://travis-ci.org/chaostolkit-incubator/chaostolkit-google-cloud.svg?branch=master)(https://travis ci.org/chaostoolkit孵化器/chaostoolkit谷歌云)
[![python版本](https://img.shields.io/pypi/pyversions/chaostolkit google cloud.svg)](https://www.python.org/)
此项目是[actions][]和[probe][]的集合,作为[chaos工具包][chaostolkit]的扩展集合。它的目标是
[google cloud engine][gce]平台。
[actions]:http://chaostoolkit.org/reference/api/experiment/action
[probes]:http://chaostoolkit.org/reference/api/experiment/probe
[chaostoolkit]:http://chaostoolkit.org
[gce]:https://cloud.google.com/compute/
\install
此软件包要求在实验中使用python 3.5+
,此包必须安装在python
环境中,其中[chaostolkit][]已经存在。
`````
$pip install-u chaostolkit google cloud
````
在
实验文件中添加以下内容:
``json
{
"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":"新默认池"
}
}
}
}
}
}
````
就这样!
请浏览代码以查看现有的探测和操作。
"gce_project_id":"…",
"gce_cluster_name":"…",
"gce_region":"…",
"gce_zone":"…"
}
}
````
请注意,此包中公开的大多数函数在需要这些值的特定值时也会直接获取这些值。
执行其操作。请手动创建这样的服务帐户(如果可以,请不要使用群集的默认帐户,因此,如果需要的话,您可以删除该服务帐户。
[sa]:https://developers.google.com/api client library/python/auth/service accounts\creatinganaccount
要么将文件保存在运行实验的机器上。或者,将其内容作为"secrets"部分的一部分传递,虽然不建议这样做,因为您的敏感数据将非常可见。
嵌入式方式如下:
`` json
{
"机密":{
"GCE":{
"服务帐户信息":{
"类型":"服务帐户",
"项目ID":"…",
"私人密钥ID":"…",
"私人密钥":"…",
"客户电子邮件":"…",
"客户端ID":"…",
"身份验证uri":"https://accounts.google.com/o/oauth2/auth",
"令牌身份验证uri":"https://accounts.google.com/o/oauth2/token",
"身份验证提供者x509证书URL":"https://www.googleapis.com/oauth2/v1/certs",
"client戋x509戋u cert戋url":"https://www.googleapis.com/robot/v1/metadata/x509/…"
}
}
}
}
}
`````
``json
{
"version":"1.0.0",
"title":"…",
"description":"…",
"configuration":{
"gce_project_id":"…",
"gce_cluster_name":"…",
"gce_region":"…",
"gce_zone":"…"
,
"secrets":{
"gce":{
"服务帐户文件":"/path/to/sa.json"
}
},
"方法":[
{
"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"
}
}
}
}
}
}
]
}
````
这样做。请,从这个项目开始,按照通常的代码风格进行更改,洒上测试并提交一个pr供审查。
[pep8]:https://pycodestyle.readthedocs.io/en/latest/
在每次提交时,他们希望将
合并到存储库的主分支中。请确保您在提交PR之前可以遵守DCO的规则。
[DCO]:https://github.com/probot/dco它的工作原理
\development
但首先,[创建一个虚拟环境][venv]然后安装
这些依赖项。
[venv]:http://chaostolkit.org/reference/usage/install/create-a-virtual-environment
`` console
$pip install-r requirements-dev.txt-r requirements.txt
```
,将您的环境指向此目录:
`` console
$python setup.py develop
````
我们的
环境,即使在本地从"chaos"命令运行时也是如此。
[![构建状态](https://travis-ci.org/chaostolkit-incubator/chaostolkit-google-cloud.svg?branch=master)(https://travis ci.org/chaostoolkit孵化器/chaostoolkit谷歌云)
[![python版本](https://img.shields.io/pypi/pyversions/chaostolkit google cloud.svg)](https://www.python.org/)
此项目是[actions][]和[probe][]的集合,作为[chaos工具包][chaostolkit]的扩展集合。它的目标是
[google cloud engine][gce]平台。
[actions]:http://chaostoolkit.org/reference/api/experiment/action
[probes]:http://chaostoolkit.org/reference/api/experiment/probe
[chaostoolkit]:http://chaostoolkit.org
[gce]:https://cloud.google.com/compute/
\install
此软件包要求在实验中使用python 3.5+
,此包必须安装在python
环境中,其中[chaostolkit][]已经存在。
`````
$pip install-u chaostolkit google cloud
````
在
实验文件中添加以下内容:
``json
{
"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":"新默认池"
}
}
}
}
}
}
````
就这样!
请浏览代码以查看现有的探测和操作。
"gce_project_id":"…",
"gce_cluster_name":"…",
"gce_region":"…",
"gce_zone":"…"
}
}
````
请注意,此包中公开的大多数函数在需要这些值的特定值时也会直接获取这些值。
执行其操作。请手动创建这样的服务帐户(如果可以,请不要使用群集的默认帐户,因此,如果需要的话,您可以删除该服务帐户。
[sa]:https://developers.google.com/api client library/python/auth/service accounts\creatinganaccount
要么将文件保存在运行实验的机器上。或者,将其内容作为"secrets"部分的一部分传递,虽然不建议这样做,因为您的敏感数据将非常可见。
嵌入式方式如下:
`` json
{
"机密":{
"GCE":{
"服务帐户信息":{
"类型":"服务帐户",
"项目ID":"…",
"私人密钥ID":"…",
"私人密钥":"…",
"客户电子邮件":"…",
"客户端ID":"…",
"身份验证uri":"https://accounts.google.com/o/oauth2/auth",
"令牌身份验证uri":"https://accounts.google.com/o/oauth2/token",
"身份验证提供者x509证书URL":"https://www.googleapis.com/oauth2/v1/certs",
"client戋x509戋u cert戋url":"https://www.googleapis.com/robot/v1/metadata/x509/…"
}
}
}
}
}
`````
``json
{
"version":"1.0.0",
"title":"…",
"description":"…",
"configuration":{
"gce_project_id":"…",
"gce_cluster_name":"…",
"gce_region":"…",
"gce_zone":"…"
,
"secrets":{
"gce":{
"服务帐户文件":"/path/to/sa.json"
}
},
"方法":[
{
"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"
}
}
}
}
}
}
]
}
````
这样做。请,从这个项目开始,按照通常的代码风格进行更改,洒上测试并提交一个pr供审查。
[pep8]:https://pycodestyle.readthedocs.io/en/latest/
在每次提交时,他们希望将
合并到存储库的主分支中。请确保您在提交PR之前可以遵守DCO的规则。
[DCO]:https://github.com/probot/dco它的工作原理
\development
但首先,[创建一个虚拟环境][venv]然后安装
这些依赖项。
[venv]:http://chaostolkit.org/reference/usage/install/create-a-virtual-environment
`` console
$pip install-r requirements-dev.txt-r requirements.txt
```
,将您的环境指向此目录:
`` console
$python setup.py develop
````
我们的
环境,即使在本地从"chaos"命令运行时也是如此。