Skip to content

Commit 27acaad

Browse files
chore: Describe RBAC rules, remove unnecessary rules (#810)
* chore: Describe RBAC rules, remove unnecessary rules * chore: Update changelog * fix: CRD permissions - Add missing description - Remove `get`, it is never used - Make list/watch unconditional * chore: Keep rbac.authorization.k8s.io rules together * chore: Update changelog * chore: Update descriptions on RBAC permissions * chore: Remove unused permissions for the product ClusterRole * chore(nix): Update crate hashes * chore: Split clusterroles into separate files for operator and product * chore: Correct roles mentioned * Apply suggestions from code review Co-authored-by: Techassi <git@techassi.dev> * chore: Remove superfluous permissions from the product clusterrole Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com> --------- Co-authored-by: Techassi <git@techassi.dev>
1 parent 088c71c commit 27acaad

5 files changed

Lines changed: 93 additions & 90 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Changed
8+
9+
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#810]).
10+
11+
- [#810]: https://github.com/stackabletech/druid-operator/pull/810
12+
713
## [26.3.0] - 2026-03-16
814

915
## [26.3.0-rc1] - 2026-03-16

Cargo.nix

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crate-hashes.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/druid-operator/templates/roles.yaml renamed to deploy/helm/druid-operator/templates/clusterrole-operator.yaml

Lines changed: 48 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,87 @@ metadata:
66
labels:
77
{{- include "operator.labels" . | nindent 4 }}
88
rules:
9-
- apiGroups:
10-
- ""
11-
resources:
12-
- nodes
13-
verbs:
14-
- list
15-
- watch
169
# For automatic cluster domain detection
1710
- apiGroups:
1811
- ""
1912
resources:
2013
- nodes/proxy
2114
verbs:
2215
- get
16+
# Manage core workload resources created per DruidCluster.
17+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18+
# orphan cleanup (list + delete).
2319
- apiGroups:
2420
- ""
2521
resources:
26-
- pods
2722
- configmaps
28-
- secrets
2923
- services
30-
- endpoints
31-
- serviceaccounts
3224
verbs:
3325
- create
3426
- delete
3527
- get
3628
- list
3729
- patch
38-
- update
3930
- watch
31+
# Shared internal authentication secret (cookie passphrase and internal client password).
32+
# Orphan cleanup not needed (instead, Kubernetes GC via owner reference).
4033
- apiGroups:
41-
- rbac.authorization.k8s.io
34+
- ""
4235
resources:
43-
- rolebindings
36+
- secrets
4437
verbs:
4538
- create
4639
- delete
4740
- get
48-
- list
4941
- patch
50-
- update
51-
- watch
42+
# ServiceAccount created per DruidCluster for workload pod identity.
43+
# Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
5244
- apiGroups:
53-
- apps
45+
- ""
5446
resources:
55-
- statefulsets
47+
- serviceaccounts
5648
verbs:
49+
- create
50+
- delete
5751
- get
52+
- list
53+
- patch
54+
# RoleBinding created per DruidCluster to bind the product ClusterRole to the workload
55+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
56+
- apiGroups:
57+
- rbac.authorization.k8s.io
58+
resources:
59+
- rolebindings
60+
verbs:
5861
- create
5962
- delete
63+
- get
6064
- list
6165
- patch
62-
- update
63-
- watch
66+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
67+
- apiGroups:
68+
- rbac.authorization.k8s.io
69+
resources:
70+
- clusterroles
71+
verbs:
72+
- bind
73+
resourceNames:
74+
- {{ include "operator.name" . }}-clusterrole
75+
# StatefulSet created per role group. Applied via SSA, tracked for orphan cleanup, and
76+
# owned by the controller.
6477
- apiGroups:
65-
- batch
78+
- apps
6679
resources:
67-
- jobs
80+
- statefulsets
6881
verbs:
6982
- create
7083
- delete
7184
- get
7285
- list
7386
- patch
74-
- update
7587
- watch
88+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
89+
# Not watched by the controller.
7690
- apiGroups:
7791
- policy
7892
resources:
@@ -83,23 +97,24 @@ rules:
8397
- get
8498
- list
8599
- patch
86-
- update
87-
- watch
100+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
101+
# Also for the startup condition check before the controller can run.
88102
- apiGroups:
89103
- apiextensions.k8s.io
90104
resources:
91105
- customresourcedefinitions
92106
verbs:
93-
- get
94107
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
95108
# generated certificate in the conversion webhook.
96109
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
97110
- create
98111
- patch
112+
{{- end }}
99113
# Required for startup condition
100114
- list
101115
- watch
102-
{{- end }}
116+
# Listener created per role group for external access. Applied via SSA and tracked for orphan
117+
# cleanup.
103118
- apiGroups:
104119
- listeners.stackable.tech
105120
resources:
@@ -110,29 +125,31 @@ rules:
110125
- get
111126
- list
112127
- patch
113-
- watch
128+
# Required to report reconciliation results and warnings back to the DruidCluster object.
114129
- apiGroups:
115130
- events.k8s.io
116131
resources:
117132
- events
118133
verbs:
119134
- create
120135
- patch
136+
# Primary CRD: watched by Controller::new() and read during reconciliation.
121137
- apiGroups:
122138
- {{ include "operator.name" . }}.stackable.tech
123139
resources:
124140
- {{ include "operator.name" . }}clusters
125141
verbs:
126142
- get
127143
- list
128-
- patch
129144
- watch
145+
# Status subresource: updated at the end of every reconciliation.
130146
- apiGroups:
131147
- {{ include "operator.name" . }}.stackable.tech
132148
resources:
133149
- {{ include "operator.name" . }}clusters/status
134150
verbs:
135151
- patch
152+
# Read S3 connection and bucket configuration referenced in the DruidCluster spec.
136153
- apiGroups:
137154
- s3.stackable.tech
138155
resources:
@@ -142,6 +159,7 @@ rules:
142159
- get
143160
- list
144161
- watch
162+
# Read authentication class configuration referenced in the DruidCluster spec.
145163
- apiGroups:
146164
- authentication.stackable.tech
147165
resources:
@@ -150,45 +168,3 @@ rules:
150168
- get
151169
- list
152170
- watch
153-
- apiGroups:
154-
- rbac.authorization.k8s.io
155-
resources:
156-
- clusterroles
157-
verbs:
158-
- bind
159-
resourceNames:
160-
- {{ include "operator.name" . }}-clusterrole
161-
162-
---
163-
apiVersion: rbac.authorization.k8s.io/v1
164-
kind: ClusterRole
165-
metadata:
166-
name: {{ include "operator.name" . }}-clusterrole
167-
labels:
168-
{{- include "operator.labels" . | nindent 4 }}
169-
rules:
170-
- apiGroups:
171-
- ""
172-
resources:
173-
- configmaps
174-
- secrets
175-
- serviceaccounts
176-
verbs:
177-
- get
178-
- apiGroups:
179-
- events.k8s.io
180-
resources:
181-
- events
182-
verbs:
183-
- create
184-
- patch
185-
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
186-
- apiGroups:
187-
- security.openshift.io
188-
resources:
189-
- securitycontextconstraints
190-
resourceNames:
191-
- nonroot-v2
192-
verbs:
193-
- use
194-
{{ end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# Product ClusterRole: bound (via per DruidCluster RoleBinding) to the ServiceAccount that Druid
3+
# workload pods (brokers, coordinators, historicals, middleManagers, routers) run as.
4+
apiVersion: rbac.authorization.k8s.io/v1
5+
kind: ClusterRole
6+
metadata:
7+
name: {{ include "operator.name" . }}-clusterrole
8+
labels:
9+
{{- include "operator.labels" . | nindent 4 }}
10+
rules:
11+
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
12+
# Required on OpenShift to allow the Druid pods to run as a non-root user.
13+
- apiGroups:
14+
- security.openshift.io
15+
resources:
16+
- securitycontextconstraints
17+
resourceNames:
18+
- nonroot-v2
19+
verbs:
20+
- use
21+
{{ end }}

0 commit comments

Comments
 (0)