-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
Product / Portfolio Work
-
False
-
-
False
-
None
-
-
Moderate
-
Customer Reported
-
None
Description of problem:
Not able to enable restart button and disable pause button for a VM.
Version-Release number of selected component (if applicable):
OCP 4.20.8 openshift-cnv 4.20.3
How reproducible:
Easily
Steps to Reproduce:
1. Create a VM from the default template like rhel 8 by a admin user in a new project(my-test).
2. Create a new user(testRole) and give this user the default view clusterrole of the my-test project.
3. Create a custom role with the rules of kubevirt.io apigroups.
- The testRole user has 2 roles.
$ oc get rolebinding -o wide | grep testRole
kubevirt.io:testRole Role/my-vm-role 34m testRole
testRole-view ClusterRole/view 80m testRole
$ oc get clusterrolebinding -o wide | grep testRole
$
- When use following custom role, the stop, restart, pause, start buttons work as expected (NonDisable01.png, NonDisable02.png).
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
kubevirt.io: ""
name: my-vm-role
rules:
- apiGroups:
- subresources.kubevirt.io
resources:
- virtualmachineinstances/console
- virtualmachineinstances/vnc
verbs:
- get
- apiGroups:
- subresources.kubevirt.io
resources:
- virtualmachines/start
- virtualmachines/stop
- virtualmachines/restart
- virtualmachineinstances/pause
- virtualmachineinstances/unpause
verbs:
- update
- put
- apiGroups:
- kubevirt.io
resources:
- virtualmachines
verbs:
- get
- list
- watch
- but if you remove virtualmachineinstances/pause and virtualmachineinstances/unpause, the restart button will disappear (DisablePause_VMon.png). The role was deleted and recreated after the change.
- virtualmachines/start
- virtualmachines/stop
- virtualmachines/restart
#- virtualmachineinstances/pause
#- virtualmachineinstances/unpause
- And if you remove virtualmachines/restart, the pause button will disappear(DisableRestart_VMon.png). The role was deleted and recreated after the change. Click the restart button, no respond(DisableRestart_click.png).
- virtualmachines/start
- virtualmachines/stop
#- virtualmachines/restart
- virtualmachineinstances/pause
- virtualmachineinstances/unpause
Actual results:
The actions of rules virtualmachines/restart and virtualmachineinstances/pause, virtualmachineinstances/unpause are reversed.
Expected results:
The actions of rules virtualmachines/restart and virtualmachineinstances/pause, virtualmachineinstances/unpause work as expected.
Additional info: