我已经设置了一个具有“视图”角色的协作者帐户。我现在想授予该用户使用oc tag
.
按照这些说明,我有:
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
向用户授予权限?
谢谢!
更新:
registry-editor
我在上面的链接上的“示例 1”中找到了一个预先存在的角色,它可以完成这项工作:
$ oc policy add-role-to-user registry-editor myuser
role "registry-editor" added: "myuser"
如果没有现成的角色,我仍然很想知道如何创建自定义角色。再次感谢!