Skip to content

Commit 250b8f1

Browse files
committed
chore: Describe RBAC rules, remove unnecessary rules
1 parent a4577df commit 250b8f1

1 file changed

Lines changed: 50 additions & 29 deletions

File tree

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

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,84 @@ 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-
# For automatic cluster domain detection
9+
# For automatic cluster domain detection: the operator fetches the kubelet config from
10+
# /api/v1/nodes/{name}/proxy/configz to read clusterDomain. The node name is provided
11+
# via the downward API (KUBERNETES_NODE_NAME env var) so no list/watch on nodes is needed.
1712
- apiGroups:
1813
- ""
1914
resources:
2015
- nodes/proxy
2116
verbs:
2217
- get
18+
# Manage core workload resources created per DruidCluster.
19+
# Applied via Server-Side Apply (create + patch) and tracked for orphan cleanup (list + delete).
20+
# get is also required: when reconciliation is paused the framework calls client.get() instead
21+
# of apply_patch(). Both types are owned by the controller (.owns()) and therefore also need watch.
22+
# - configmaps: role-group config maps and discovery config maps
23+
# - services: headless and metrics services per role group
2324
- apiGroups:
2425
- ""
2526
resources:
26-
- pods
2727
- configmaps
28-
- secrets
2928
- services
30-
- endpoints
31-
- serviceaccounts
3229
verbs:
3330
- create
3431
- delete
3532
- get
3633
- list
3734
- patch
38-
- update
3935
- watch
36+
# Shared internal authentication secret (cookie passphrase and internal client password).
37+
# Managed directly via client.apply_patch() / client.delete() in internal_secret.rs —
38+
# not via ClusterResources — so list and watch are not needed.
4039
- apiGroups:
41-
- rbac.authorization.k8s.io
40+
- ""
4241
resources:
43-
- rolebindings
42+
- secrets
4443
verbs:
4544
- create
4645
- delete
4746
- get
48-
- list
4947
- patch
50-
- update
51-
- watch
48+
# ServiceAccount created per DruidCluster for workload pod identity.
49+
# Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
5250
- apiGroups:
53-
- apps
51+
- ""
5452
resources:
55-
- statefulsets
53+
- serviceaccounts
5654
verbs:
55+
- create
56+
- delete
5757
- get
58+
- list
59+
- patch
60+
# RoleBinding created per DruidCluster to bind the product ClusterRole to the workload
61+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
62+
- apiGroups:
63+
- rbac.authorization.k8s.io
64+
resources:
65+
- rolebindings
66+
verbs:
5867
- create
5968
- delete
69+
- get
6070
- list
6171
- patch
62-
- update
63-
- watch
72+
# StatefulSet created per role group. Applied via SSA, tracked for orphan cleanup, and
73+
# owned by the controller (.owns()), so watch is also required.
6474
- apiGroups:
65-
- batch
75+
- apps
6676
resources:
67-
- jobs
77+
- statefulsets
6878
verbs:
6979
- create
7080
- delete
7181
- get
7282
- list
7383
- patch
74-
- update
7584
- watch
85+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
86+
# Not watched by the controller.
7687
- apiGroups:
7788
- policy
7889
resources:
@@ -83,8 +94,6 @@ rules:
8394
- get
8495
- list
8596
- patch
86-
- update
87-
- watch
8897
- apiGroups:
8998
- apiextensions.k8s.io
9099
resources:
@@ -100,6 +109,8 @@ rules:
100109
- list
101110
- watch
102111
{{- end }}
112+
# Listener created per role group for external access. Applied via SSA and tracked for orphan
113+
# cleanup. Not watched by the controller (no .owns() or .watches() on Listener in main.rs).
103114
- apiGroups:
104115
- listeners.stackable.tech
105116
resources:
@@ -110,29 +121,33 @@ rules:
110121
- get
111122
- list
112123
- patch
113-
- watch
124+
# Required to report reconciliation results and warnings back to the DruidCluster object.
114125
- apiGroups:
115126
- events.k8s.io
116127
resources:
117128
- events
118129
verbs:
119130
- create
120131
- patch
132+
# Primary CRD: watched by Controller::new() and read during reconciliation.
133+
# The operator only modifies the status subresource (see druiddclusters/status below),
134+
# so patch on the main object is not needed.
121135
- apiGroups:
122136
- {{ include "operator.name" . }}.stackable.tech
123137
resources:
124138
- {{ include "operator.name" . }}clusters
125139
verbs:
126140
- get
127141
- list
128-
- patch
129142
- watch
143+
# Status subresource: updated at the end of every reconciliation via apply_patch_status().
130144
- apiGroups:
131145
- {{ include "operator.name" . }}.stackable.tech
132146
resources:
133147
- {{ include "operator.name" . }}clusters/status
134148
verbs:
135149
- patch
150+
# Read S3 connection and bucket configuration referenced in the DruidCluster spec.
136151
- apiGroups:
137152
- s3.stackable.tech
138153
resources:
@@ -142,6 +157,7 @@ rules:
142157
- get
143158
- list
144159
- watch
160+
# Read authentication class configuration referenced in the DruidCluster spec.
145161
- apiGroups:
146162
- authentication.stackable.tech
147163
resources:
@@ -150,6 +166,7 @@ rules:
150166
- get
151167
- list
152168
- watch
169+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
153170
- apiGroups:
154171
- rbac.authorization.k8s.io
155172
resources:
@@ -167,6 +184,8 @@ metadata:
167184
labels:
168185
{{- include "operator.labels" . | nindent 4 }}
169186
rules:
187+
# Druid reads its own configuration (ConfigMaps), credentials (Secrets), and service account
188+
# token (ServiceAccount) at runtime from within the pod.
170189
- apiGroups:
171190
- ""
172191
resources:
@@ -175,6 +194,7 @@ rules:
175194
- serviceaccounts
176195
verbs:
177196
- get
197+
# Allows Druid pods to emit Kubernetes events (e.g. for lifecycle notifications).
178198
- apiGroups:
179199
- events.k8s.io
180200
resources:
@@ -183,6 +203,7 @@ rules:
183203
- create
184204
- patch
185205
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
206+
# Required on OpenShift to allow the Druid pods to run as a non-root user.
186207
- apiGroups:
187208
- security.openshift.io
188209
resources:

0 commit comments

Comments
 (0)