Skip to content

Commit 6a2415c

Browse files
authored
chore: Describe RBAC rules, remove unnecessary rules (#916)
* 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 comments on RBAC rules * chore: Remove the get for customresourcedefinitions for the operator clusterrole. * chore: Remove the configmaps/secrets/serviceaccounts get rule for the product clusterrole * fix: Always allow list/watch on customresourcedefinitions for the operator * chore: Simplify RBAC rule descriptions * chore: Remove the events.k8s.io rule from the product ClusterRole. The operator manages the Kubernetes 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 337bb18 commit 6a2415c

3 files changed

Lines changed: 96 additions & 93 deletions

File tree

CHANGELOG.md

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

55
## [Unreleased]
66

7+
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#916]).
8+
9+
[#916]: https://github.com/stackabletech/nifi-operator/pull/916
10+
711
## [26.3.0] - 2026-03-16
812

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

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

Lines changed: 50 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,54 @@
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 NifiCluster.
17+
# Applied via SSA and tracked for orphan cleanup.
2218
- apiGroups:
2319
- ""
2420
resources:
25-
- pods
2621
- configmaps
2722
- services
28-
- endpoints
29-
- secrets
30-
- serviceaccounts
3123
verbs:
3224
- create
3325
- delete
3426
- get
3527
- list
3628
- patch
37-
- update
3829
- watch
30+
# ServiceAccount created per NifiCluster for workload pod identity.
31+
# Applied via SSA and tracked for orphan cleanup.
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- serviceaccounts
36+
verbs:
37+
- create
38+
- delete
39+
- get
40+
- list
41+
- patch
42+
# Sensitive properties key and (when OIDC) admin password secret.
43+
- apiGroups:
44+
- ""
45+
resources:
46+
- secrets
47+
verbs:
48+
- get
49+
- create
50+
# RoleBinding created per NifiCluster to bind the product ClusterRole to the workload
51+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup.
3952
- apiGroups:
4053
- rbac.authorization.k8s.io
4154
resources:
@@ -46,20 +59,29 @@ rules:
4659
- get
4760
- list
4861
- patch
49-
- update
50-
- watch
62+
# Required to bind the product ClusterRole to per-cluster ServiceAccounts
63+
- apiGroups:
64+
- rbac.authorization.k8s.io
65+
resources:
66+
- clusterroles
67+
verbs:
68+
- bind
69+
resourceNames:
70+
- {{ include "operator.name" . }}-clusterrole
71+
# StatefulSet created per role group. Applied via SSA, tracked for orphan cleanup, and
72+
# owned by the controller.
5173
- apiGroups:
5274
- apps
5375
resources:
5476
- statefulsets
5577
verbs:
56-
- get
5778
- create
5879
- delete
80+
- get
5981
- list
6082
- patch
61-
- update
6283
- watch
84+
# Optional reporting-task Job (NiFi 1.x only). Applied via SSA and tracked for orphan cleanup.
6385
- apiGroups:
6486
- batch
6587
resources:
@@ -70,8 +92,7 @@ rules:
7092
- get
7193
- list
7294
- patch
73-
- update
74-
- watch
95+
# PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup.
7596
- apiGroups:
7697
- policy
7798
resources:
@@ -82,56 +103,59 @@ rules:
82103
- get
83104
- list
84105
- patch
85-
- update
86-
- watch
106+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
107+
# Also for the startup condition check before the controller can run.
87108
- apiGroups:
88109
- apiextensions.k8s.io
89110
resources:
90111
- customresourcedefinitions
91112
verbs:
92-
- get
93113
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
94114
# generated certificate in the conversion webhook.
95115
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
96116
- create
97117
- patch
118+
{{- end }}
98119
# Required for startup condition
99120
- list
100121
- watch
101-
{{- end }}
122+
# Required to report reconciliation results and warnings back to the NifiCluster object.
102123
- apiGroups:
103124
- events.k8s.io
104125
resources:
105126
- events
106127
verbs:
107128
- create
108129
- patch
130+
# Listener created per role group for external access. Applied via SSA and tracked for orphan
131+
# cleanup.
109132
- apiGroups:
110133
- listeners.stackable.tech
111134
resources:
112135
- listeners
113136
verbs:
137+
- create
138+
- delete
114139
- get
115140
- list
116-
- watch
117141
- patch
118-
- create
119-
- delete
142+
# Primary CRD: watched by the controller and read during reconciliation.
120143
- apiGroups:
121144
- {{ include "operator.name" . }}.stackable.tech
122145
resources:
123146
- {{ include "operator.name" . }}clusters
124147
verbs:
125148
- get
126149
- list
127-
- patch
128150
- watch
151+
# Status subresource: updated at the end of every reconciliation.
129152
- apiGroups:
130153
- {{ include "operator.name" . }}.stackable.tech
131154
resources:
132155
- {{ include "operator.name" . }}clusters/status
133156
verbs:
134157
- patch
158+
# Read authentication class configuration referenced in the NifiCluster spec.
135159
- apiGroups:
136160
- authentication.stackable.tech
137161
resources:
@@ -140,70 +164,3 @@ rules:
140164
- get
141165
- list
142166
- watch
143-
- apiGroups:
144-
- rbac.authorization.k8s.io
145-
resources:
146-
- clusterroles
147-
verbs:
148-
- bind
149-
resourceNames:
150-
- {{ include "operator.name" . }}-clusterrole
151-
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-
- secrets
164-
- serviceaccounts
165-
# This is redundant with the rule for specifically about configmaps
166-
# (due to clustering), but we read them for other purposes too
167-
- configmaps
168-
verbs:
169-
- get
170-
- apiGroups:
171-
- events.k8s.io
172-
resources:
173-
- events
174-
verbs:
175-
- create
176-
- patch
177-
# Required for Kubernetes-managed clustering, see https://nifi.apache.org/nifi-docs/administration-guide.html#kubernetes-clustering
178-
- apiGroups:
179-
- coordination.k8s.io
180-
resources:
181-
- leases
182-
verbs:
183-
- create
184-
- get
185-
- update
186-
# undocumented but required
187-
- patch
188-
# Required for Kubernetes cluster state provider, see https://nifi.apache.org/nifi-docs/administration-guide.html#kubernetes-configmap-cluster-state-provider
189-
- apiGroups:
190-
- ""
191-
resources:
192-
- configmaps
193-
verbs:
194-
- create
195-
- delete
196-
- get
197-
- list
198-
- patch
199-
- update
200-
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
201-
- apiGroups:
202-
- security.openshift.io
203-
resources:
204-
- securitycontextconstraints
205-
resourceNames:
206-
- nonroot-v2
207-
verbs:
208-
- use
209-
{{ end }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ include "operator.name" . }}-clusterrole
6+
labels:
7+
{{- include "operator.labels" . | nindent 4 }}
8+
rules:
9+
# Required for Kubernetes-managed clustering, see https://nifi.apache.org/nifi-docs/administration-guide.html#kubernetes-clustering
10+
- apiGroups:
11+
- coordination.k8s.io
12+
resources:
13+
- leases
14+
verbs:
15+
- create
16+
- get
17+
- update
18+
# undocumented but required
19+
- patch
20+
# Required for Kubernetes cluster state provider, see https://nifi.apache.org/nifi-docs/administration-guide.html#kubernetes-configmap-cluster-state-provider
21+
- apiGroups:
22+
- ""
23+
resources:
24+
- configmaps
25+
verbs:
26+
- create
27+
- delete
28+
- get
29+
- list
30+
- patch
31+
- update
32+
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
33+
# Required to use the nonroot-v2 SCC on OpenShift
34+
- apiGroups:
35+
- security.openshift.io
36+
resources:
37+
- securitycontextconstraints
38+
resourceNames:
39+
- nonroot-v2
40+
verbs:
41+
- use
42+
{{ end }}

0 commit comments

Comments
 (0)