Skip to content

Commit 701f694

Browse files
authored
chore: Describe RBAC rules, remove unnecessary rules (#380)
* 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: Ensure all rules have a comment * chore: Simplify comments * chore: Restore rule for legacy events
1 parent b93a4ec commit 701f694

2 files changed

Lines changed: 67 additions & 13 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 ([#380]).
8+
9+
[#380]: https://github.com/stackabletech/listener-operator/pull/380
10+
711
## [26.3.0] - 2026-03-16
812

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

deploy/helm/listener-operator/templates/roles.yaml

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,33 @@ metadata:
5050
labels:
5151
{{- include "operator.labels" . | nindent 4 }}
5252
rules:
53+
# Required by the external-provisioner sidecar, which still uses the legacy core/v1 events
54+
# API (not events.k8s.io). See upstream RBAC:
55+
# https://github.com/kubernetes-csi/external-provisioner/blob/v5.3.0/deploy/kubernetes/rbac.yaml
5356
- apiGroups:
5457
- ""
5558
resources:
5659
- events
60+
verbs:
61+
- get
62+
- list
63+
- watch
64+
# Service created per Listener. Applied via SSA and tracked for orphan cleanup.
65+
- apiGroups:
66+
- ""
67+
resources:
5768
- services
5869
verbs:
5970
- get
6071
- list
6172
- watch
6273
- create
63-
- delete # Needed to set an ownerRef on already existing Services
6474
- patch
75+
- delete
76+
# PersistentVolumes are watched to retrigger Listener reconciliation on node affinity
77+
# changes. The CSI node driver patches PV labels via Server-Side Apply to associate PVs
78+
# with their Listener. The external-provisioner sidecar creates and deletes PVs for PVC
79+
# lifecycle events.
6580
- apiGroups:
6681
- ""
6782
resources:
@@ -70,9 +85,16 @@ rules:
7085
- get
7186
- list
7287
- watch
73-
- patch
7488
- create
89+
- patch
7590
- delete
91+
# Nodes are fetched to resolve external addresses for NodePort Listeners. The
92+
# external-provisioner sidecar lists and watches Nodes for CSI volume topology
93+
# (--feature-gates=Topology=true).
94+
# PersistentVolumeClaims are read by the CSI controller and node driver for Listener
95+
# selector annotations. The external-provisioner sidecar watches PVCs to trigger PV provisioning.
96+
# Endpoints are watched to discover which nodes back a NodePort Listener, as a fallback
97+
# for older volumes that predate PV-label-based node discovery.
7698
- apiGroups:
7799
- ""
78100
resources:
@@ -83,13 +105,15 @@ rules:
83105
- get
84106
- list
85107
- watch
86-
# For automatic cluster domain detection
108+
# For automatic cluster domain detection via the local kubelet's configz API.
87109
- apiGroups:
88110
- ""
89111
resources:
90112
- nodes/proxy
91113
verbs:
92114
- get
115+
# Required by the external-provisioner sidecar to discover driver topology keys (CSINodes)
116+
# and determine volume binding mode (StorageClasses).
93117
- apiGroups:
94118
- storage.k8s.io
95119
resources:
@@ -99,46 +123,71 @@ rules:
99123
- get
100124
- list
101125
- watch
126+
# The CSI node driver reads the Pod to discover container ports and node assignment,
127+
# and labels the Pod so the Listener's Service selector can target it.
102128
- apiGroups:
103129
- ""
104130
resources:
105131
- pods
106132
verbs:
107133
- get
108134
- patch
135+
# Publish reconciliation errors as Kubernetes Events.
109136
- apiGroups:
110137
- events.k8s.io
111138
resources:
112139
- events
113140
verbs:
114141
- create
115142
- patch
143+
# ListenerClasses define how Listeners are exposed. Watched to retrigger reconciliation
144+
# when a ListenerClass changes. The operator creates preset ListenerClasses at startup.
116145
- apiGroups:
117146
- listeners.stackable.tech
118147
resources:
119148
- listenerclasses
120-
- listeners
121149
verbs:
122150
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
123-
- create
124151
- patch
125152
{{- end }}
126153
- get
127154
- list
128155
- watch
156+
- create
157+
# Listeners are the primary reconciled resource. The CSI node driver creates or updates
158+
# Listeners via Server-Side Apply for volumes that reference a ListenerClass directly.
159+
# Orphaned Listeners are cleaned up.
129160
- apiGroups:
130161
- listeners.stackable.tech
131162
resources:
132163
- listeners
164+
verbs:
165+
- get
166+
- list
167+
- watch
168+
- create
169+
- patch
170+
- delete
171+
# Update the Listener's status with resolved ingress addresses after each reconciliation.
172+
- apiGroups:
173+
- listeners.stackable.tech
174+
resources:
133175
- listeners/status
134-
- listeners/finalizers
135-
- podlisteners
136176
verbs:
137177
- patch
178+
# PodListeners record the resolved listener addresses for each volume mounted in a Pod.
179+
# Created by the CSI node driver when a Pod first mounts a Listener volume, then patched
180+
# to add entries for additional volumes.
181+
- apiGroups:
182+
- listeners.stackable.tech
183+
resources:
184+
- podlisteners
185+
verbs:
138186
- create
139-
- delete
140-
- update
187+
- patch
141188
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
189+
# Required on OpenShift to allow the listener-operator pods to run with the listener-scc
190+
# security context constraints.
142191
- apiGroups:
143192
- security.openshift.io
144193
resourceNames:
@@ -148,17 +197,18 @@ rules:
148197
verbs:
149198
- use
150199
{{ end }}
151-
# Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's
152-
# generated certificate in the conversion webhook.
153-
{{ if .Values.maintenance.customResourceDefinitions.maintain }}
200+
# Required for maintaining the CRDs (including the conversion webhook configuration) and
201+
# for the startup condition check.
154202
- apiGroups:
155203
- apiextensions.k8s.io
156204
resources:
157205
- customresourcedefinitions
158206
verbs:
207+
{{ if .Values.maintenance.customResourceDefinitions.maintain }}
208+
# Required to maintain the CRD (e.g. conversion webhook certificate).
159209
- create
160210
- patch
211+
{{ end }}
161212
# Required for startup condition
162213
- list
163214
- watch
164-
{{ end }}

0 commit comments

Comments
 (0)