管理 Fault Injection Testing 访问权限

本页面介绍如何使用 Identity and Access Management (IAM) 管理 对 Fault Injection Testing 功能的访问。

资源的管理员或所有者可以授予 Google Cloud Fault Injection Testing 角色和权限

管理员负责确保用户拥有所需的访问权限,而不会拥有其他权限(最小权限原则)。由于 Fault Injection Testing 需要账号来配置和运行实验,因此最小权限原则尤为重要 - 如果在不正确的资源上运行故障实验,或者由未经授权或未经培训的用户操作,可能会导致意外中断。

为 Fault Injection Testing 启用 API

如需为您的项目启用 Fault Injection Testing API,请执行以下操作:

  1. 前往 Google Cloud 控制台的 API 库页面。
  2. 搜索 faulttesting ,然后选择 Fault Testing API
  3. 选择启用 按钮。

系统随即会显示一个对话框,其中显示了 API 启用进度。

设置所需权限

Fault Injection Testing 提供以下角色:

角色名称

说明

权限

roles/faulttesting.operator

Fault Testing Admin/Operator

拥有对故障测试资源的完整访问权限。操作员还必须拥有对受影响的 Google Cloud 资源的编辑者权限。

faulttesting.googleapis.com/operations.delete

faulttesting.googleapis.com/operations.cancel

faulttesting.googleapis.com/experiments.create

faulttesting.googleapis.com/experiments.update

faulttesting.googleapis.com/experiments.delete

faulttesting.googleapis.com/validations.create

faulttesting.googleapis.com/validations.delete

faulttesting.googleapis.com/validationResources.create

faulttesting.googleapis.com/validationResources.update

faulttesting.googleapis.com/validationResources.delete

faulttesting.googleapis.com/affectedResources.create

faulttesting.googleapis.com/affectedResources.update

faulttesting.googleapis.com/affectedResources.delete

faulttesting.googleapis.com/experimentTemplates.create

faulttesting.googleapis.com/experimentTemplates.update

faulttesting.googleapis.com/experimentTemplates.delete

cloudresourcemanager.googleapis.com/projects.get

cloudresourcemanager.googleapis.com/projects.list

faulttesting.googleapis.com/operations.list

faulttesting.googleapis.com/operations.get

faulttesting.googleapis.com/locations.list

faulttesting.googleapis.com/locations.get

faulttesting.googleapis.com/experiments.list

faulttesting.googleapis.com/experiments.get

faulttesting.googleapis.com/validations.list

faulttesting.googleapis.com/validations.get

faulttesting.googleapis.com/validationResources.list

faulttesting.googleapis.com/validationResources.get

faulttesting.googleapis.com/affectedResources.list

faulttesting.googleapis.com/affectedResources.get

faulttesting.googleapis.com/experimentTemplates.list

faulttesting.googleapis.com/experimentTemplates.get

roles/faulttesting.viewer

Fault Testing Viewer

拥有对故障测试资源的只读权限。

cloudresourcemanager.googleapis.com/projects.get

cloudresourcemanager.googleapis.com/projects.list

faulttesting.googleapis.com/operations.list

faulttesting.googleapis.com/operations.get

faulttesting.googleapis.com/locations.list

faulttesting.googleapis.com/locations.get

faulttesting.googleapis.com/experiments.list

faulttesting.googleapis.com/experiments.get

faulttesting.googleapis.com/validations.list

faulttesting.googleapis.com/validations.get

faulttesting.googleapis.com/validationResources.list

faulttesting.googleapis.com/validationResources.get

faulttesting.googleapis.com/affectedResources.list

faulttesting.googleapis.com/affectedResources.get

faulttesting.googleapis.com/experimentTemplates.list

faulttesting.googleapis.com/experimentTemplates.get

使用 Google Cloud CLI 授予角色和权限。如需授予 faulttesting.operator role,请运行以下命令:

gcloud projects add-iam-policy-binding ${PROJECT_ID} \
  --member {USER|GROUP|SERVICE_ACCOUNT} \
  --role roles/faulttesting.operator

以下示例展示了如何将 faulttesting.operator 添加到用户 anon@example.com in projectexample-project` 的语法:

gcloud projects add-iam-policy-binding example-project --member=user:anon@example.com --role=roles/faulttesting.operator