forked from RedHatQE/openshift-python-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrole.py
30 lines (28 loc) · 796 Bytes
/
role.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from ocp_resources.role import Role
# The example bellow is also relevant for the ClusterRole resource.
# Add multiple rules to a specific Role or ClusterRole as a list of rules dictionaries:
rules = [
{
"apiGroups": ["kubevirt.io"],
"resources": ["virtualmachineinstances"],
"verbs": ["get", "create", "delete"],
},
{
"apiGroups": ["subresources.kubevirt.io"],
"resources": ["virtualmachineinstances/console"],
"verbs": ["get"],
},
{
"apiGroups": ["k8s.cni.cncf.io"],
"resources": ["network-attachment-definitions"],
"verbs": ["get"],
},
]
latency_role = Role(
name="latency-role",
namespace="namespace_name",
rules=rules,
)
latency_role.deploy()
# delete Role
latency_role.clean_up()