Skip to content

Commit

Permalink
[RBAC] move namespace-scoped resource permissions to Roles
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <[email protected]>
  • Loading branch information
tariq1890 committed Jun 11, 2024
1 parent 217d7e5 commit c1aa13f
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 66 deletions.
73 changes: 7 additions & 66 deletions deployments/gpu-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ rules:
- apiGroups:
- config.openshift.io
resources:
- clusterversions
- proxies
verbs:
- get
- apiGroups:
- image.openshift.io
resources:
- imagestreams
verbs:
- get
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
- clusterroles
- clusterrolebindings
verbs:
Expand All @@ -30,12 +35,7 @@ rules:
- apiGroups:
- ""
resources:
- pods
- services
- events
- configmaps
- secrets
- serviceaccounts
verbs:
- create
- get
Expand Down Expand Up @@ -68,16 +68,9 @@ rules:
- apiGroups:
- apps
resources:
- deployments
- daemonsets
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- apps
resources:
Expand All @@ -86,18 +79,6 @@ rules:
- get
- list
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
- prometheusrules
verbs:
- get
- list
- create
- watch
- update
- delete
- apiGroups:
- nvidia.com
resources:
Expand Down Expand Up @@ -125,27 +106,6 @@ rules:
- list
- watch
- create
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- use
- apiGroups:
- config.openshift.io
resources:
- clusterversions
verbs:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand All @@ -169,14 +129,6 @@ rules:
- update
- watch
- delete
- apiGroups:
- image.openshift.io
resources:
- imagestreams
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand All @@ -190,17 +142,6 @@ rules:
- delete
- update
- patch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch
- create
- update
- patch
- apiGroups:
- apiextensions.k8s.io
resources:
Expand Down
61 changes: 61 additions & 0 deletions deployments/gpu-operator/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: gpu-operator
labels:
{{- include "gpu-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: "gpu-operator"
rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- ""
resources:
- services
- configmaps
- secrets
- serviceaccounts
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
- prometheusrules
verbs:
- get
- list
- create
- watch
- update
- delete
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
verbs:
- create
- get
- list
- watch
- update
- patch
- delete
- use
15 changes: 15 additions & 0 deletions deployments/gpu-operator/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gpu-operator
labels:
{{- include "gpu-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: "gpu-operator"
subjects:
- kind: ServiceAccount
name: gpu-operator
namespace: {{ $.Release.Namespace }}
roleRef:
kind: Role
name: gpu-operator
apiGroup: rbac.authorization.k8s.io

0 comments on commit c1aa13f

Please sign in to comment.