Skip to content

Commit

Permalink
patch(perms): added fine grain roles and added /metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Dipankar Das <[email protected]>
  • Loading branch information
dipankardas011 committed Jan 26, 2025
1 parent c27b4ad commit 7a60fff
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 3 deletions.
79 changes: 77 additions & 2 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,70 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
- apiGroups:
- ""
resources:
- configmaps
- namespaces
- pods
- secrets
- serviceaccounts
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- admissionregistration.k8s.io
resources:
- mutatingwebhookconfigurations
- validatingwebhookconfigurations
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- daemonsets
- deployments
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- '*'
- coordination.k8s.io
resources:
- '*'
- leases
verbs:
- create
- delete
Expand Down Expand Up @@ -42,3 +102,18 @@ rules:
- get
- patch
- update
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
- clusterroles
- rolebindings
- roles
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
9 changes: 8 additions & 1 deletion internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ type ClusterAddonReconciler struct {

const managerFinalizer string = "finalizer.manage.ksctl.com"

// RBAC markers for comprehensive controller management
// +kubebuilder:rbac:groups=manage.ksctl.com,resources=clusteraddons,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=manage.ksctl.com,resources=clusteraddons/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=manage.ksctl.com,resources=clusteraddons/finalizers,verbs=update
// +kubebuilder:rbac:groups=*,resources=*,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles;clusterrolebindings;roles;rolebindings,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=validatingwebhookconfigurations;mutatingwebhookconfigurations,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apps,resources=deployments;daemonsets;statefulsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups="",resources=namespaces;serviceaccounts;services;configmaps;secrets;pods,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:urls=/metrics,verbs=get

func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
l := log.FromContext(ctx)
Expand Down

0 comments on commit 7a60fff

Please sign in to comment.