【发布时间】:2018-05-28 17:27:33
【问题描述】:
我已经设置了一个具有“视图”角色的协作者帐户。我现在想授予该用户使用oc tag 标记图像的能力。
按照these 的指示,我有:
oc get clusterrole view -o yaml > role_edittags.yaml
# 1. Update kind: ClusterRole to kind: Role
# 2. Update name: view to name: edittags
# 3. Remove resourceVersion, selfLink, uid, and creationTimestamp
# 4. split up the section with {imagestreamimages,imagestreammappings,imagestreams,imagestreamtags} into two sections:
- apiGroups:
- image.openshift.io
- ""
attributeRestrictions: null
resources:
- imagestreamimages
- imagestreammappings
- imagestreams
verbs:
- get
- list
- watch
- apiGroups:
- image.openshift.io
- ""
attributeRestrictions: null
resources:
- imagestreamtags
verbs:
- get
- list
- watch
- create
- update
- patch
- deletecollection
然后我 oc project 进入我想要授予该角色的项目并将其导入:
$ oc create -f role_edittags.yaml
role "edittags" created
当我尝试将其授予用户时,我收到一个错误:
$ oc policy add-role-to-user edittags myuser
Error from server (NotFound): rolebindings.authorization.openshift.io "edittags" not found
如何向用户授予oc tag 权限?
谢谢!
更新:
我在上面链接的“示例 1”中找到了一个预先存在的角色 registry-editor,它可以完成这项工作:
$ oc policy add-role-to-user registry-editor myuser
role "registry-editor" added: "myuser"
如果没有现成的角色,我仍然很想知道如何创建自定义角色。再次感谢!
【问题讨论】:
标签: openshift openshift-3 openshift-online