Skip to content

Commit 24a3fb6

Browse files
leon-apeapecloud-bot
authored andcommitted
fix: add RBAC permissions for clusterrole (#10060)
(cherry picked from commit 65dfc72)
1 parent 613f013 commit 24a3fb6

File tree

6 files changed

+125
-81
lines changed

6 files changed

+125
-81
lines changed

config/rbac/role.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,6 @@ rules:
486486
- serviceaccounts/finalizers
487487
verbs:
488488
- update
489-
- apiGroups:
490-
- ""
491-
resources:
492-
- serviceaccounts/status
493-
verbs:
494-
- get
495489
- apiGroups:
496490
- ""
497491
resources:
@@ -937,7 +931,7 @@ rules:
937931
- apiGroups:
938932
- rbac.authorization.k8s.io
939933
resources:
940-
- rolebindings
934+
- clusterroles
941935
verbs:
942936
- create
943937
- delete
@@ -949,15 +943,27 @@ rules:
949943
- apiGroups:
950944
- rbac.authorization.k8s.io
951945
resources:
952-
- rolebindings/finalizers
946+
- clusterroles/finalizers
953947
verbs:
954948
- update
955949
- apiGroups:
956950
- rbac.authorization.k8s.io
957951
resources:
958-
- rolebindings/status
952+
- rolebindings
959953
verbs:
954+
- create
955+
- delete
960956
- get
957+
- list
958+
- patch
959+
- update
960+
- watch
961+
- apiGroups:
962+
- rbac.authorization.k8s.io
963+
resources:
964+
- rolebindings/finalizers
965+
verbs:
966+
- update
961967
- apiGroups:
962968
- rbac.authorization.k8s.io
963969
resources:
@@ -976,12 +982,6 @@ rules:
976982
- roles/finalizers
977983
verbs:
978984
- update
979-
- apiGroups:
980-
- rbac.authorization.k8s.io
981-
resources:
982-
- roles/status
983-
verbs:
984-
- get
985985
- apiGroups:
986986
- snapshot.storage.k8s.io
987987
resources:

controllers/apps/component/component_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ type ComponentReconciler struct {
9292
// read only + watch access
9393
// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list;watch
9494

95-
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch
96-
// +kubebuilder:rbac:groups=core,resources=serviceaccounts/status,verbs=get
95+
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=get;list;watch;create;update;patch;delete
96+
// +kubebuilder:rbac:groups=core,resources=serviceaccounts/finalizers,verbs=update
9797

98-
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch
99-
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings/status,verbs=get
98+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete
99+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles/finalizers,verbs=update
100100

101-
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch
102-
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles/status,verbs=get
101+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
102+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings/finalizers,verbs=update
103103

104104
// Reconcile is part of the main kubernetes reconciliation loop which aims to
105105
// move the current state of the cluster closer to the desired state.

controllers/apps/componentdefinition_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ type ComponentDefinitionReconciler struct {
6666
// +kubebuilder:rbac:groups=apps.kubeblocks.io,resources=componentdefinitions/status,verbs=get;update;patch
6767
// +kubebuilder:rbac:groups=apps.kubeblocks.io,resources=componentdefinitions/finalizers,verbs=update
6868

69+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles,verbs=get;list;watch;create;update;patch;delete
70+
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles/finalizers,verbs=update
71+
6972
// Reconcile is part of the main kubernetes reconciliation loop which aims to
7073
// move the current state of the cluster closer to the desired state.
7174
//

deploy/helm/config/rbac/role.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,6 @@ rules:
486486
- serviceaccounts/finalizers
487487
verbs:
488488
- update
489-
- apiGroups:
490-
- ""
491-
resources:
492-
- serviceaccounts/status
493-
verbs:
494-
- get
495489
- apiGroups:
496490
- ""
497491
resources:
@@ -937,7 +931,7 @@ rules:
937931
- apiGroups:
938932
- rbac.authorization.k8s.io
939933
resources:
940-
- rolebindings
934+
- clusterroles
941935
verbs:
942936
- create
943937
- delete
@@ -949,15 +943,27 @@ rules:
949943
- apiGroups:
950944
- rbac.authorization.k8s.io
951945
resources:
952-
- rolebindings/finalizers
946+
- clusterroles/finalizers
953947
verbs:
954948
- update
955949
- apiGroups:
956950
- rbac.authorization.k8s.io
957951
resources:
958-
- rolebindings/status
952+
- rolebindings
959953
verbs:
954+
- create
955+
- delete
960956
- get
957+
- list
958+
- patch
959+
- update
960+
- watch
961+
- apiGroups:
962+
- rbac.authorization.k8s.io
963+
resources:
964+
- rolebindings/finalizers
965+
verbs:
966+
- update
961967
- apiGroups:
962968
- rbac.authorization.k8s.io
963969
resources:
@@ -976,12 +982,6 @@ rules:
976982
- roles/finalizers
977983
verbs:
978984
- update
979-
- apiGroups:
980-
- rbac.authorization.k8s.io
981-
resources:
982-
- roles/status
983-
verbs:
984-
- get
985985
- apiGroups:
986986
- snapshot.storage.k8s.io
987987
resources:

deploy/helm/templates/rbac/rbac_manager_role.yaml

Lines changed: 81 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,109 @@ metadata:
77
{{- include "kubeblocks.labels" . | nindent 4 }}
88
rules:
99
- apiGroups:
10-
- ""
10+
- ""
1111
resources:
12-
- serviceaccounts
12+
- serviceaccounts
1313
verbs:
14-
- create
15-
- delete
16-
- get
17-
- list
18-
- patch
19-
- update
14+
- create
15+
- delete
16+
- get
17+
- list
18+
- watch
19+
- patch
20+
- update
2021
- apiGroups:
21-
- ""
22+
- ""
2223
resources:
23-
- serviceaccounts/finalizers
24+
- serviceaccounts/finalizers
2425
verbs:
25-
- update
26+
- update
2627
- apiGroups:
27-
- ""
28+
- ""
2829
resources:
29-
- serviceaccounts/status
30+
- serviceaccounts/status
3031
verbs:
31-
- get
32-
- patch
33-
- update
32+
- get
33+
- patch
34+
- update
3435
- apiGroups:
35-
- rbac.authorization.k8s.io
36+
- rbac.authorization.k8s.io
3637
resources:
37-
- rolebindings
38+
- roles
3839
verbs:
39-
- create
40-
- delete
41-
- get
42-
- list
43-
- patch
44-
- update
40+
- create
41+
- delete
42+
- get
43+
- list
44+
- watch
45+
- patch
46+
- update
4547
- apiGroups:
46-
- rbac.authorization.k8s.io
48+
- rbac.authorization.k8s.io
4749
resources:
48-
- roles
50+
- roles/finalizers
4951
verbs:
50-
- create
51-
- delete
52-
- get
53-
- list
54-
- patch
55-
- update
52+
- update
5653
- apiGroups:
57-
- rbac.authorization.k8s.io
54+
- rbac.authorization.k8s.io
5855
resources:
59-
- roles/status
56+
- roles/status
6057
verbs:
61-
- get
62-
- patch
63-
- update
58+
- get
59+
- patch
60+
- update
6461
- apiGroups:
65-
- rbac.authorization.k8s.io
62+
- rbac.authorization.k8s.io
6663
resources:
67-
- rolebindings/finalizers
64+
- rolebindings
6865
verbs:
69-
- update
66+
- create
67+
- delete
68+
- get
69+
- list
70+
- watch
71+
- patch
72+
- update
7073
- apiGroups:
71-
- rbac.authorization.k8s.io
74+
- rbac.authorization.k8s.io
7275
resources:
73-
- rolebindings/status
76+
- rolebindings/finalizers
7477
verbs:
75-
- get
76-
- patch
77-
- update
78+
- update
79+
- apiGroups:
80+
- rbac.authorization.k8s.io
81+
resources:
82+
- rolebindings/status
83+
verbs:
84+
- get
85+
- patch
86+
- update
87+
- apiGroups:
88+
- rbac.authorization.k8s.io
89+
resources:
90+
- clusterroles
91+
verbs:
92+
- create
93+
- delete
94+
- get
95+
- list
96+
- watch
97+
- patch
98+
- update
99+
- apiGroups:
100+
- rbac.authorization.k8s.io
101+
resources:
102+
- clusterroles/finalizers
103+
verbs:
104+
- update
105+
- apiGroups:
106+
- rbac.authorization.k8s.io
107+
resources:
108+
- clusterroles/status
109+
verbs:
110+
- get
111+
- patch
112+
- update
78113
- apiGroups:
79114
- rbac.authorization.k8s.io
80115
resources:
@@ -84,6 +119,7 @@ rules:
84119
- delete
85120
- get
86121
- list
122+
- watch
87123
- patch
88124
- update
89125
- apiGroups:

deploy/helm/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ fullnameOverride: ""
6262
##
6363
## groups=rbac.authorization.k8s.io,resources=roles,verbs=get;list;watch;create;update;patch;delete
6464
## groups=rbac.authorization.k8s.io,resources=roles/status,verbs=get;update;patch
65+
## groups=rbac.authorization.k8s.io,resources=roles/finalizers,verbs=update
6566
##
6667
## groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=get;list;watch;create;update;patch;delete
6768
## groups=rbac.authorization.k8s.io,resources=rolebindings/status,verbs=get;update;patch
6869
## groups=rbac.authorization.k8s.io,resources=rolebindings/finalizers,verbs=update
6970
##
71+
## groups=rbac.authorization.k8s.io,resources=clusterroles,verbs=get;list;watch;create;update;patch;delete
72+
## groups=rbac.authorization.k8s.io,resources=clusterroles/status,verbs=get;update;patch
73+
## groups=rbac.authorization.k8s.io,resources=clusterroles/finalizers,verbs=update
74+
##
7075
## groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=get;list;watch;create;update;patch;delete
7176
## groups=rbac.authorization.k8s.io,resources=clusterrolebindings/status,verbs=get;update;patch
7277
## groups=rbac.authorization.k8s.io,resources=clusterrolebindings/finalizers,verbs=update

0 commit comments

Comments
 (0)