Skip to content

Commit

Permalink
controller: add rbac for watching generated resources
Browse files Browse the repository at this point in the history
  • Loading branch information
xdavidwu committed May 2, 2024
1 parent 8766cef commit 2faa07a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,36 @@ rules:
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- create
- list
- patch
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- create
- list
- patch
- watch
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- list
- patch
- watch
- apiGroups:
- kube-cgi.aic.cs.nycu.edu.tw
resources:
Expand Down Expand Up @@ -98,11 +106,15 @@ rules:
- ingresses
verbs:
- create
- list
- patch
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
verbs:
- create
- list
- patch
- watch
12 changes: 6 additions & 6 deletions internal/controller/apiset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ type APISetReconciler struct {
//+kubebuilder:rbac:groups=kube-cgi.aic.cs.nycu.edu.tw,resources=apisets/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=kube-cgi.aic.cs.nycu.edu.tw,resources=apisets/finalizers,verbs=update

//+kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=create;patch
//+kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=create;patch
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=create;patch
//+kubebuilder:rbac:groups="",resources=services,verbs=create;patch
//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=create;patch
//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;create;patch
//+kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=list;watch;create;patch
//+kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=list;watch;create;patch
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=list;watch;create;patch
//+kubebuilder:rbac:groups="",resources=services,verbs=list;watch;create;patch
//+kubebuilder:rbac:groups=networking.k8s.io,resources=ingresses,verbs=list;watch;create;patch
//+kubebuilder:rbac:groups="",resources=secrets,verbs=list;watch;get;create;patch
//+kubebuilder:rbac:groups=monitoring.coreos.com,resources=servicemonitors,verbs=create;patch

// rbac in internal/cgid is also set on manager to be able to bind
Expand Down

0 comments on commit 2faa07a

Please sign in to comment.