Skip to content

Commit 84e868f

Browse files
committed
chore: Describe RBAC rules, remove unnecessary rules
1 parent 9274d3e commit 84e868f

1 file changed

Lines changed: 44 additions & 17 deletions

File tree

deploy/helm/hbase-operator/templates/roles.yaml

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
labels:
66
{{- include "operator.labels" . | nindent 4 }}
77
rules:
8+
# For automatic cluster domain detection
89
- apiGroups:
910
- ""
1011
resources:
@@ -19,22 +20,43 @@ rules:
1920
- nodes/proxy
2021
verbs:
2122
- get
23+
# Manage core workload resources created per HbaseCluster.
24+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
25+
# orphan cleanup (list + delete). get is needed when reconciliation is paused (the
26+
# operator reads current state instead of applying). Both resource types are watched
27+
# by the controller (.owns(Service), .watches(ConfigMap)) so they also need watch.
28+
# - configmaps: role group configuration and discovery configmap
29+
# - services: role group headless and metrics services
2230
- apiGroups:
2331
- ""
2432
resources:
25-
- pods
2633
- configmaps
2734
- services
28-
- endpoints
29-
- serviceaccounts
3035
verbs:
3136
- create
3237
- delete
3338
- get
3439
- list
3540
- patch
36-
- update
3741
- watch
42+
# Manage ServiceAccounts created per HbaseCluster for workload pods.
43+
# Applied via SSA (create + patch), tracked for orphan cleanup (list + delete).
44+
# get is needed when reconciliation is paused.
45+
# ServiceAccounts are not watched by the controller.
46+
- apiGroups:
47+
- ""
48+
resources:
49+
- serviceaccounts
50+
verbs:
51+
- create
52+
- delete
53+
- get
54+
- list
55+
- patch
56+
# Manage RoleBindings that bind the product ClusterRole to per-cluster ServiceAccounts.
57+
# Applied via SSA (create + patch), tracked for orphan cleanup (list + delete).
58+
# get is needed when reconciliation is paused.
59+
# RoleBindings are not watched by the controller.
3860
- apiGroups:
3961
- rbac.authorization.k8s.io
4062
resources:
@@ -45,20 +67,24 @@ rules:
4567
- get
4668
- list
4769
- patch
48-
- update
49-
- watch
70+
# Manage StatefulSets created per role group.
71+
# Applied via SSA (create + patch), tracked for orphan cleanup (list + delete),
72+
# watched by the controller via .owns(StatefulSet), and read on pause (get).
5073
- apiGroups:
5174
- apps
5275
resources:
5376
- statefulsets
5477
verbs:
55-
- get
5678
- create
5779
- delete
80+
- get
5881
- list
5982
- patch
60-
- update
6183
- watch
84+
# Manage PodDisruptionBudgets created per role for availability guarantees.
85+
# Applied via SSA (create + patch), tracked for orphan cleanup (list + delete).
86+
# get is needed when reconciliation is paused.
87+
# PodDisruptionBudgets are not watched by the controller.
6288
- apiGroups:
6389
- policy
6490
resources:
@@ -69,8 +95,6 @@ rules:
6995
- get
7096
- list
7197
- patch
72-
- update
73-
- watch
7498
- apiGroups:
7599
- apiextensions.k8s.io
76100
resources:
@@ -86,34 +110,34 @@ rules:
86110
- list
87111
- watch
88112
{{- end }}
113+
# For emitting Kubernetes events during reconciliation
89114
- apiGroups:
90115
- events.k8s.io
91116
resources:
92117
- events
93118
verbs:
94119
- create
95120
- patch
96-
- apiGroups:
97-
- listeners.stackable.tech
98-
resources:
99-
- listeners
100-
verbs:
101-
- get
121+
# The primary resource watched by the controller (Controller::new).
122+
# get + list + watch are required for the controller to observe HbaseClusters.
123+
# Status is updated via the separate /status subresource rule below.
102124
- apiGroups:
103125
- {{ include "operator.name" . }}.stackable.tech
104126
resources:
105127
- {{ include "operator.name" . }}clusters
106128
verbs:
107129
- get
108130
- list
109-
- patch
110131
- watch
132+
# For writing the HbaseCluster status subresource (apply_patch_status)
111133
- apiGroups:
112134
- {{ include "operator.name" . }}.stackable.tech
113135
resources:
114136
- {{ include "operator.name" . }}clusters/status
115137
verbs:
116138
- patch
139+
# For binding the product ClusterRole (hbase-clusterrole) to per-cluster ServiceAccounts
140+
# via namespaced RoleBindings created per HbaseCluster
117141
- apiGroups:
118142
- rbac.authorization.k8s.io
119143
resources:
@@ -130,6 +154,7 @@ metadata:
130154
labels:
131155
{{- include "operator.labels" . | nindent 4 }}
132156
rules:
157+
# HBase pods need to read their own ConfigMap, Secret, and ServiceAccount at runtime.
133158
- apiGroups:
134159
- ""
135160
resources:
@@ -138,6 +163,7 @@ rules:
138163
- serviceaccounts
139164
verbs:
140165
- get
166+
# For emitting Kubernetes events from within the HBase pods
141167
- apiGroups:
142168
- events.k8s.io
143169
resources:
@@ -146,6 +172,7 @@ rules:
146172
- create
147173
- patch
148174
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
175+
# Required on OpenShift to allow HBase pods to run as non-root
149176
- apiGroups:
150177
- security.openshift.io
151178
resources:

0 commit comments

Comments
 (0)