更新时间:2024-08-23 GMT+08:00

云容器引擎 CCE

Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)可以使用以下授权项元素设置访问控制策略。

SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。

本章节介绍组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。

如何使用这些元素编辑SCP自定义策略,请参考创建SCP

操作(Action)

操作(Action)即为SCP中支持的授权项。

  • “访问级别”列描述如何对操作进行分类(list、read和write等)。此分类可帮助您了解在SCP中相应操作对应的访问级别。
  • “资源类型”列指每个操作是否支持资源级权限。
    • 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在SCP语句的Resource元素中指定所有资源类型(“*”)。
    • 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
    • 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。

    关于CCE定义的资源类型的详细信息请参见资源类型(Resource)

  • “条件键”列包括了可以在SCP语句的Condition元素中支持指定的键值。
    • 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
    • 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
    • 如果此列条件键没有值(-),表示此操作不支持指定条件键。

    关于CCE定义的条件键的详细信息请参见条件(Condition)

您可以在SCP语句的Action元素中指定以下CCE的相关操作。

表1 CCE支持的授权项

授权项

描述

访问级别

资源类型(*为必须)

条件键

cce:cluster:createCluster

授予创建集群的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:TagKeys
  • g:RequestTag/<tag-key>

cce:cluster:delete

授予删除集群的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:updateCluster

授予更新集群的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:upgrade

授予执行集群版本升级的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:start

授予唤醒休眠集群的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:stop

授予对集群执行休眠操作的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:list

授予查看集群详情列表的权限。

list

cluster *

-

cce:cluster:getCluster

授予查看用户指定集群详情的权限。

read

cluster *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

cce:cluster:getEndpoints

授予查看用户指定集群访问地址的权限。

read

cluster *

  • g:ResourceTag/<tag-key>
  • g:EnterpriseProjectId

cce:cluster:resize

授予对集群进行规格变更的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:eipBinding

授予对集群绑定/解绑公网IP的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:generateClientCredential

授予生成集群客户端访问凭据的权限。

read

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:addTags

授予添加集群标签的权限。

tagging

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

-

  • g:TagKeys
  • g:RequestTag/<tag-key>

cce:cluster:removeTags

授予删除集群标签的权限。

tagging

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

-

  • g:TagKeys
  • g:RequestTag/<tag-key>

cce:cluster:getConfigurationTemplate

授予查询集群配置模板信息的权限。

read

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:cluster:getLogConfig

授予查询集群当前日志采集配置的权限。

read

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:cluster:updateLogConfig

授予更新集群日志采集配置的权限。

write

cluster *

  • g:EnterpriseProjectId
  • g:ResourceTag/<tag-key>

cce:partition:create

授予接入分区的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:partition:update

授予更新分区的权限。

write

cluster *

g:EnterpriseProjectId

cce:partition:get

授予查询指定分区详情的权限。

read

cluster *

g:EnterpriseProjectId

cce:partition:list

授予查看指定集群的分区列表。

list

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:nodepool:create

授予创建节点池的权限。

write

cluster *

  • cce:ClusterId
  • evs:Encrypted
  • g:EnterpriseProjectId

cce:nodepool:delete

授予删除节点池的权限。

write

cluster *

g:EnterpriseProjectId

cce:nodepool:updateNodepool

授予更新节点池的权限。

write

cluster *

-

-

  • evs:Encrypted
  • g:EnterpriseProjectId

cce:nodepool:getNodepool

授予查询指定节点池详情的权限。

read

cluster *

g:EnterpriseProjectId

cce:nodepool:list

授予查看指定集群的节点池列表。

list

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:nodepool:getConfigurationTemplate

授予查询节点池配置模板的权限。

read

cluster *

g:EnterpriseProjectId

cce:nodepool:getConfiguration

授予查询节点池配置的权限。

read

cluster *

g:EnterpriseProjectId

cce:nodepool:updateConfiguration

授予更新节点池配置的权限。

write

cluster *

g:EnterpriseProjectId

cce:node:createNode

授予创建节点的权限。

write

cluster *

  • cce:ClusterId
  • evs:Encrypted
  • g:EnterpriseProjectId

cce:node:delete

授予删除节点的权限。

write

cluster *

g:EnterpriseProjectId

cce:node:update

授予更新节点的权限。

write

cluster *

g:EnterpriseProjectId

cce:node:getNode

授予查询指定节点详情的权限。

read

cluster *

g:EnterpriseProjectId

cce:node:list

授予查看指定集群的节点列表。

list

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:node:reset

授予重置节点的权限。

write

cluster *

  • cce:ClusterId
  • evs:Encrypted
  • g:EnterpriseProjectId

cce:node:add

授予纳管节点的权限。

write

cluster *

  • cce:ClusterId
  • evs:Encrypted
  • g:EnterpriseProjectId

