Bug 2035703

Summary: Roles -> RoleBindings tab doesn't show RoleBindings correctly
Product: OpenShift Container Platform Reporter: Yadan Pei <yapei>
Component: Management ConsoleAssignee: Cyril <cajieh>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10CC: aos-bugs, yapei
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-10 16:36:35 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:
Bug Depends On:    
Bug Blocks: 2078554    
Attachments:
Description Flags
No RoleBindings found none

Description Yadan Pei 2021-12-27 03:41:19 UTC
Created attachment 1847887 [details]
No RoleBindings found

Description of problem:


Version-Release number of selected component (if applicable):
4.10.0-0.nightly-2021-12-23-153012

How reproducible:
Always

Steps to Reproduce:
1. Create a Role and a RoleBinding for the new role
$ cat > example-role.yaml << EOF
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: example-yapei-role
  namespace: yapei
rules:
  - apiGroups:
      - ''
    resources:
      - pods
    verbs:
      - get
      - watch
      - list
EOF
cat > example-rolebinding.yaml << EOF

EOF

3. Check role and rolebinding info with CLI
$ oc get role -n yapei 
NAME                                          CREATED AT
example-yapei-role                            2021-12-27T03:32:50Z

$ oc describe role example-yapei-role  -n yapei
Name:         example-yapei-role
Labels:       <none>
Annotations:  <none>
PolicyRule:
  Resources  Non-Resource URLs  Resource Names  Verbs
  ---------  -----------------  --------------  -----
  pods       []                 []              [get watch list]

$ oc get rolebinding -n yapei
NAME                                          ROLE                                               AGE
example-rolebinding                           Role/example-yapei-role                            85s

$ oc describe rolebinding example-rolebinding -n yapei
Name:         example-rolebinding
Labels:       <none>
Annotations:  <none>
Role:
  Kind:  Role
  Name:  example-yapei-role
Subjects:
  Kind  Name  Namespace
  ----  ----  ---------
  User  pm1   

We can see that rolebinding/example-rolebinding is binding with role/example-yapei-role

4. User Management -> Roles -> example-yapei-role -> click 'RoleBindings' tab

Actual results:
4. it shows 'No RoleBindings found', even user create a new RoleBinding via UI(click 'Create binding' on RoleBindings tab) it still shows 'No RoleBindings found' when visit RoleBindings tab of Roles


Expected results:
4. Role's RoleBindings should be shown correctly

Additional info:
If we create RoleBindings from Roles -> RoleBindings tab, the RoleBinding YAML looks like:
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: example-rolebinding-two
  namespace: yapei
subjects:
  - kind: User
    apiGroup: rbac.authorization.k8s.io
    name: uiauto2
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: example-yapei-role

Comment 4 Yadan Pei 2022-01-17 08:09:46 UTC
1. Create Role and its RoleBinding
 ~/test-files/ cat example-role.yaml 
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: example-yapei-role
  namespace: yapei
rules:
  - apiGroups:
      - ''
    resources:
      - pods
    verbs:
      - get
      - watch
      - list
 ~/test-files/ oc create -f example-role.yaml 
role.rbac.authorization.k8s.io/example-yapei-role created
 ~/test-files/ oc get rolebinding -n yapei
NAME                        ROLE                               AGE
admin                       ClusterRole/admin                  110s
admin-0                     ClusterRole/admin                  73s
example-yapei-rolebinding   Role/example-yapei-role            11s
system:deployers            ClusterRole/system:deployer        110s
system:image-builders       ClusterRole/system:image-builder   110s
system:image-pullers        ClusterRole/system:image-puller    110s
 ~/test-files/ oc describe rolebinding example-yapei-rolebinding
Name:         example-yapei-rolebinding
Labels:       <none>
Annotations:  <none>
Role:
  Kind:  Role
  Name:  example-yapei-role
Subjects:
  Kind  Name     Namespace
  ----  ----     ---------
  User  uiauto3  

2. Navigate to User Management -> Roles -> example-yapei-role -> visit RoleBindings tab, the rolebindings are shown correctly

Verified on 4.10.0-0.nightly-2022-01-15-092722

Comment 7 errata-xmlrpc 2022-03-10 16:36:35 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 (Moderate: OpenShift Container Platform 4.10.3 security update), 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/RHSA-2022:0056