Skip to content

Commit fb6cd46

Browse files
authored
chore: Describe RBAC rules, remove unnecessary rules (#717)
* chore: Describe RBAC rules, remove unnecessary rules * chore: Update changelog * Apply suggestions from code review Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com> * chore: Add missing comment on rule * chore: Remove the get for customresourcedefinitions for the operator clusterrole Not needed for crd maintenance * chore: Remove the nodes list/watch rule for the operator clusterrole Not needed for clusterDomain detection * chore: Remove the configmaps/secrets/serviceaccounts get rule for the product clusterrole All secrets/configmaps are mounted, not accessed via the superset app * fix: customresourcedefinitions is always required for the startup condition * chore: Simplify rule comments * chore: Remove the events.k8s.io rule from the product ClusterRole The operator manages events * chore: Keep the rbac.authorization.k8s.io rules within a ClusterRole close to each other * chore: Split the roles.yaml into separate files for clusterrole-operator.yaml and clusterrole-product.yaml
1 parent 8be66cd commit fb6cd46

3 files changed

Lines changed: 72 additions & 68 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#717]).
6+
7+
[#717]: https://github.com/stackabletech/superset-operator/pull/717
8+
59
## [26.3.0] - 2026-03-16
610

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

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

Lines changed: 47 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,42 @@ 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 namespaced resources created per SupersetCluster.
17+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18+
# orphan cleanup (list + delete). ReconciliationPaused uses get.
2319
- apiGroups:
2420
- ""
2521
resources:
26-
- pods
2722
- configmaps
28-
- secrets
2923
- services
30-
- endpoints
31-
- serviceaccounts
32-
- secrets
3324
verbs:
3425
- create
3526
- delete
3627
- get
3728
- list
3829
- patch
39-
- update
4030
- watch
31+
# ServiceAccount created per SupersetCluster and per DruidConnection.
32+
# Applied via SSA and tracked for orphan cleanup.
33+
- apiGroups:
34+
- ""
35+
resources:
36+
- serviceaccounts
37+
verbs:
38+
- create
39+
- delete
40+
- get
41+
- list
42+
- patch
43+
# RoleBinding created per SupersetCluster to bind the product ClusterRole to the workload
44+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup.
4145
- apiGroups:
4246
- rbac.authorization.k8s.io
4347
resources:
@@ -48,32 +52,39 @@ rules:
4852
- get
4953
- list
5054
- patch
51-
- update
52-
- watch
55+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
56+
- apiGroups:
57+
- rbac.authorization.k8s.io
58+
resources:
59+
- clusterroles
60+
verbs:
61+
- bind
62+
resourceNames:
63+
- {{ include "operator.name" . }}-clusterrole
64+
# StatefulSet created per role group. Applied via SSA and tracked for orphan cleanup.
5365
- apiGroups:
5466
- apps
5567
resources:
5668
- statefulsets
5769
verbs:
58-
- get
5970
- create
6071
- delete
72+
- get
6173
- list
6274
- patch
63-
- update
6475
- watch
76+
# Job created per DruidConnection to run the datasource import task.
6577
- apiGroups:
6678
- batch
6779
resources:
6880
- jobs
6981
verbs:
7082
- create
71-
- delete
7283
- get
7384
- list
7485
- patch
75-
- update
7686
- watch
87+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
7788
- apiGroups:
7889
- policy
7990
resources:
@@ -84,47 +95,55 @@ rules:
8495
- get
8596
- list
8697
- patch
87-
- update
88-
- watch
98+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
99+
# Also for the startup condition check before the controller can run.
89100
- apiGroups:
90101
- apiextensions.k8s.io
91102
resources:
92103
- customresourcedefinitions
93104
verbs:
94-
- get
95105
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
96106
# generated certificate in the conversion webhook.
97107
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
98108
- create
99109
- patch
110+
{{- end }}
100111
# Required for startup condition
101112
- list
102113
- watch
103-
{{- end }}
114+
# Required to report reconciliation results and errors back to the SupersetCluster object.
104115
- apiGroups:
105116
- events.k8s.io
106117
resources:
107118
- events
108119
verbs:
109120
- create
110121
- patch
122+
# Primary CRDs: SupersetCluster and DruidConnection.
111123
- apiGroups:
112124
- {{ include "operator.name" . }}.stackable.tech
113125
resources:
114126
- {{ include "operator.name" . }}clusters
115127
- druidconnections
116-
- druidconnections/status
117128
verbs:
118129
- get
119130
- list
120-
- patch
121131
- watch
132+
# Patch status for SupersetCluster (reports conditions such as Available/Degraded).
122133
- apiGroups:
123134
- {{ include "operator.name" . }}.stackable.tech
124135
resources:
125136
- {{ include "operator.name" . }}clusters/status
126137
verbs:
127138
- patch
139+
# Patch status for DruidConnection (tracks import job progress: Pending/Importing/Ready/Failed).
140+
- apiGroups:
141+
- {{ include "operator.name" . }}.stackable.tech
142+
resources:
143+
- druidconnections/status
144+
verbs:
145+
- patch
146+
# Watch AuthenticationClass resources to react when authentication configuration changes.
128147
- apiGroups:
129148
- authentication.stackable.tech
130149
resources:
@@ -133,55 +152,15 @@ rules:
133152
- get
134153
- list
135154
- watch
136-
- apiGroups:
137-
- rbac.authorization.k8s.io
138-
resources:
139-
- clusterroles
140-
verbs:
141-
- bind
142-
resourceNames:
143-
- {{ include "operator.name" . }}-clusterrole
155+
# Listener created per role group for external access. Applied via SSA and tracked for orphan
156+
# cleanup.
144157
- apiGroups:
145158
- listeners.stackable.tech
146159
resources:
147160
- listeners
148161
verbs:
149-
- get
150-
- list
151-
- watch
152-
- patch
153162
- create
154163
- delete
155-
---
156-
apiVersion: rbac.authorization.k8s.io/v1
157-
kind: ClusterRole
158-
metadata:
159-
name: {{ include "operator.name" . }}-clusterrole
160-
labels:
161-
{{- include "operator.labels" . | nindent 4 }}
162-
rules:
163-
- apiGroups:
164-
- ""
165-
resources:
166-
- configmaps
167-
- secrets
168-
- serviceaccounts
169-
verbs:
170164
- get
171-
- apiGroups:
172-
- events.k8s.io
173-
resources:
174-
- events
175-
verbs:
176-
- create
165+
- list
177166
- patch
178-
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
179-
- apiGroups:
180-
- security.openshift.io
181-
resources:
182-
- securitycontextconstraints
183-
resourceNames:
184-
- nonroot-v2
185-
verbs:
186-
- use
187-
{{ 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 SupersetCluster RoleBinding) to the ServiceAccount that
3+
# Superset workload pods 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 Superset 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)