如果系统预设的镜像仓库策略,不能满足您对于权限管控需求,您可使用自定义策略。
以下为一些镜像仓库的自定义策略的案例。
授予 IAM 用户指定体验版实例(cr-basic)指定命名空间(library)的读权限。IAM 用户登录镜像仓库后可以拉取该命名空间下所有镜像实例,可以通过 OpenAPI 查到该命名空间的信息以及该命名空间下所有镜像实例的相关信息。
{ "Statement": [ { "Effect": "Allow", "Action": [ "cr:List*", "cr:Get*", "cr:Pull*" ], "Resource": [ "trn:cr:*:*:instance/cr-basic", "trn:cr:*:*:repository/cr-basic/library", "trn:cr:*:*:repository/cr-basic/library/*" ] } ] }
授予 IAM 用户指定体验版实例(cr-basic)指定命名空间(library)的所有使用权限 。
{ "Statement": [ { "Effect": "Allow", "Action": [ "cr:*" ], "Resource": [ "trn:cr:*:*:instance/cr-basic", "trn:cr:*:*:repository/cr-basic/library", "trn:cr:*:*:repository/cr-basic/library/*" ] } ] }
授权 IAM 用户某个镜像(例如:镜像仓库体验版实例名称 cr-basic,所属命名空间名称 library,镜像名称 nginx,)的所有使用权限。
{ "Statement": [ { "Effect": "Allow", "Action": [ "cr:List*", "cr:Get*" ], "Resource": [ "trn:cr:*:*:instance/cr-basic", "trn:cr:*:*:repository/cr-basic/library" ] }, { "Effect": "Allow", "Action": [ "cr:*" ], "Resource": [ "trn:cr:*:*:instance/cr-basic", "trn:cr:*:*:repository/cr-basic/library/nginx" ] } ] }