Skip to content

Commit d3a41e8

Browse files
anishasthanaopenshift-merge-robot
authored andcommitted
Add Cluster Roles and Rolebindings to Operator Deployment
Signed-off-by: Anish Asthana <anishasthana1@gmail.com>
1 parent 49e2642 commit d3a41e8

13 files changed

+209
-51
lines changed

config/internal/mcad/clusterrole_custom-metrics-server-resources.yaml renamed to config/internal/mcad/clusterrole_custom-metrics-server-admin.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: custom-metrics-server-resources
4+
name: {{.Name}}-mcad-custom-metrics-server-admin-role
55
rules:
66
- apiGroups:
77
- custom.metrics.k8s.io

config/internal/mcad/clusterrole_system-controller-xqueuejob-controller.yaml renamed to config/internal/mcad/clusterrole_mcad-controller.yaml.tmpl

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ kind: ClusterRole
33
metadata:
44
annotations:
55
rbac.authorization.kubernetes.io/autoupdate: "true"
6-
name: system:controller:xqueuejob-controller
6+
name: {{.Name}}-mcad-controller-role
77
labels:
88
kubernetes.io/bootstrapping: rbac-defaults
99
rules:
1010
- apiGroups:
1111
- mcad.ibm.com
1212
resources:
13-
- xqueuejobs
1413
- queuejobs
1514
- schedulingspecs
1615
- appwrappers
@@ -30,6 +29,7 @@ rules:
3029
resources:
3130
- persistentvolumes
3231
- namespaces
32+
- lists
3333
verbs:
3434
- create
3535
- delete
@@ -39,12 +39,10 @@ rules:
3939
- patch
4040
- update
4141
- watch
42-
# {{ if .Values.quotaManagement.rbac.apiGroup }}
43-
# {{ if .Values.quotaManagement.rbac.resource }}
4442
- apiGroups:
45-
- {{.Values.quotaManagement.rbac.apiGroup}}
43+
- scheduling.sigs.k8s.io
4644
resources:
47-
- {{.Values.quotaManagement.rbac.resource}}
45+
- podgroups
4846
verbs:
4947
- get
5048
- list
@@ -53,21 +51,3 @@ rules:
5351
- update
5452
- patch
5553
- delete
56-
# {{ end }}
57-
# {{ end }}
58-
# {{ if .Values.coscheduler.rbac.apiGroup }}
59-
# {{ if .Values.coscheduler.rbac.resource }}
60-
- apiGroups:
61-
- {{.Values.coscheduler.rbac.apiGroup}}
62-
resources:
63-
- {{.Values.coscheduler.rbac.resource}}
64-
verbs:
65-
- get
66-
- list
67-
- watch
68-
- create
69-
- update
70-
- patch
71-
- delete
72-
# {{ end }}
73-
# {{ end }}

config/internal/mcad/clusterrole_metrics-resource-reader.yaml renamed to config/internal/mcad/clusterrole_metrics-resource-reader.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: custom-metrics-resource-reader
4+
name: {{.Name}}-mcad-metrics-resource-reader-role
55
rules:
66
- apiGroups:
77
- ""

config/internal/mcad/clusterrolebinding_hpa-controller-custom-metrics.yaml renamed to config/internal/mcad/clusterrolebinding_hpa-controller-custom-metrics.yaml.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ metadata:
55
roleRef:
66
apiGroup: rbac.authorization.k8s.io
77
kind: ClusterRole
8-
name: custom-metrics-server-resources
8+
name: {{.Name}}-mcad-custom-metrics-server-admin-role
99
subjects:
1010
- kind: ServiceAccount
1111
name: horizontal-pod-autoscaler
12-
namespace: {{.Namespace}}
12+
namespace: kube-system
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: ClusterRoleBinding
43
metadata:
54
annotations:
65
rbac.authorization.kubernetes.io/autoupdate: "true"
76
labels:
87
kubernetes.io/bootstrapping: rbac-defaults
9-
name: system:controller:xqueuejob-controller-kube-scheduler
8+
name: {{.Name}}-mcad-controller-kube-scheduler-crb
109
roleRef:
1110
apiGroup: rbac.authorization.k8s.io
1211
kind: ClusterRole
1312
name: system:kube-scheduler
1413
subjects:
1514
- kind: ServiceAccount
16-
name: {{.Values.serviceAccount}}
17-
namespace: kube-system
15+
name: mcad-controller-{{.Name}}
16+
namespace: {{.Namespace}}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: ClusterRoleBinding
43
metadata:
54
annotations:
65
rbac.authorization.kubernetes.io/autoupdate: "true"
76
labels:
87
kubernetes.io/bootstrapping: rbac-defaults
9-
name: system:controller:xqueuejob-controller
8+
name: {{.Name}}-mcad-controller-crb
109
roleRef:
1110
apiGroup: rbac.authorization.k8s.io
1211
kind: ClusterRole
13-
name: system:controller:xqueuejob-controller
12+
name: {{.Name}}-mcad-controller-role
1413
subjects:
1514
- kind: ServiceAccount
16-
name: {{.Values.serviceAccount}}
17-
namespace: kube-system
15+
name: mcad-controller-{{.Name}}
16+
namespace: {{.Namespace}}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: ClusterRoleBinding
43
metadata:
54
annotations:
65
rbac.authorization.kubernetes.io/autoupdate: "true"
76
labels:
87
kubernetes.io/bootstrapping: rbac-defaults
9-
name: system:controller:xqueuejob-controller-edit
8+
name: {{.Name}}-mcad-edit-crb
109
roleRef:
1110
apiGroup: rbac.authorization.k8s.io
1211
kind: ClusterRole
1312
name: edit
1413
subjects:
1514
- kind: ServiceAccount
16-
name: {{.Values.serviceAccount}}
17-
namespace: kube-system
15+
name: mcad-controller-{{.Name}}
16+
namespace: {{.Namespace}}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: ClusterRoleBinding
43
metadata:
5-
name: custom-metrics:system:auth-delegator
4+
name: {{.Name}}-mcad-system:auth-delegator
65
roleRef:
76
apiGroup: rbac.authorization.k8s.io
87
kind: ClusterRole
98
name: system:auth-delegator
109
subjects:
1110
- kind: ServiceAccount
12-
name: {{.Values.serviceAccount}}
13-
namespace: kube-system
11+
name: mcad-controller-{{.Name}}
12+
namespace: {{.Namespace}}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: ClusterRoleBinding
43
metadata:
5-
name: custom-metrics-resource-reader
4+
name: {{.Name}}-mcad-metrics-resource-reader-crb
65
roleRef:
76
apiGroup: rbac.authorization.k8s.io
87
kind: ClusterRole
9-
name: custom-metrics-resource-reader
8+
name: {{.Name}}-mcad-metrics-resource-reader-role
109
subjects:
1110
- kind: ServiceAccount
12-
name: {{.Values.serviceAccount}}
13-
namespace: kube-system
11+
name: mcad-controller-{{.Name}}
12+
namespace: {{.Namespace}}

config/rbac/edit_role_binding.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: manager-edit-rolebinding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: edit
9+
subjects:
10+
- kind: ServiceAccount
11+
name: controller-manager
12+
namespace: system

config/rbac/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ resources:
77
- service_account.yaml
88
- role.yaml
99
- role_binding.yaml
10+
- edit_role_binding.yaml # We are using this binding as mcad requires this role
1011
- leader_election_role.yaml
1112
- leader_election_role_binding.yaml
1213
# Comment the following 4 lines if you want to disable

0 commit comments

Comments
 (0)