云容器实例 CCI
云服务在IAM预置了常用的权限,称为系统身份策略。如果IAM系统身份策略无法满足授权要求,管理员可以根据各服务支持的授权项,创建IAM自定义身份策略来进行精细的访问控制,IAM自定义身份策略是对系统身份策略的扩展和补充。
除IAM服务外,Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)也可以使用这些授权项元素设置访问控制策略。
SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。IAM身份策略授予权限的有效性受SCP限制,只有在SCP允许范围内的权限才能生效。
IAM服务与Organizations服务在使用这些元素进行访问控制时,存在着一些区别,详情请参见:IAM服务与Organizations服务权限访问控制的区别。
本章节介绍IAM服务身份策略授权场景中自定义身份策略和组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。
操作(Action)
操作(Action)即为SCP中支持的授权项。
- “访问级别”列描述如何对操作进行分类(List、Read和Write等)。此分类可帮助您了解在SCP中相应操作对应的访问级别。
- “资源类型”列指每个操作是否支持资源级权限。
- 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在SCP语句的Resource元素中指定所有资源类型(“*”)。
- 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
- 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。
关于CCI定义的资源类型的详细信息请参见资源类型(Resource)。
- “条件键”列包括了可以在SCP语句的Condition元素中支持指定的键值。
- 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
- 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
- 如果此列条件键没有值(-),表示此操作不支持指定条件键。
关于CCI定义的条件键的详细信息请参见条件(Condition)。
您可以在策略语句的Action元素中指定以下CCI的相关操作。
授权项 | 描述 | 访问级别 | 资源类型(*为必须) | 条件键 |
|---|---|---|---|---|
cci:namespace:list | 授予查询所有命名空间的权限。 | List | namespace * | - |
cci:namespace:create | 授予创建命名空间的权限。 | Write | namespace * | - |
cci:namespace:get | 授予查询命名空间的权限。 | Read | namespace * | |
cci:namespace:delete | 授予删除命名空间的权限。 | Write | namespace * | |
cci:network:list | 授予查询所有网络的权限。 | List | network * | - |
cci:network:create | 授予创建网络的权限。 | Write | network * | - |
cci:network:get | 授予查询网络的权限。 | Read | network * | - |
cci:network:delete | 授予删除网络的权限。 | Write | network * | - |
cci:network:update | 授予更新网络的权限。 | Write | network * | - |
cci:configmap:list | 授予查询所有配置项(ConfigMap)的权限。 | List | configmap * | - |
cci:configmap:create | 授予创建配置项(ConfigMap)的权限。 | Write | configmap * | - |
cci:configmap:get | 授予查询配置项(ConfigMap)的权限。 | Read | configmap * | - |
cci:configmap:delete | 授予删除配置项(ConfigMap)的权限。 | Write | configmap * | - |
cci:configmap:update | 授予更新配置项(ConfigMap)的权限。 | Write | configmap * | - |
cci:pod:list | 授予查询所有容器组(Pod)的权限。 | List | pod * | - |
cci:pod:create | 授予创建容器组(Pod)的权限。 | Write | pod * | |
cci:pod:get | 授予查询容器组(Pod)的权限。 | Read | pod * | - |
cci:pod:delete | 授予删除容器组(Pod)的权限。 | Write | pod * | - |
cci:pod:update | 授予更新容器组(Pod)的权限。 | Write | pod * | - |
cci:pod:getLog | 授予查询容器组(Pod)输出的权限。 | Read | pod * | - |
cci:pod:exec | 授予进入容器组(Pod)执行命令的权限。 | Write | pod * | |
cci:secret:list | 授予查询所有密钥(Secret)的权限。 | List | secret * | - |
cci:secret:create | 授予创建密钥(Secret)的权限。 | Write | secret * | - |
cci:secret:get | 授予查询密钥(Secret)的权限。 | Read | secret * | - |
cci:secret:delete | 授予删除密钥(Secret)的权限。 | Write | secret * | - |
cci:secret:update | 授予更新密钥(Secret)的权限。 | Write | secret * | - |
cci:persistentvolume:list | 授予查询所有存储卷(PersistentVolume)的权限。 | List | persistentvolume * | - |
cci:persistentvolume:create | 授予创建存储卷(PersistentVolume)的权限。 | Write | persistentvolume * | - |
cci:persistentvolume:get | 授予查询存储卷(PersistentVolume)的权限。 | Read | persistentvolume * | - |
cci:persistentvolume:update | 授予更新存储卷(PersistentVolume)的权限。 | Write | persistentvolume * | - |
cci:persistentvolume:delete | 授予删除存储卷(PersistentVolume)的权限。 | Write | persistentvolume * | - |
cci:persistentvolumeclaim:list | 授予查询所有存储卷声明(PersistentVolumeClaim)的权限。 | List | persistentvolumeclaim * | - |
cci:persistentvolumeclaim:create | 授予创建存储卷声明(PersistentVolumeClaim)的权限。 | Write | persistentvolumeclaim * | - |
cci:persistentvolumeclaim:get | 授予查询存储卷声明(PersistentVolumeClaim)的权限。 | Read | persistentvolumeclaim * | - |
cci:persistentvolumeclaim:update | 授予更新存储卷声明(PersistentVolumeClaim)的权限。 | Write | persistentvolumeclaim * | - |
cci:persistentvolumeclaim:delete | 授予删除存储卷声明(PersistentVolumeClaim)的权限。 | Write | persistentvolumeclaim * | - |
cci:storageclass:list | 授予查询所有存储类(StorageClass)的权限。 | List | - | - |
cci:imagesnapshot:list | 授予查询所有镜像快照(ImageSnapshot)的权限。 | List | imagesnapshot * | - |
cci:imagesnapshot:create | 授予创建镜像快照(ImageSnapshot)的权限。 | Write | imagesnapshot * | - |
cci:imagesnapshot:get | 授予查询镜像快照(ImageSnapshot)的权限。 | Read | imagesnapshot * | - |
cci:imagesnapshot:delete | 授予删除镜像快照(ImageSnapshot)的权限。 | Write | imagesnapshot * | - |
cci:deployment:list | 授予查询所有无状态负载(Deployment)的权限。 | List | deployment * | - |
cci:deployment:create | 授予创建无状态负载(Deployment)的权限。 | Write | deployment * | |
cci:deployment:get | 授予查询无状态负载(Deployment)的权限。 | Read | deployment * | - |
cci:deployment:delete | 授予删除无状态负载(Deployment)的权限。 | Write | deployment * | - |
cci:deployment:update | 授予更新无状态负载(Deployment)的权限。 | Write | deployment * | |
cci:service:list | 授予查询所有服务(Service)的权限。 | List | service * | - |
cci:service:create | 授予创建服务(Service)的权限。 | Write | service * | - |
cci:service:get | 授予查询服务(Service)的权限。 | Read | service * | - |
cci:service:delete | 授予删除服务(Service)的权限。 | Write | service * | - |
cci:service:update | 授予更新服务(Service)的权限。 | Write | service * | - |
cci:horizontalpodautoscaler:list | 授予查询所有水平弹性伸缩(HorizontalPodAutoscaler)的权限。 | List | - | - |
cci:horizontalpodautoscaler:create | 授予创建水平弹性伸缩(HorizontalPodAutoscaler)的权限。 | Write | - | - |
cci:horizontalpodautoscaler:get | 授予查询水平弹性伸缩(HorizontalPodAutoscaler)的权限。 | Read | - | - |
cci:horizontalpodautoscaler:delete | 授予删除水平弹性伸缩(HorizontalPodAutoscaler)的权限。 | Write | - | - |
cci:horizontalpodautoscaler:update | 授予更新水平弹性伸缩(HorizontalPodAutoscaler)的权限。 | Write | - | - |
cci::updateobservabilityconfiguration | 授予更新可观测性配置项(ObservabilityConfiguration)的权限。 | Write | - | - |
cci::getobservabilityconfiguration | 授予查询可观测性配置项(ObservabilityConfiguration)的权限。 | Read | - | - |
cci:poolbinding:list | 授予查询所有后端服务器组关联配置(PoolBinding)的权限。 | List | - | - |
cci:poolbinding:create | 授予创建后端服务器组关联配置(PoolBinding)的权限。 | Write | - | - |
cci:poolbinding:get | 授予查询后端服务器组关联配置(PoolBinding)的权限。 | Read | - | - |
cci:poolbinding:delete | 授予删除后端服务器组关联配置(PoolBinding)的权限。 | Write | - | - |
CCI的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。
API | 对应的授权项 | 依赖的授权项 |
|---|---|---|
GET /apis/cci/v2/namespaces | cci:namespace:list | - |
POST /apis/cci/v2/namespaces | cci:namespace:create | - |
GET /apis/cci/v2/namespaces/{name} | cci:namespace:get | - |
DELETE /apis/cci/v2/namespaces/{name} | cci:namespace:delete | - |
GET /apis/cci/v2/namespaces/{namespace}/configmaps | cci:configmap:list | - |
POST /apis/cci/v2/namespaces/{namespace}/configmaps | cci:configmap:create | - |
GET /apis/cci/v2/namespaces/{namespace}/configmaps/{name} | cci:configmap:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/configmaps/{name} | cci:configmap:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/configmaps/{name} | cci:configmap:delete | - |
GET /apis/cci/v2/namespaces/{namespace}/pods | cci:pod:list | - |
POST /apis/cci/v2/namespaces/{namespace}/pods | cci:pod:create | - |
GET /apis/cci/v2/namespaces/{namespace}/pods/{name} | cci:pod:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/pods/{name} | cci:pod:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/pods/{name} | cci:pod:delete | - |
PATCH /apis/cci/v2/namespaces/{namespace}/pods/{name} | cci:pod:update | - |
GET /apis/cci/v2/namespaces/{namespace}/secrets | cci:secret:list | - |
POST /apis/cci/v2/namespaces/{namespace}/secrets | cci:secret:create | - |
GET /apis/cci/v2/namespaces/{namespace}/secrets/{name} | cci:secret:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/secrets/{name} | cci:secret:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/secrets/{name} | cci:secret:delete | - |
GET /apis/yangtse/v2/namespaces/{namespace}/networks | cci:network:list | - |
POST /apis/yangtse/v2/namespaces/{namespace}/networks | cci:network:create | - |
GET /apis/yangtse/v2/namespaces/{namespace}/networks/{name} | cci:network:get | - |
PUT /apis/yangtse/v2/namespaces/{namespace}/networks/{name} | cci:network:update | - |
DELETE /apis/yangtse/v2/namespaces/{namespace}/networks/{name} | cci:network:delete | - |
POST /apis/cci/v2/namespaces/{namespace}/pods/{name}/exec | cci:pod:exec | - |
GET /apis/cci/v2/namespaces/{namespace}/pods/{name}/log | cci:pod:getLog | - |
GET /apis/cci/v2/persistentvolumes | cci:persistentvolume:list | - |
POST /apis/cci/v2/persistentvolumes | cci:persistentvolume:create | - |
GET /apis/cci/v2/persistentvolumes/{name} | cci:persistentvolume:get | - |
PUT /apis/cci/v2/persistentvolumes/{name} | cci:persistentvolume:update | - |
DELETE /apis/cci/v2/persistentvolumes/{name} | cci:persistentvolume:delete | - |
GET /apis/cci/v2/namespaces/{namespace}/persistentvolumeclaims | cci:persistentvolumeclaim:list | - |
POST /apis/cci/v2/namespaces/{namespace}/persistentvolumeclaims | cci:persistentvolumeclaim:create | - |
GET /apis/cci/v2/namespaces/{namespace}/persistentvolumeclaims/{name} | cci:persistentvolumeclaim:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/persistentvolumeclaims/{name} | cci:persistentvolumeclaim:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/persistentvolumeclaims/{name} | cci:persistentvolumeclaim:delete | - |
GET /apis/cci/v2/storageclasses | cci:storageclass:list | - |
GET /apis/cci/v2/imagesnapshots | cci:imagesnapshot:list | - |
POST /apis/cci/v2/imagesnapshots | cci:imagesnapshot:create | - |
GET /apis/cci/v2/imagesnapshots/{name} | cci:imagesnapshot:get | - |
DELETE /apis/cci/v2/imagesnapshots/{name} | cci:imagesnapshot:delete | - |
GET /apis/cci/v2/namespaces/{namespace}/services | cci:service:list | - |
POST /apis/cci/v2/namespaces/{namespace}/services | cci:service:create | - |
GET /apis/cci/v2/namespaces/{namespace}/services/{name} | cci:service:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/services/{name} | cci:service:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/services/{name} | cci:service:delete | - |
PATCH /apis/cci/v2/namespaces/{namespace}/services/{name} | cci:service:update | - |
GET /apis/cci/v2/namespaces/{namespace}/deployments | cci:deployment:list | - |
POST /apis/cci/v2/namespaces/{namespace}/deployments | cci:deployment:create | - |
GET /apis/cci/v2/namespaces/{namespace}/deployments/{name} | cci:deployment:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/deployments/{name} | cci:deployment:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/deployments/{name} | cci:deployment:delete | - |
PATCH /apis/cci/v2/namespaces/{namespace}/deployments/{name} | cci:deployment:update | - |
GET /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers | cci:horizontalpodautoscaler:list | - |
POST /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers | cci:horizontalpodautoscaler:create | - |
GET /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers/{name} | cci:horizontalpodautoscaler:get | - |
PUT /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers/{name} | cci:horizontalpodautoscaler:update | - |
DELETE /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers/{name} | cci:horizontalpodautoscaler:delete | - |
PATCH /apis/cci/v2/namespaces/{namespace}/horizontalpodautoscalers/{name} | cci:horizontalpodautoscaler:update | - |
PUT /v1/observabilityconfiguration | cci::updateobservabilityconfiguration | - |
GET /v1/observabilityconfiguration | cci::getobservabilityconfiguration | - |
GET /apis/loadbalancer.networking.openvessel.io/v1/namespaces/{namespace}/poolbindings | cci:poolbinding:list | - |
POST /apis/loadbalancer.networking.openvessel.io/v1/namespaces/{namespace}/poolbindings | cci:poolbinding:create | - |
GET /apis/loadbalancer.networking.openvessel.io/v1/namespaces/{namespace}/poolbindings/{name} | cci:poolbinding:get | - |
DELETE /apis/loadbalancer.networking.openvessel.io/v1/namespaces/{namespace}/poolbindings/{name} | cci:poolbinding:delete | - |

