Skip to content

Commit dadbb34

Browse files
authored
chore: Describe RBAC rules, remove unnecessary rules (#745)
* chore: Describe RBAC rules, remove unnecessary rules * chore: Update changelog * chore: Remove unused rules * chore: Simplify comments, group the rolebindings and clusterroles rules, and fix the crd management rule * chore: Split operator and product RBAC rules * chore(nix): Update crate hashes * chore: Remove superfluous permissions from the product clusterrole Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
1 parent 9699c43 commit dadbb34

File tree

5 files changed

+84
-86
lines changed

5 files changed

+84
-86
lines changed

CHANGELOG.md

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

33
## [Unreleased]
44

5+
### Changed
6+
7+
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#745]).
8+
9+
[#745]: https://github.com/stackabletech/hbase-operator/pull/745
10+
511
## [26.3.0] - 2026-03-16
612

713
## [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/hbase-operator/templates/roles.yaml renamed to deploy/helm/hbase-operator/templates/clusterrole-operator.yaml

Lines changed: 39 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,49 @@
1+
---
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: ClusterRole
34
metadata:
45
name: {{ include "operator.fullname" . }}-clusterrole
56
labels:
67
{{- include "operator.labels" . | nindent 4 }}
78
rules:
8-
- apiGroups:
9-
- ""
10-
resources:
11-
- nodes
12-
verbs:
13-
- list
14-
- watch
159
# For automatic cluster domain detection
1610
- apiGroups:
1711
- ""
1812
resources:
1913
- nodes/proxy
2014
verbs:
2115
- get
16+
# Manage core workload resources created per HbaseCluster.
17+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18+
# orphan cleanup (list + delete).
19+
# - configmaps: role group configuration and discovery configmap
20+
# - services: role group headless and metrics services
2221
- apiGroups:
2322
- ""
2423
resources:
25-
- pods
2624
- configmaps
2725
- services
28-
- endpoints
29-
- serviceaccounts
3026
verbs:
3127
- create
3228
- delete
3329
- get
3430
- list
3531
- patch
36-
- update
3732
- watch
33+
# ServiceAccount created per HbaseCluster for workload pod identity.
34+
# Applied via SSA and tracked for orphan cleanup.
35+
- apiGroups:
36+
- ""
37+
resources:
38+
- serviceaccounts
39+
verbs:
40+
- create
41+
- delete
42+
- get
43+
- list
44+
- patch
45+
# RoleBinding created per HbaseCluster to bind the product ClusterRole to the workload
46+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup.
3847
- apiGroups:
3948
- rbac.authorization.k8s.io
4049
resources:
@@ -45,20 +54,28 @@ rules:
4554
- get
4655
- list
4756
- patch
48-
- update
49-
- watch
57+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
58+
- apiGroups:
59+
- rbac.authorization.k8s.io
60+
resources:
61+
- clusterroles
62+
verbs:
63+
- bind
64+
resourceNames:
65+
- {{ include "operator.name" . }}-clusterrole
66+
# StatefulSet created per role group. Applied via SSA and tracked for orphan cleanup.
5067
- apiGroups:
5168
- apps
5269
resources:
5370
- statefulsets
5471
verbs:
55-
- get
5672
- create
5773
- delete
74+
- get
5875
- list
5976
- patch
60-
- update
6177
- watch
78+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
6279
- apiGroups:
6380
- policy
6481
resources:
@@ -69,89 +86,43 @@ rules:
6986
- get
7087
- list
7188
- patch
72-
- update
73-
- watch
89+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
90+
# Also for the startup condition check before the controller can run.
7491
- apiGroups:
7592
- apiextensions.k8s.io
7693
resources:
7794
- customresourcedefinitions
7895
verbs:
79-
- get
96+
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
8097
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
8198
# generated certificate in the conversion webhook.
82-
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
8399
- create
84100
- patch
101+
{{- end }}
85102
# Required for startup condition
86103
- list
87104
- watch
88-
{{- end }}
105+
# Required to report reconciliation results and warnings back to the HbaseCluster object.
89106
- apiGroups:
90107
- events.k8s.io
91108
resources:
92109
- events
93110
verbs:
94111
- create
95112
- patch
96-
- apiGroups:
97-
- listeners.stackable.tech
98-
resources:
99-
- listeners
100-
verbs:
101-
- get
113+
# Primary CRD: watched by Controller::new() and read during reconciliation.
102114
- apiGroups:
103115
- {{ include "operator.name" . }}.stackable.tech
104116
resources:
105117
- {{ include "operator.name" . }}clusters
106118
verbs:
107119
- get
108120
- list
109-
- patch
110121
- watch
122+
# Status subresource: updated at the end of every reconciliation.
111123
- apiGroups:
112124
- {{ include "operator.name" . }}.stackable.tech
113125
resources:
114126
- {{ include "operator.name" . }}clusters/status
115127
verbs:
116128
- patch
117-
- apiGroups:
118-
- rbac.authorization.k8s.io
119-
resources:
120-
- clusterroles
121-
verbs:
122-
- bind
123-
resourceNames:
124-
- {{ include "operator.name" . }}-clusterrole
125-
---
126-
apiVersion: rbac.authorization.k8s.io/v1
127-
kind: ClusterRole
128-
metadata:
129-
name: {{ include "operator.name" . }}-clusterrole
130-
labels:
131-
{{- include "operator.labels" . | nindent 4 }}
132-
rules:
133-
- apiGroups:
134-
- ""
135-
resources:
136-
- configmaps
137-
- secrets
138-
- serviceaccounts
139-
verbs:
140-
- get
141-
- apiGroups:
142-
- events.k8s.io
143-
resources:
144-
- events
145-
verbs:
146-
- create
147-
- patch
148-
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
149-
- apiGroups:
150-
- security.openshift.io
151-
resources:
152-
- securitycontextconstraints
153-
resourceNames:
154-
- nonroot-v2
155-
verbs:
156-
- use
157-
{{ 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 HbaseCluster RoleBinding) to the ServiceAccount that HBase
3+
# workload pods (masters, regionServers, restServers) 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 HBase 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)