cce:node:remove

授予释放节点的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:node:migrate

授予在集群间迁移节点的权限。

write

cluster *

  • cce:nodeTransferSourceCluster
  • cce:nodeTransferTargetCluster
  • g:EnterpriseProjectId

cce:node:sync

授予同步节点基础设施资源状态的权限。

read

cluster *

g:EnterpriseProjectId

cce:quota:get

授予查询CCE服务相关资源配额的权限。

read

-

-

cce:addonInstance:create

授予创建插件实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:addonInstance:delete

授予删除插件实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:addonInstance:update

授予更新插件实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:addonInstance:get

授予查询指定插件实例详情的权限。

read

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:addonInstance:list

授予查看指定集群的插件实例列表的权限。

list

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:addonInstance:rollback

授予回滚指定插件实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:chart:upload

授予上传应用模板的权限。

write

-

-

cce:chart:delete

授予删除应用模板的权限。

write

-

-

cce:chart:update

授予更新应用模板的权限。

write

-

-

cce:chart:listChart

授予查看应用模板详情列表的权限。

list

-

-

cce:chart:getChart

授予查看用户指定应用模板详情的权限。

read

-

-

cce:chart:download

授予查看用户下载应用模板的权限。

read

-

-

cce:chart:getQuota

授予查看应用模板配额的权限。

read

-

-

cce:release:create

授予创建应用实例的权限。

write

-

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:release:delete

授予删除应用实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:release:update

授予更新应用实例的权限。

write

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:release:get

授予查询指定应用实例详情的权限。

read

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

cce:release:list

授予查看指定集群的应用实例列表的权限。

list

cluster *

  • cce:ClusterId
  • g:EnterpriseProjectId

CCE的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。

表2 API与授权项的关系

API

对应的授权项

依赖的授权项

GET /api/v3/projects/{project_id}/quotas

cce:quota:get

-

POST /api/v3/projects/{project_id}/clusters

cce:cluster:createCluster

-

DELETE /api/v3/projects/{project_id}/clusters/{cluster_id}

cce:cluster:delete

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}

cce:cluster:updateCluster

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgradeworkflows

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgradeworkflows

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgradeworkflows/{upgrade_workflow_id}

cce:cluster:upgrade

-

PATCH /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgradeworkflows/{upgrade_workflow_id}

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade/retry

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade/tasks/{task_id}

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade/continue

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade/pause

cce:cluster:upgrade

-

GET /api/v3/clusterupgradefeaturegates

cce:cluster:upgrade

-

GET /api/v3/clusterupgradepaths

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/upgradeinfo

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/postcheck

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/precheck

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/precheck/tasks

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/precheck/tasks/{task_id}

cce:cluster:upgrade

-

GET /api/v3.1/projects/{project_id}/clusters/{cluster_id}/operation/snapshot/tasks

cce:cluster:upgrade

-

POST /api/v3.1/projects/{project_id}/clusters/{cluster_id}/operation/snapshot

cce:cluster:upgrade

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/upgrade/tasks

cce:cluster:upgrade

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/awake

cce:cluster:start

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/hibernate

cce:cluster:stop

-

GET /api/v3/projects/{project_id}/clusters

cce:cluster:list

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}

cce:cluster:getCluster

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/openapi

cce:cluster:getEndpoints

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/operation/resize

cce:cluster:resize

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/mastereip

cce:cluster:eipBinding

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/clustercert

cce:cluster:generateClientCredential

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/tags/create

cce:cluster:addTags

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/tags/delete

cce:cluster:removeTags

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/configuration/detail

cce:cluster:getConfigurationTemplate

-

GET /api/v3/projects/{project_id}/cluster/{cluster_id}/log-configs

cce:cluster:getLogConfig

-

PUT /api/v3/projects/{project_id}/cluster/{cluster_id}/log-configs

cce:cluster:updateLogConfig

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/partitions

cce:partition:create

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/partitions/{partition_name}

cce:partition:update

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/partitions/{partition_name}

cce:partition:get

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/partitions

cce:partition:list

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools

cce:nodepool:create

-

DELETE /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}

cce:nodepool:delete

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}

cce:nodepool:updateNodepool

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}

cce:nodepool:getNodepool

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools

cce:nodepool:list

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}/configuration/detail

cce:nodepool:getConfigurationTemplate

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}/configuration

cce:nodepool:getConfiguration

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodepools/{nodepool_id}/configuration

cce:nodepool:updateConfiguration

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes

cce:node:createNode

-

DELETE /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/{node_id}

cce:node:delete

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/{node_id}

cce:node:update

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/{node_id}

cce:node:getNode

-

GET /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes

cce:node:list

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/reset

cce:node:reset

-

