Skip to content

Commit 45bc9e2

Browse files
authored
Fix controllers RBAC permissions (#54)
1 parent f87115a commit 45bc9e2

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed

config/default/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Adds namespace to all resources.
2-
namespace: migration-system
2+
namespace: cloud-map-mcs-system
33

44
# Value of this field is prepended to the
55
# names of all resources, e.g. a deployment named
66
# "wordpress" becomes "alices-wordpress".
77
# Note that it should also match with the prefix (text before '-') of the namespace
88
# field above.
9-
namePrefix: migration-
9+
namePrefix: cloud-map-mcs-
1010

1111
# Labels to add to all resources and selectors.
1212
#commonLabels:

config/rbac/role.yaml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,56 @@ metadata:
77
name: manager-role
88
rules:
99
- apiGroups:
10-
- multicluster.x-k8s.io
10+
- ""
1111
resources:
12-
- serviceexports
12+
- namespaces
13+
verbs:
14+
- list
15+
- watch
16+
- apiGroups:
17+
- ""
18+
resources:
19+
- services
1320
verbs:
21+
- create
1422
- get
1523
- list
16-
- patch
17-
- update
1824
- watch
1925
- apiGroups:
20-
- multicluster.x-k8s.io
26+
- discovery.k8s.io
2127
resources:
22-
- serviceexports/finalizers
28+
- endpointslices
2329
verbs:
30+
- create
2431
- get
25-
- update
32+
- list
33+
- watch
2634
- apiGroups:
2735
- multicluster.x-k8s.io
2836
resources:
29-
- serviceimports
37+
- serviceexports
3038
verbs:
31-
- create
3239
- get
3340
- list
3441
- patch
3542
- update
3643
- watch
3744
- apiGroups:
38-
- ""
45+
- multicluster.x-k8s.io
3946
resources:
40-
- namespaces
41-
- services
42-
- endpoints
47+
- serviceexports/finalizers
4348
verbs:
4449
- get
45-
- list
46-
- watch
47-
- create
4850
- update
4951
- apiGroups:
50-
- discovery.k8s.io
52+
- multicluster.x-k8s.io
5153
resources:
52-
- endpointslices
54+
- serviceimports
5355
verbs:
54-
- list
55-
- watch
56-
- get
5756
- create
57+
- delete
58+
- get
59+
- list
60+
- patch
5861
- update
62+
- watch

pkg/controllers/cloudmap_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ type CloudMapReconciler struct {
3434
logr.Logger
3535
}
3636

37-
// +kubebuilder:rbac:groups=multicluster.x-k8s.io,resources=serviceimports,verbs=get;list;update;patch
37+
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=list;watch
38+
// +kubebuilder:rbac:groups="",resources=services,verbs=create;get;list;watch
39+
// +kubebuilder:rbac:groups="discovery.k8s.io",resources=endpointslices,verbs=list;get;create;watch
40+
// +kubebuilder:rbac:groups=multicluster.x-k8s.io,resources=serviceimports,verbs=create;get;list;watch;update;patch;delete
3841

3942
// Start implements manager.Runnable
4043
func (r *CloudMapReconciler) Start(ctx context.Context) error {

pkg/controllers/serviceexport_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ type ServiceExportReconciler struct {
4747
Cloudmap cloudmap.ServiceDiscoveryClient
4848
}
4949

50+
// +kubebuilder:rbac:groups="",resources=services,verbs=get
51+
// +kubebuilder:rbac:groups="discovery.k8s.io",resources=endpointslices,verbs=list;watch;create
5052
// +kubebuilder:rbac:groups=multicluster.x-k8s.io,resources=serviceexports,verbs=get;list;watch;update;patch
5153
// +kubebuilder:rbac:groups=multicluster.x-k8s.io,resources=serviceexports/finalizers,verbs=get;update
5254

0 commit comments

Comments
 (0)