如果您需要在SCP策略中禁用OpenStack接口,不能禁用如下2个action:“vpc:nativeSubnets:get”、“vpc:subnets:get”,否则会导致CCI服务的网络功能异常。
资源类型(Resource)
资源类型(Resource)表示SCP所作用的资源。如表3中的某些操作指定了可以在该操作指定的资源类型,则必须在具有该操作的SCP语句中指定该资源的URN,SCP仅作用于此资源;如未指定,Resource默认为“*”,则SCP将应用到所有资源。您也可以在SCP中设置条件,从而指定资源类型。
CCI定义了以下可以在自定义SCP的Resource元素中使用的资源类型。
资源类型 | URN |
|---|---|
deployment | cci:<region>:<account-id>:deployment:<namespace-name>/<deployment-name> |
secret | cci:<region>:<account-id>:secret:<namespace-name>/<secret-name> |
namespace | cci:<region>:<account-id>:namespace:<namespace-name> |
service | cci:<region>:<account-id>:service:<namespace-name>/<service-name> |
network | cci:<region>:<account-id>:network:<namespace-name>/<network-name> |
persistentvolume | cci:<region>:<account-id>:persistentvolume:<persistentvolume-name> |
imagesnapshot | cci:<region>:<account-id>:imagesnapshot:<imagesnapshot-name> |
configmap | cci:<region>:<account-id>:configmap:<namespace-name>/<configmap-name> |
pod | cci:<region>:<account-id>:pod:<namespace-name>/<pod-name> |
persistentvolumeclaim | cci:<region>:<account-id>:persistentvolumeclaim:<namespace-name>/<persistentvolumeclaim-name> |
条件(Condition)
条件键概述
条件(Condition)是SCP生效的特定条件,包括条件键和运算符。
- 条件键表示SCP语句的Condition元素中的键值。根据适用范围,分为全局级条件键和服务级条件键。
- 全局级条件键(前缀为g:)适用于所有操作,在鉴权过程中,云服务不需要提供用户身份信息,系统将自动获取并鉴权。详情请参见:全局条件键。
- 服务级条件键(前缀通常为服务缩写,如cci:)仅适用于对应服务的操作,详情请参见表4。
- 单值/多值表示API调用时请求中与条件关联的值数。单值条件键在API调用时的请求中最多包含一个值,多值条件键在API调用时请求可以包含多个值。例如:g:SourceVpce是单值条件键,表示仅允许通过某个VPC终端节点发起请求访问某资源,一个请求最多包含一个VPC终端节点ID值。g:TagKeys是多值条件键,表示请求中携带的所有标签的key组成的列表,当用户在调用API请求时传入标签可以传入多个值。
- 运算符与条件键、条件值一起构成完整的条件判断语句,当请求信息满足该条件时,SCP才能生效。支持的运算符请参见:运算符。
CCI支持的服务级条件键
CCI定义了以下可以在自定义SCP的Condition元素中使用的条件键,您可以使用这些条件键进一步细化SCP语句应用的条件。