POST /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/add

cce:node:add

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/operation/remove

cce:node:remove

-

PUT /api/v3/projects/{project_id}/clusters/{cluster_id}/nodes/operation/migrateto/{target_cluster_id}

cce:node:migrate

-

GET /api/v2/projects/{project_id}/clusters/{cluster_id}/nodes/{node_id}/sync

cce:node:sync

-

POST /api/v3/addons

cce:addonInstance:create

-

DELETE /api/v3/addons/{id}

cce:addonInstance:delete

-

PUT /api/v3/addons/{id}

cce:addonInstance:update

-

GET /api/v3/addons/{id}

cce:addonInstance:get

-

GET /api/v3/addons

cce:addonInstance:list

-

POST /api/v3/addons/{id}/operation/rollback

cce:addonInstance:rollback

-

POST /v2/charts

cce:chart:upload

-

DELETE /v2/charts/{chart_id}

cce:chart:delete

-

PUT /v2/charts/{chart_id}

cce:chart:update

-

GET /v2/charts/{chart_id}

cce:chart:getChart

-

GET /v2/charts

cce:chart:listChart

-

GET /v2/charts/{chart_id}/archive

cce:chart:download

-

GET /v2/charts/{project_id}/quotas

cce:chart:getQuota

-

POST /cce/cam/v3/clusters/{cluster_id}/releases

cce:release:create

-

DELETE /cce/cam/v3/clusters/{cluster_id}/namespace/{namespace}/releases/{name}

cce:release:delete

-

PUT /cce/cam/v3/clusters/{cluster_id}/namespace/{namespace}/releases/{name}

cce:release:update

-

GET /cce/cam/v3/clusters/{cluster_id}/namespace/{namespace}/releases/{name}

cce:release:get

-

GET /cce/cam/v3/clusters/{cluster_id}/releases

cce:release:list

-

资源类型(Resource)

资源类型(Resource)表示SCP所作用的资源。如表3中的某些操作指定了可以在该操作指定的资源类型,则必须在具有该操作的SCP语句中指定该资源的URN,SCP仅作用于此资源;如未指定,Resource默认为“*”,则SCP将应用到所有资源。您也可以在SCP中设置条件,从而指定资源类型。

CCE定义了以下可以在自定义SCP的Resource元素中使用的资源类型。

表3 CCE支持的资源类型

资源类型

URN

cluster

cce:<region>:<account-id>:cluster:<cluster-name>

条件(Condition)

条件(Condition)是SCP生效的特定条件,包括条件键运算符

  • 条件键表示SCP语句的Condition元素中的键值。根据适用范围,分为全局级条件键和服务级条件键。
    • 全局级条件键(前缀为g:)适用于所有操作,在鉴权过程中,云服务不需要提供用户身份信息,系统将自动获取并鉴权。详情请参见:全局条件键
    • 服务级条件键(前缀通常为服务缩写,如cce:)仅适用于对应服务的操作,详情请参见表4
    • 单值/多值表示API调用时请求中与条件关联的值数。单值条件键在API调用时的请求中最多包含一个值,多值条件键在API调用时请求可以包含多个值。例如:g:SourceVpce是单值条件键,表示仅允许通过某个VPC终端节点发起请求访问某资源,一个请求最多包含一个VPC终端节点ID值。g:TagKeys是多值条件键,表示请求中携带的所有标签的key组成的列表,当用户在调用API请求时传入标签可以传入多个值。
  • 运算符与条件键、条件值一起构成完整的条件判断语句,当请求信息满足该条件时,SCP才能生效。支持的运算符请参见:运算符

CCE定义了以下可以在SCP的Condition元素中使用的条件键,您可以使用这些条件键进一步细化SCP语句应用的条件。

表4 CCE支持的服务级条件键

服务级条件键

类型

单值/多值

说明

cce:ClusterId

string

单值

按照在请求中传递的集群ID筛选访问权限。

cce:nodeTransferSourceCluster

string

单值

按照节点迁移的源集群ID筛选访问权限。

cce:nodeTransferTargetCluster

string

单值

按照节点迁移的目的集群ID筛选访问权限。

cce:AssociatePublicIp

string

单值

根据创建ECS是否涉及自动创建EIP操作筛选访问权限。如果要限制集群绑定或解绑EIP操作权限,则需要使用cce:cluster:eipBinding这个action进行管控。

cce:VpcId

string

单值

按照集群创建所选择的VPC筛选访问权限。

cce:SubnetId

string

单值

按照集群/节点/节点池创建所选择的子网筛选访问权限。

cce:Subnets

array

单值

按照节点池创建/更新所选择的多子网筛选访问权限。

cce:KmsKeys

string

单值

按照节点/节点池创建所选择的磁盘加密KMS密钥筛选访问权限。