Skip to content

Commit b045677

Browse files
committed
chore: Simplify RBAC rule descriptions
1 parent bbeb8c0 commit b045677

1 file changed

Lines changed: 18 additions & 28 deletions

File tree

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

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@ metadata:
66
labels:
77
{{- include "operator.labels" . | nindent 4 }}
88
rules:
9-
# For automatic cluster domain detection (probe node proxy to read DNS config)
9+
# For automatic cluster domain detection
1010
- apiGroups:
1111
- ""
1212
resources:
1313
- nodes/proxy
1414
verbs:
1515
- get
1616
# Manage core namespaced resources created per KafkaCluster.
17-
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18-
# orphan cleanup (list + delete). The ReconciliationPaused strategy calls get instead
19-
# of apply_patch, so get is also needed. All three are watched by the controller via
20-
# .owns(), so watch is required.
21-
# - configmaps: per-rolegroup configuration, and the discovery ConfigMap
22-
# - services: per-rolegroup headless and metrics services
23-
# - serviceaccounts: one per KafkaCluster, created by build_rbac_resources()
17+
# Applied via SSA and tracked for orphan cleanup.
2418
- apiGroups:
2519
- ""
2620
resources:
@@ -34,8 +28,8 @@ rules:
3428
- list
3529
- patch
3630
- watch
37-
# RoleBindings bind the product ClusterRole to the per-cluster ServiceAccount.
38-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
31+
# RoleBinding created per KafkaCluster to bind the product ClusterRole to the workload
32+
# ServiceAccount. Applied via SSA and tracked for orphan cleanup.
3933
- apiGroups:
4034
- rbac.authorization.k8s.io
4135
resources:
@@ -47,8 +41,8 @@ rules:
4741
- list
4842
- patch
4943
- watch
50-
# StatefulSets run the broker and (KRaft) controller role groups.
51-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
44+
# StatefulSet created per role group (broker, KRaft controller). Applied via
45+
# SSA, tracked for orphan cleanup, and owned by the controller.
5246
- apiGroups:
5347
- apps
5448
resources:
@@ -60,9 +54,7 @@ rules:
6054
- list
6155
- patch
6256
- watch
63-
# PodDisruptionBudgets protect broker and controller role groups during voluntary disruptions.
64-
# Applied via SSA and tracked for orphan cleanup. PDBs are not watched by the controller
65-
# (no .owns() / .watches()), so watch is not needed.
57+
# PodDisruptionBudget created per role group. Applied via SSA and tracked for orphan cleanup.
6658
- apiGroups:
6759
- policy
6860
resources:
@@ -73,7 +65,8 @@ rules:
7365
- get
7466
- list
7567
- patch
76-
# Maintain the CRD to support conversion webhook certificate updates and track startup conditions.
68+
# Required for maintaining the CRDs within the operator (including the conversion webhook info).
69+
# Also for the startup condition check before the controller can run.
7770
- apiGroups:
7871
- apiextensions.k8s.io
7972
resources:
@@ -88,15 +81,15 @@ rules:
8881
# Required for startup condition
8982
- list
9083
- watch
91-
# Record Kubernetes events for reconciliation outcomes
84+
# Required to report reconciliation results and warnings back to the KafkaCluster object.
9285
- apiGroups:
9386
- events.k8s.io
9487
resources:
9588
- events
9689
verbs:
9790
- create
9891
- patch
99-
# Watch and reconcile KafkaCluster resources (the primary resource for this controller)
92+
# Primary CRD: watched by the controller and read during reconciliation.
10093
- apiGroups:
10194
- {{ include "operator.name" . }}.stackable.tech
10295
resources:
@@ -105,24 +98,21 @@ rules:
10598
- get
10699
- list
107100
- watch
108-
# Write status conditions back to the KafkaCluster object
101+
# Status subresource: updated at the end of every reconciliation.
109102
- apiGroups:
110103
- {{ include "operator.name" . }}.stackable.tech
111104
resources:
112105
- {{ include "operator.name" . }}clusters/status
113106
verbs:
114107
- patch
115-
# Read AuthenticationClasses to resolve TLS and Kerberos authentication configuration.
116-
# Only get is needed: the operator resolves classes via a direct client.get() call
117-
# during reconciliation; there is no controller watch on AuthenticationClass.
108+
# Read authentication class configuration referenced in the KafkaCluster spec.
118109
- apiGroups:
119110
- authentication.stackable.tech
120111
resources:
121112
- authenticationclasses
122113
verbs:
123114
- get
124-
# Manage Listener resources for broker bootstrap and per-rolegroup exposure.
125-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
115+
# Listener created per role group. Applied via SSA and tracked for orphan cleanup.
126116
- apiGroups:
127117
- listeners.stackable.tech
128118
resources:
@@ -134,9 +124,7 @@ rules:
134124
- list
135125
- patch
136126
- watch
137-
# Bind the product ClusterRole to per-cluster ServiceAccounts (via RoleBindings above).
138-
# The operator creates RoleBindings that reference this ClusterRole, so it must have
139-
# permission to bind it.
127+
# Required to bind the product ClusterRole to the per-cluster ServiceAccount.
140128
- apiGroups:
141129
- rbac.authorization.k8s.io
142130
resources:
@@ -146,14 +134,16 @@ rules:
146134
resourceNames:
147135
- {{ include "operator.name" . }}-clusterrole
148136
---
137+
# Product ClusterRole: bound (via per KafkaCluster RoleBinding) to the ServiceAccount that Kafka
138+
# workload pods (brokers, KRaft controllers) run as.
149139
apiVersion: rbac.authorization.k8s.io/v1
150140
kind: ClusterRole
151141
metadata:
152142
name: {{ include "operator.name" . }}-clusterrole
153143
labels:
154144
{{- include "operator.labels" . | nindent 4 }}
155145
rules:
156-
# Kafka pods may emit Kubernetes events (e.g. via the Stackable commons init container)
146+
# Allows Kafka pods to emit Kubernetes events.
157147
- apiGroups:
158148
- events.k8s.io
159149
resources:

0 commit comments

Comments
 (0)