Skip to content

Commit 80058e0

Browse files
authored
Fix controlplane-provider rbac for issue 45 (#46)
* fix control plane rbac
1 parent b8a4a21 commit 80058e0

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed

bootstrap/config/rbac/role.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ rules:
1818
- patch
1919
- update
2020
- watch
21+
- apiGroups:
22+
- apiextensions.k8s.io
23+
resources:
24+
- customresourcedefinitions
25+
verbs:
26+
- get
27+
- list
28+
- watch
2129
- apiGroups:
2230
- bootstrap.cluster.x-k8s.io
2331
resources:
@@ -42,16 +50,73 @@ rules:
4250
- patch
4351
- update
4452
- watch
53+
- apiGroups:
54+
- bootstrap.cluster.x-k8s.io
55+
- controlplane.cluster.x-k8s.io
56+
- infrastructure.cluster.x-k8s.io
57+
resources:
58+
- '*'
59+
verbs:
60+
- create
61+
- delete
62+
- get
63+
- list
64+
- patch
65+
- update
66+
- watch
4567
- apiGroups:
4668
- cluster.x-k8s.io
4769
resources:
4870
- clusters
4971
- clusters/status
72+
verbs:
73+
- get
74+
- list
75+
- watch
76+
- apiGroups:
77+
- cluster.x-k8s.io
78+
resources:
79+
- clusters
80+
- clusters/status
81+
- machines
82+
- machines/status
83+
verbs:
84+
- get
85+
- list
86+
- watch
87+
- apiGroups:
88+
- cluster.x-k8s.io
89+
resources:
5090
- machines
5191
- machines/status
5292
verbs:
93+
- create
94+
- delete
95+
- get
96+
- list
97+
- patch
98+
- update
99+
- watch
100+
- apiGroups:
101+
- ""
102+
resources:
103+
- events
104+
verbs:
105+
- create
53106
- get
54107
- list
108+
- patch
109+
- watch
110+
- apiGroups:
111+
- ""
112+
resources:
113+
- secrets
114+
verbs:
115+
- create
116+
- get
117+
- list
118+
- patch
119+
- update
55120
- watch
56121
- apiGroups:
57122
- exp.cluster.x-k8s.io

controlplane/config/rbac/role.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ rules:
1818
- patch
1919
- update
2020
- watch
21+
- apiGroups:
22+
- apiextensions.k8s.io
23+
resources:
24+
- customresourcedefinitions
25+
verbs:
26+
- get
27+
- list
28+
- watch
2129
- apiGroups:
2230
- bootstrap.cluster.x-k8s.io
2331
resources:
@@ -42,16 +50,73 @@ rules:
4250
- patch
4351
- update
4452
- watch
53+
- apiGroups:
54+
- bootstrap.cluster.x-k8s.io
55+
- controlplane.cluster.x-k8s.io
56+
- infrastructure.cluster.x-k8s.io
57+
resources:
58+
- '*'
59+
verbs:
60+
- create
61+
- delete
62+
- get
63+
- list
64+
- patch
65+
- update
66+
- watch
4567
- apiGroups:
4668
- cluster.x-k8s.io
4769
resources:
4870
- clusters
4971
- clusters/status
72+
verbs:
73+
- get
74+
- list
75+
- watch
76+
- apiGroups:
77+
- cluster.x-k8s.io
78+
resources:
79+
- clusters
80+
- clusters/status
81+
- machines
82+
- machines/status
83+
verbs:
84+
- get
85+
- list
86+
- watch
87+
- apiGroups:
88+
- cluster.x-k8s.io
89+
resources:
5090
- machines
5191
- machines/status
5292
verbs:
93+
- create
94+
- delete
95+
- get
96+
- list
97+
- patch
98+
- update
99+
- watch
100+
- apiGroups:
101+
- ""
102+
resources:
103+
- events
104+
verbs:
105+
- create
53106
- get
54107
- list
108+
- patch
109+
- watch
110+
- apiGroups:
111+
- ""
112+
resources:
113+
- secrets
114+
verbs:
115+
- create
116+
- get
117+
- list
118+
- patch
119+
- update
55120
- watch
56121
- apiGroups:
57122
- exp.cluster.x-k8s.io

controlplane/controllers/kthreescontrolplane_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ type KThreesControlPlaneReconciler struct {
6464
managementClusterUncached k3s.ManagementCluster
6565
}
6666

67+
// +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;patch
68+
// +kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch
69+
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io;bootstrap.cluster.x-k8s.io;controlplane.cluster.x-k8s.io,resources=*,verbs=get;list;watch;create;update;patch;delete
70+
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters;clusters/status,verbs=get;list;watch
71+
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines;machines/status,verbs=get;list;watch;create;update;patch;delete
72+
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
73+
6774
func (r *KThreesControlPlaneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
6875
logger := r.Log.WithValues("namespace", req.Namespace, "kthreesControlPlane", req.Name)
6976

0 commit comments

Comments
 (0)