Bug 1833558

Summary: oc adm policy add-scc-to-user to create Roles and RoleBindings
Product: OpenShift Container Platform Reporter: Maciej Szulik <maszulik>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: high Docs Contact:
Priority: high    
Version: 4.5CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: add-scc-to-user was modifying SCC directly. Consequence: In 4.x architecture it's the operator role to manage built-in SCC. Fix: oc adm policy add-scc-to-user should create rather assign Roles containing the SCC, so they are preserved during operator reconciliation. Result: Operator reconciling built-in SCC will not affect SCCs assigned to a user.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:36:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Maciej Szulik 2020-05-08 21:56:52 UTC
Currently oc adm policy add-scc-to-user modifies SCC directly but should rather create appropriate ClusterRole and ClusterRoleBinding instead and not modify SCC at all.

Comment 1 Maciej Szulik 2020-05-20 08:26:28 UTC
PRs in the queue.

Comment 4 zhou ying 2020-06-01 02:45:40 UTC
Confirmed with latest oc , the issue has fixed:

[root@dhcp-140-138 ~]# oc version --client -o yaml 
clientVersion:
  buildDate: "2020-05-29T14:24:36Z"
  compiler: gc
  gitCommit: 9933eb90790b36d153fcc55f8404724bb0929b96
  gitTreeState: clean
  gitVersion: 4.5.0-202005291417-9933eb9
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64


[root@dhcp-140-138 ~]# oc  adm policy add-scc-to-user privileged testuser-1
clusterrole.rbac.authorization.k8s.io/system:openshift:scc:privileged added: "testuser-1"

[root@dhcp-140-138 ~]# oc get clusterrole |grep privileged
system:openshift:scc:privileged                                        2020-06-01T00:28:23Z


[root@dhcp-140-138 ~]# oc get clusterrolebinding |grep privileged
system:openshift:scc:privileged                                                  ClusterRole/system:openshift:scc:privileged                                        2m49s

Comment 5 errata-xmlrpc 2020-07-13 17:36:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409