Skip to content

Commit 8815801

Browse files
committed
chore: Describe RBAC rules, remove unnecessary rules
1 parent eabd9d7 commit 8815801

1 file changed

Lines changed: 41 additions & 42 deletions

File tree

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

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,68 @@ metadata:
66
labels:
77
{{- include "operator.labels" . | nindent 4 }}
88
rules:
9-
- apiGroups:
10-
- ""
11-
resources:
12-
- nodes
13-
verbs:
14-
- list
15-
- watch
16-
- get
17-
# For automatic cluster domain detection
9+
# For automatic cluster domain detection (reads kubelet config via the nodes/proxy API).
1810
- apiGroups:
1911
- ""
2012
resources:
2113
- nodes/proxy
2214
verbs:
2315
- get
16+
# Manage core workload resources created per HdfsCluster.
17+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18+
# orphan cleanup (list + delete). Resources watched by the controller also need watch.
19+
# - configmaps: rolegroup config maps; watched via .owns() and .watches()
20+
# - services: rolegroup headless and metrics services; watched via .owns()
2421
- apiGroups:
2522
- ""
2623
resources:
27-
- pods
2824
- configmaps
29-
- secrets
3025
- services
31-
- endpoints
32-
- serviceaccounts
3326
verbs:
3427
- create
3528
- delete
3629
- get
3730
- list
3831
- patch
39-
- update
4032
- watch
33+
# serviceaccounts are applied via SSA and tracked for orphan cleanup but not watched
34+
# by the controller.
4135
- apiGroups:
42-
- rbac.authorization.k8s.io
36+
- ""
4337
resources:
44-
- rolebindings
38+
- serviceaccounts
4539
verbs:
4640
- create
4741
- delete
4842
- get
4943
- list
5044
- patch
51-
- update
52-
- watch
45+
# rolebindings are applied via SSA and tracked for orphan cleanup but not watched
46+
# by the controller.
5347
- apiGroups:
54-
- apps
48+
- rbac.authorization.k8s.io
5549
resources:
56-
- statefulsets
50+
- rolebindings
5751
verbs:
58-
- get
5952
- create
6053
- delete
54+
- get
6155
- list
6256
- patch
63-
- update
64-
- watch
57+
# statefulsets are applied via SSA, tracked for orphan cleanup, and watched via .owns().
6558
- apiGroups:
66-
- batch
59+
- apps
6760
resources:
68-
- jobs
61+
- statefulsets
6962
verbs:
7063
- create
7164
- delete
7265
- get
7366
- list
7467
- patch
75-
- update
7668
- watch
69+
# poddisruptionbudgets are applied via SSA and tracked for orphan cleanup but not watched
70+
# by the controller.
7771
- apiGroups:
7872
- policy
7973
resources:
@@ -84,8 +78,6 @@ rules:
8478
- get
8579
- list
8680
- patch
87-
- update
88-
- watch
8981
- apiGroups:
9082
- apiextensions.k8s.io
9183
resources:
@@ -108,48 +100,43 @@ rules:
108100
verbs:
109101
- create
110102
- patch
103+
# Read listener addresses to build the discovery ConfigMap for downstream clients.
104+
# Listeners are managed by the listener-operator; this operator only reads them.
111105
- apiGroups:
112106
- listeners.stackable.tech
113107
resources:
114108
- listeners
115109
verbs:
116110
- get
117-
- list
118-
- apiGroups:
119-
- ""
120-
resources:
121-
- endpoints
122-
verbs:
123-
- get
124-
- list
111+
# Watch HdfsClusters for reconciliation (list + watch via Controller::new(), get during
112+
# reconcile). Status is patched via a separate rule on the /status subresource.
125113
- apiGroups:
126114
- {{ include "operator.name" . }}.stackable.tech
127115
resources:
128116
- {{ include "operator.name" . }}clusters
129117
verbs:
130118
- get
131119
- list
132-
- patch
133120
- watch
134121
- apiGroups:
135122
- {{ include "operator.name" . }}.stackable.tech
136123
resources:
137124
- {{ include "operator.name" . }}clusters/status
138125
verbs:
139126
- patch
127+
# Manage the hdfs-clusterrolebinding-nodes ClusterRoleBinding via Server-Side Apply.
128+
# This binding grants the HDFS product pods (topology provider) access to node and pod
129+
# information for rack awareness. Scoped to the specific ClusterRoleBinding by name.
140130
- apiGroups:
141131
- rbac.authorization.k8s.io
142132
resources:
143133
- clusterrolebindings
144134
resourceNames:
145135
- {{ include "operator.name" . }}-clusterrolebinding-nodes
146136
verbs:
147-
- patch
148-
- get
149-
- update
150-
- list
151-
- watch
152137
- create
138+
- patch
139+
# Allow binding the product ClusterRole when creating per-cluster RoleBindings.
153140
- apiGroups:
154141
- rbac.authorization.k8s.io
155142
resources:
@@ -166,6 +153,11 @@ metadata:
166153
labels:
167154
{{- include "operator.labels" . | nindent 4 }}
168155
rules:
156+
# Read configuration and identity resources mounted or referenced by product pods.
157+
# - configmaps: HDFS configuration files
158+
# - secrets: TLS certificates and Kerberos keytabs (provided by secret-operator volumes)
159+
# - serviceaccounts: bound service account token projection
160+
# - pods: pod self-inspection (e.g. hostname resolution, ZooKeeper coordination)
169161
- apiGroups:
170162
- ""
171163
resources:
@@ -175,6 +167,7 @@ rules:
175167
- pods
176168
verbs:
177169
- get
170+
# List pods for topology detection and peer discovery.
178171
- apiGroups:
179172
- ""
180173
resources:
@@ -206,6 +199,11 @@ metadata:
206199
labels:
207200
{{- include "operator.labels" . | nindent 4 }}
208201
rules:
202+
# The topology provider (rack awareness) running inside HDFS pods queries pod, node, and
203+
# endpoint information to compute rack labels for DataNodes.
204+
# - pods: discover pod-to-node assignment for topology calculation; watched by pod informer
205+
# - nodes: read rack labels (e.g. topology.kubernetes.io/zone) from the node the pod runs on
206+
# - endpoints: map service endpoints to pod IPs for topology resolution
209207
- apiGroups:
210208
- ""
211209
resources:
@@ -217,6 +215,7 @@ rules:
217215
- list
218216
# needed for pod informer
219217
- watch
218+
# Read listener addresses so HDFS pods can resolve external access endpoints.
220219
- apiGroups:
221220
- listeners.stackable.tech
222221
resources:

0 commit comments

Comments
 (0)