Skip to content

Commit c224460

Browse files
authored
chore: Describe RBAC rules, remove unnecessary rules (#693)
* chore: Describe RBAC rules, remove unnecessary rules * chore: Update changelog * chore: remove unused customresourcedefinitions get * chore: Add missing comment for rule * chore: Remove unused permissions * fix: Remove condition for customresourcedefinitions list/watch * chore: simplify the rule descriptions * chore: Remove unused product ClusterRole permission Note: Products should not be creating/updating events, the operator does that. * chore: group rbac.authorization.k8s.io rules together * chore: Split the clusterroles between operator and product * chore(nix): Update crate hashes * Apply suggestions from code review Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
1 parent e590d73 commit c224460

File tree

5 files changed

+81
-90
lines changed

5 files changed

+81
-90
lines changed

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 ([#693]).
10+
11+
[#693]: https://github.com/stackabletech/hive-operator/pull/693
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/hive-operator/templates/roles.yaml renamed to deploy/helm/hive-operator/templates/clusterrole-operator.yaml

Lines changed: 36 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,75 @@ 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 HiveCluster.
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+
# ServiceAccount created per HiveCluster for workload pod identity.
32+
# Applied via SSA and tracked for orphan cleanup.
4033
- apiGroups:
41-
- rbac.authorization.k8s.io
34+
- ""
4235
resources:
43-
- rolebindings
36+
- serviceaccounts
4437
verbs:
4538
- create
4639
- delete
4740
- get
4841
- list
4942
- patch
50-
- update
51-
- watch
43+
# RoleBinding created per HiveCluster to bind the product ClusterRole to the workload
44+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup.
5245
- apiGroups:
53-
- apps
46+
- rbac.authorization.k8s.io
5447
resources:
55-
- statefulsets
48+
- rolebindings
5649
verbs:
57-
- get
5850
- create
5951
- delete
52+
- get
6053
- list
6154
- patch
62-
- update
63-
- watch
55+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
6456
- apiGroups:
65-
- batch
57+
- rbac.authorization.k8s.io
6658
resources:
67-
- jobs
59+
- clusterroles
60+
verbs:
61+
- bind
62+
resourceNames:
63+
- {{ include "operator.name" . }}-clusterrole
64+
# StatefulSet created per role group. Applied via SSA, tracked for orphan cleanup, and
65+
# owned by the controller.
66+
- apiGroups:
67+
- apps
68+
resources:
69+
- statefulsets
6870
verbs:
6971
- create
7072
- delete
7173
- get
7274
- list
7375
- patch
74-
- update
7576
- watch
77+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
7678
- apiGroups:
7779
- policy
7880
resources:
@@ -83,45 +85,47 @@ rules:
8385
- get
8486
- list
8587
- patch
86-
- update
87-
- watch
88+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
89+
# Also for the startup condition check before the controller can run.
8890
- apiGroups:
8991
- apiextensions.k8s.io
9092
resources:
9193
- customresourcedefinitions
9294
verbs:
93-
- get
9495
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
9596
# generated certificate in the conversion webhook.
9697
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
9798
- create
9899
- patch
100+
{{- end }}
99101
# Required for startup condition
100102
- list
101103
- watch
102-
{{- end }}
104+
# Required to report reconciliation results and warnings back to the HiveCluster object.
103105
- apiGroups:
104106
- events.k8s.io
105107
resources:
106108
- events
107109
verbs:
108110
- create
109111
- patch
112+
# Primary CRD: watched by Controller::new() and read during reconciliation.
110113
- apiGroups:
111114
- {{ include "operator.name" . }}.stackable.tech
112115
resources:
113116
- {{ include "operator.name" . }}clusters
114117
verbs:
115118
- get
116119
- list
117-
- patch
118120
- watch
121+
# Status subresource: updated at the end of every reconciliation.
119122
- apiGroups:
120123
- {{ include "operator.name" . }}.stackable.tech
121124
resources:
122125
- {{ include "operator.name" . }}clusters/status
123126
verbs:
124127
- patch
128+
# Read S3Connection configuration referenced in the HiveCluster spec.
125129
- apiGroups:
126130
- s3.stackable.tech
127131
resources:
@@ -130,55 +134,15 @@ rules:
130134
- get
131135
- list
132136
- watch
133-
- apiGroups:
134-
- rbac.authorization.k8s.io
135-
resources:
136-
- clusterroles
137-
verbs:
138-
- bind
139-
resourceNames:
140-
- {{ include "operator.name" . }}-clusterrole
137+
# Listener created per role group for external access. Applied via SSA and tracked for orphan
138+
# cleanup.
141139
- apiGroups:
142140
- listeners.stackable.tech
143141
resources:
144142
- listeners
145143
verbs:
146-
- get
147-
- list
148-
- watch
149-
- patch
150144
- create
151145
- delete
152-
---
153-
apiVersion: rbac.authorization.k8s.io/v1
154-
kind: ClusterRole
155-
metadata:
156-
name: {{ include "operator.name" . }}-clusterrole
157-
labels:
158-
{{- include "operator.labels" . | nindent 4 }}
159-
rules:
160-
- apiGroups:
161-
- ""
162-
resources:
163-
- configmaps
164-
- secrets
165-
- serviceaccounts
166-
verbs:
167146
- get
168-
- apiGroups:
169-
- events.k8s.io
170-
resources:
171-
- events
172-
verbs:
173-
- create
147+
- list
174148
- patch
175-
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
176-
- apiGroups:
177-
- security.openshift.io
178-
resources:
179-
- securitycontextconstraints
180-
resourceNames:
181-
- nonroot-v2
182-
verbs:
183-
- use
184-
{{ 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 HiveCluster RoleBinding) to the ServiceAccount that Hive
3+
# workload pods (metastore) 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 Hive 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)